On 10 February 2013 01:33, stefano franchi <stefano.fran...@gmail.com>wrote:

> One way to go about it  is to use bibtool to extract all the references
> your article/book uses from your aux file and dump them in a new .bib file.
> Then you can use grep on the @ character to count them. Not foolproof but
> should get you fairly close. Or you can open the new bib file in a bibtex
> editor (JabRef, Bibdesk, etc) and let it count them for you.
>
> So, you'd export the file to latex (with file>>export), then run latex on
> the exported file (new-file.tex, let's say) in a terminal window, and then
> run bibtool on the .aux  file it produced:
>
> bibtool -x my-file.aux -o new-bibliography.bib
>
>
> Then run grep on the the new bib file:
>
> grep --count @ new-bibliography.bib
>
> Look at this thread on tex.stackexchange for other ideas:
>
>
> http://tex.stackexchange.com/questions/32032/extract-all-citations-from-tex-file
>
> Cheers,
>
> Stefano
>
>
>
> --
> __________________________________________________
> Stefano Franchi
> Associate Research Professor
> Department of Hispanic Studies            Ph:   +1 (979) 845-2125
> Texas A&M University                          Fax:  +1 (979) 845-6421
> College Station, Texas, USA
>
> stef...@tamu.edu
> http://stefano.cleinias.org
>

Thanks guys, so it seems there are several ways to go about it. Wolfgang,
you are correct; I think that's the simplest approach (so simple that I
wonder why I didn't think of it).

In the meantime I cooked up a script based on a one-liner that appeared to
work, given some constraints. Attached is the shell script (requires
dos2unix if you work with Windows-saved files) which takes files as
arguments (so it can report per-file citation count), e.g. "lyxcitecount
*.lyx".

I'll see if I can somehow integrate such a count into the LyX statistics
dialog. I think that'll be pretty neat, especially since it'll work for
selections as well. The problem in this case, I suppose, would be that
different bib engines use different cite commands.


--
GPG/PGP ID: C0711BF1

Attachment: lyxcitecount.sh
Description: Bourne shell script

Reply via email to