rms (version 5.1-2)

latexrms: LaTeX Representation of a Fitted Model


Creates a file containing a LaTeX representation of the fitted model. For model-specific typesetting there is latex.lrm, latex.cph, latex.psm and latex.ols. latex.cph has some arguments that are specific to cph models. latexrms is the core function which is called internally by latexrms (which is called by latex.cph, latex.ols, etc.). html and R Markdown-compatible markup (using MathJax) are written if options(prType='html').


 append=FALSE, which=1:p, varnames, columns=65, prefix=NULL, inline=FALSE,
 before=if(inline)"" else "& &", after="", intercept, pretrans=TRUE,
 digits=.Options$digits, size="")



a fit object created by a fitting function in the rms series


name of .tex file to create, default is to write to console. file is ignored when options(prType='html'.


whether or not to append to an existing file


a vector of subcripts (corresponding to object$Design$name) specifying a submodel to print. Default is to describe the whole model. which can also be a vector of character strings specifying the factor names to print. Enough of each string is needed to ensure a unique match. Names for interaction effects are of the form "age * sex". For any interaction effect for which you do not request main effects, the main effects will be added to which. When which is given, the model structural statement is not included. In this case, intercepts are not included either.


variable names to substitute for non-interactions. Order must correspond to object$Design$name and interactions must be omitted. Default is object$Design$name[object$Design$assume.code!=9]. varnames can contain any LaTeX commands such as subscripts and "\\\\frac" (all "\" must be quadrupled.) Any "/" must be preceeded by "\\" (2, not 4 backslashes). Elements of varnames for interactions are ignored; they can be set to any value.


maximum number of columns of printing characters to allow before outputting a LaTeX newline command


if given, a LaTeX \lefteqn command of the form \lefteqn{prefix =} \\ will be inserted to print a left-hand-side of the equation.


Set to TRUE to create text for insertion in an in-line equation. This text contains only the expansion of X beta, and is not surrounded by "$".


a character string to place before each line of output. Use the default for a LaTeX eqnarray environment. For inline=TRUE, the before string, if not an empty string, will be placed once before the entire markup.


a character string to place after the output if inline=TRUE


a special intercept value to include that is not part of the standard model parameters (e.g., centering constant in Cox model). Only allowed in the latexrms rendition.


if any spline or polynomial-expanded variables are themselves transformed, a table of pre-transformations will be formed unless pretrans=FALSE.


number of digits of precision to use in formatting coefficients and other numbers


a LaTeX font size to use for the output, without the slash. Default is current size.


a file name of class "latex", or if options(prType='html'), nothing (output direct to console)

See Also

latex, rcspline.restate, rms


Run this code
f <- lrm(death ~ rcs(age)+sex)
w <- latex(f, file='f.tex')
w     # displays, using e.g. xdvi
latex(f)    # send LaTeX code to console, as for knitr
latex(f)    # emit html and latex for knitr html and html notebooks
# }

Run the code above in your browser using DataLab