getLatexStrWidth(texString, cex=1, face=1, engine=getOption("tikzDefaultEngine"))
texString
in point size.tikz
device for proper string
placement in graphics. This function first checks to see if the width
exists in a global or temporary string width dictionary (as define in
options('tikzMetricsDictionary')
) and if so will pull the width from
there. If the dictionary does not exist then a temporary one for the current
R session is created and the string width is calculated via a system
call to latex. The calling of latex to calculate a string width is quit
expensive and so we strongly recommend setting
options('tikzMetricsDictionary') <- /path/to/dictionary
to create a
global dictionary.tikz
, getLatexCharMetrics
getLatexStrWidth('{\\tiny Hello \\LaTeX!}')
Run the code above in your browser using DataLab