# glossaries with tikzDevice

I am using tikzDevice to run my R-scripts within latex.

This is my code --

\documentclass{article}
\usepackage[acronym]{glossaries}
\usepackage{tikz}

\makeglossaries

\newacronym{gcd}{GCD}{Greatest Common Divisor}

\newacronym{lcm}{LCM}{Least Common Multiple}

\begin{document}

Given a set of numbers, there are elementary methods to compute
its \acrlong{gcd}, which is abbreviated \acrshort{gcd}. This
process is similar to that used for the \acrfull{lcm}.

\begin{figure}[!ht]
\centering
\input{rtikzFile}
\end{figure}

\end{document}


where rtikzFile is created using R as follows --

library(tikzDevice)
tikz("rtikzFile.tex" )
options( tikzLatexPackages = c( getOption( "tikzLatexPackages" ), "\\usepackage[acronym]{glossaries}"))
plot(1,1,xlab="XXX")
dev.off()


Now, I would like to use \gls{lcm} instead of XXX as x-label. I have tried using \\gls\\{lcm\\} and also \\gls{lcm}. Everything just return errors, something like --

File: pgfcorepathusage.code.tex 2013/12/13 (rss-revision 1.23) \Error in getMetricsFromLatex(TeXMetrics, verbose = verbose) : TeX was unable to calculate metrics for the following string or character:

\gls{lcm}

Problem is (Guess) : - I need to pass \makeglossaries and also the compiled glossary files to it. I don't know how to do it.
Alternatively, I can just use \gls{lcm} in the rtikzFile.tex file generated after executing with R. But this is not an automated way.
• Where can tiki.sty be found? – cfr Jun 22 '16 at 0:48
• I've never use R or tikzdevice, but I'm guessing if you have to supply "\\usepackage[acronym]{glossaries}" then you'll also need to supply the entry definitions. – Nicola Talbot Jun 22 '16 at 10:21