Learn R Programming

tikzDevice (version 0.5.2)

getLatexCharMetrics: Obtain LaTeX Font Metrics for Characters

Description

This function is used to retrieve the ascent, decent and width of a character glyph as it would appear in output typeset by LaTeX.

Usage

getLatexCharMetrics( charCode, cex=1, face=1 )

Arguments

charCode
an integer that corresponds to a symbol in the ASCII character table under the Type 1 font encoding. All numeric values are coerced using as.integer. Non-numeric values will not be accepted.
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.

Value

  • metricsA numeric vector holding ascent, descent, width character metrics. Values should all be nonnegative.

Details

getLatexCharMetrics first checks to see if metrics have allready been calculated for the given character using the given values of cex and face. If so, cached values are returned. If no cached values exists, the LaTeX compiler specified by options( tikzLatex ) is invoked in order to calculate them.

References

PGF Manual

See Also

tikz, getLatexStrWidth

Examples

Run this code
# Calculate ascent, descent and width for "A"
	getLatexCharMetrics(65)

Run the code above in your browser using DataLab