you’ll need to write a command in your favorite scripting language (anything from php to Ruby) which takes the document as input, returns a tootip as output, and, in the actual script, does a grep for the section breaks, finds the cites in each, and returns the counts.
you can find code that does most of this in the latex bundle. I have some in markdown which also digs through a file looking for citations to return them as options in a cite drop down.
t
On 20 Jul 2014, at 13:31, Ross Ahmed rossahmed@googlemail.com wrote:
Hi all
I want to count the number of citations contained within a .Rnw file and show the result as a tool tip.
My .Rnw file looks like this:
\section{Methods}
<<plot_mtcars>>= plot(mtcars) @
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat \citet{Author2014, AuthorEtAl2014}. \citet{AuthorAuthor2013} duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\section{Results}
<<plot_iris>>= plot(iris) @
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. \citet*{Author1998} ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum \citep*{Somebody2014}.
Note that citation keys will be in one of these 3 formats: Author2014, AuthorAuthor2014 or AuthorEtAl2014.
I would like to count the total number of citations within the .Rnw file and the number in each section. In above example there are 3 citations in the Methods section and 2 citations in the Results section.
Is this possible?
Thanks Ross
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate