getLatexStrWidth {tikzDevice} | R Documentation |
Obtain the Width of an Arbitrary LaTeX String This function calculates the width of a string as it would appear after being compiled by LaTeX.
getLatexStrWidth(texString, cex=1, face=1, engine=getOption("tikzDefaultEngine"))
texString |
An arbitrary string for which the width is to be calculated. May contain LaTeX markup. |
cex |
a real number that specifies a scaling factor that is to be applied to device output. |
face |
an integer in the range [1-5] that specifies the font face to use. See par for details. |
engine |
a string specifying which TeX engine to use. Possible values are 'pdftex' and 'xetex'. See the Unicode section of tikzDevice for details. |
This function is used internally by the 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.
width |
The width of |
tikzDevice tries very hard when it is loaded to find a
working latex
or pdflatex
command. If it is
successful the command is set in options('tikzLatex')
, otherwise
this function will fail.
Charlie Sharpsteen source@sharpsteen.net and Cameron Bracken cameron.bracken@gmail.com
getLatexStrWidth('{\\tiny Hello \\LaTeX!}')