Skip to content
This repository has been archived by the owner on Sep 23, 2018. It is now read-only.

Commit

Permalink
Merge remote branch 'cam/beta'
Browse files Browse the repository at this point in the history
Conflicts:
	man/sanitizeTexString.Rd
	man/tikz.Rd
  • Loading branch information
Sharpie committed Aug 4, 2010
2 parents 5232b2a + c094e8e commit bc8fdb7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions R/latexStrWidth.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,20 @@ function( TeXMetrics ){

# We calculate width for both characters and strings.
writeLines("\\path let \\p1 = ($(TeX.east) - (TeX.west)$),
\\n1 = {veclen(\\x1,\\y1)} in
\\n1 = {veclen(\\x1,\\y1)} in (TeX.east) -- (TeX.west)
node{ \\typeout{tikzTeXWidth=\\n1} };", texIn)

# We only want ascent and descent for characters.
if( TeXMetrics$type == 'char' ){

# Calculate the ascent and print it to the log.
writeLines("\\path let \\p1 = ($(TeX.north) - (TeX.base)$),
\\n1 = {veclen(\\x1,\\y1)} in
\\n1 = {veclen(\\x1,\\y1)} in (TeX.north) -- (TeX.base)
node{ \\typeout{tikzTeXAscent=\\n1} };", texIn)

# Calculate the descent and print it to the log.
writeLines("\\path let \\p1 = ($(TeX.base) - (TeX.south)$),
\\n1 = {veclen(\\x1,\\y1)} in
\\n1 = {veclen(\\x1,\\y1)} in (TeX.base) -- (TeX.south)
node{ \\typeout{tikzTeXDescent=\\n1} };", texIn)

}
Expand Down
10 changes: 7 additions & 3 deletions man/sanitizeTexString.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ Cameron Bracken \email{cameron.bracken@gmail.com}
\code{\link{tikz}}
}
\examples{
# Although we may want -1 to be a superscript it gets sanitized away with
# the other default special characters
# sanitizeTexString('10\% of 10\$ is 10^{-1}\$')
# Be careful with sanitizing, it may lead to unexpected behavior.
# For example, we may want -1 to be a superscript it gets
# sanitized away with the other default special characters.
# The string appears in LaTeX exactly as shown.
\dontrun{
sanitizeTexString('10% of 10$ is 10^{-1}$')
}
}
\keyword{ character }
4 changes: 2 additions & 2 deletions man/tikz.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ Multiple plots will be placed as separate environments in the output file.
}

\section{Options That Affect Package Behavior}{
The \pkg{tikzDevice} package is currently influenced by a number of global options that may be set your \R{} scripts, in the \R{} console or in your in a \code{.Rprofile} file. All of the options can be set by using \code{options(<option> = <value>)}. These options allow for the use of custom \code{documentclass} declarations, LaTeX packages, and typesetting engines (e.g. XeLaTeX). The defaults , if are any for a given option, are shown below the description. The global options are:
The \pkg{tikzDevice} package is currently influenced by a number of global options that may be set your \R\ scripts, in the \R\ console or in your in a \code{.Rprofile} file. All of the options can be set by using \code{options(<option> = <value>)}. These options allow for the use of custom \code{documentclass} declarations, LaTeX packages, and typesetting engines (e.g. XeLaTeX). The defaults , if are any for a given option, are shown below the description. The global options are:

\describe{
\item{\code{tikzLatex}}{ Specifies the location of the LaTeX compiler to be used by \pkg{tikzDevice}. Setting this option may help the package locate a missing compiler. The default is searched for when the package is loaded, otherwise it can be set manually. This option may be set as follows: \code{options( tikzLatex = '/path/to/latex/compiler' )}.}

\item{\code{tikzMetricsDictionary}}{ When using the graphics device provided by \pkg{tikzDevice}, you may notice that \R{} appears to ``lag" or ``hang" when commands such as \code{plot()} are executed. This is because the device must query the LaTeX compiler for string widths and font metrics. For a normal plot, this may happen dozens or hundreds of times- hence \R{} becomes unresponsive for a while. The good news is that the \code{tikz()} code is designed to cache the results of these computations so they need only be performed once for each string or character. By default, these values are stored in a temporary cache file which is deleted when \R{} is shut down. A location for a permanent cache file may be specified by setting the value of \code{tikzMetricsDictionary} in \code{.Rprofile} with \code{options( tikzMetricsDictionary = '/path/to/dictionary/location' )}.}
\item{\code{tikzMetricsDictionary}}{ When using the graphics device provided by \pkg{tikzDevice}, you may notice that \R\ appears to ``lag" or ``hang" when commands such as \code{plot()} are executed. This is because the device must query the LaTeX compiler for string widths and font metrics. For a normal plot, this may happen dozens or hundreds of times- hence \R\ becomes unresponsive for a while. The good news is that the \code{tikz()} code is designed to cache the results of these computations so they need only be performed once for each string or character. By default, these values are stored in a temporary cache file which is deleted when \R\ is shut down. A location for a permanent cache file may be specified by setting the value of \code{tikzMetricsDictionary} in \code{.Rprofile} with \code{options( tikzMetricsDictionary = '/path/to/dictionary/location' )}.}

\item{\code{tikzDocumentDeclaration}}{A string. The LaTeX documentclass declaration used in output files when \code{standAlone == TRUE}. \code{tikzDocumentDeclaration} also influences the calculation of font metrics. The default value is:

Expand Down
1 change: 1 addition & 0 deletions man/tikzAnnotate.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Cameron Bracken <cameron.bracken@gmail.com>
dev.off()
}
}

% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ device }

0 comments on commit bc8fdb7

Please sign in to comment.