The R Project SVN R

Rev

Rev 88521 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 88521 Rev 88559
Line 1... Line 1...
1
% File src/library/tools/man/parseLatex.Rd
1
% File src/library/tools/man/parseLatex.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2023 R Core Team
3
% Copyright 1995-2025 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{parseLatex}
6
\name{parseLatex}
7
\alias{parseLatex}
7
\alias{parseLatex}
8
\alias{deparseLatex}
8
\alias{deparseLatex}
Line 23... Line 23...
23
           verb = "\\\\Sexpr",
23
           verb = "\\\\Sexpr",
24
           defcmd = c("\\\\newcommand", "\\\\renewcommand",
24
           defcmd = c("\\\\newcommand", "\\\\renewcommand",
25
                      "\\\\providecommand", "\\\\def", "\\\\let"),
25
                      "\\\\providecommand", "\\\\def", "\\\\let"),
26
           defenv = c("\\\\newenvironment",
26
           defenv = c("\\\\newenvironment",
27
                      "\\\\renewenvironment"))
27
                      "\\\\renewenvironment"))
-
 
28
 
28
deparseLatex(x, dropBraces = FALSE)
29
deparseLatex(x, dropBraces = FALSE, math = c("$", "$"))
29
latexToUtf8(x)
30
latexToUtf8(x)
30
}
31
}
31
\arguments{
32
\arguments{
32
\item{text}{
33
\item{text}{
33
A character vector containing \LaTeX source code.
34
A character vector containing \LaTeX source code.
Line 54... Line 55...
54
A \code{"LaTeX"} object.
55
A \code{"LaTeX"} object.
55
}
56
}
56
\item{dropBraces}{
57
\item{dropBraces}{
57
Drop unnecessary braces when displaying a \code{"LaTeX"} object.
58
Drop unnecessary braces when displaying a \code{"LaTeX"} object.
58
}
59
}
-
 
60
\item{math}{
-
 
61
A character vector of length 2 containing \LaTeX code that opens and
-
 
62
closes a \verb{MATH} block. Note that \code{parseLatex} currently
-
 
63
only tags \samp{$...$} as \code{"MATH"}, but not \samp{\\(...\\)}
-
 
64
nor \LaTeX's \samp{math} environment.
-
 
65
}
59
}
66
}
60
\details{
67
\details{
61
The parser does not recognize all legal \LaTeX code, only relatively
68
The parser does not recognize all legal \LaTeX code, only relatively
62
simple examples.  It does not associate arguments with macros, that
69
simple examples.  It does not associate arguments with macros, that
63
needs to be done after parsing, with knowledge of the definitions of
70
needs to be done after parsing, with knowledge of the definitions of
Line 81... Line 88...
81
 
88
 
82
The \code{latexToUtf8()} function returns a modified version of the
89
The \code{latexToUtf8()} function returns a modified version of the
83
\code{"LaTeX"} object that was passed to it.
90
\code{"LaTeX"} object that was passed to it.
84
}
91
}
85
\author{
92
\author{
86
Duncan Murdoch
93
Duncan Murdoch and the R Core Team
87
}
94
}
88
\examples{
95
\examples{
89
latex <- parseLatex("fran\\\\c{c}ais", verbose = TRUE)
96
latex <- parseLatex("fran\\\\c{c}ais", verbose = TRUE)
90
\dontdiff{deparseLatex(latexToUtf8(latex))}% possibly "....<U+00E7>..."
97
\dontdiff{deparseLatex(latexToUtf8(latex))}% possibly "....<U+00E7>..."
-
 
98
 
-
 
99
deparseLatex(parseLatex("$t$"), math = c("\\\\eqn{", "}"))
91
}
100
}
92
\keyword{ utilities }
101
\keyword{ utilities }
93
\keyword{ documentation }
102
\keyword{ documentation }