View source: R/latexTablePDF.R
| latexTablePDF | R Documentation |
latexTablePDF() takes an object produced by \linkIntlatexTable and
writes a PDF file. It can also write the corresponding .tex file.
latexTablePDF( latexTable, container = TRUE, containerFilename = "tableContainer.tex", outputFilenameStem = "latexTable", writePDF = TRUE, writeTex = FALSE, overwriteExisting = FALSE, verbose = FALSE, continuedFloat = FALSE, continuedFloatStar = FALSE, firstPageEmpty = container, firstTableNumber = NULL, openPDFOnExit = TRUE )
latexTable |
Object of class |
container |
Logical variable. Should the LaTeX code in |
containerFilename |
A string. Specifies the path of the "container"
LaTeX file into which the |
outputFilenameStem |
A string. It is the path and name of the file
is to be saved to disk, up to the extension. For example, if you want to
save "myTable.pdf" to disk, set |
writePDF |
Logical variable. Should a PDF file be saved to disk? |
writeTex |
Logical variable. Should a .tex file be saved to disk? |
overwriteExisting |
Logical variable. Should files to be saved overwrite existing files that have the same names? |
verbose |
Logical variable. |
continuedFloat |
Logical variable. Should be |
continuedFloatStar |
Logical variable. Should be |
firstPageEmpty |
Logical variable. Defaults to the value of
|
firstTableNumber |
Integer. What number should the first table in
|
openPDFOnExit |
Logical variable. Open the PDF file after it is created
by |
Although latexTablePDF produces PDF files by default, it is also
useful for creating .tex files. For example, you may have a list of tables
produced by latexTable() and a complex LaTeX
document that contains many different sections and tables. When
latexTablePDF is used with writeTex = TRUE, it will produce a
single file that contains LaTeX code for all of the tables in your list.
You can then insert those tables into your LaTeX document by adding a
single \input or \include command to your LaTeX document.
For details, see vignette("tables", package = "Bullock").
Required LaTeX tools. If writePDF is FALSE, you do not
need to have LaTeX installed. But if writePDF is TRUE:
pdflatex must be installed on your system. It is part of almost
every LaTeX installation. The array and afterpage packages must also
be installed; if you have a LaTeX installation, you already have these
packages.
The booktabs, caption, and numprint must be installed.
If containerFilename is "tableContainer.tex" (the default), the
fancyhdr, footmisc, geometry, and ragged2e packages must be
installed.
If you are producing a landscaped table, the pdflscape package
must be installed.
If your latexTable() output was produced with floatPlacement = 'H',
the float package must be installed.
Other functions for making tables: \linkIntlatexTable,
\linkIntregTable. See also the Building better tables in less time
and Using latexTable() with R Markdown and Rnw documents
vignettes.
## Not run:
data(iris)
lm1 <- lm(Sepal.Length ~ Petal.Length, data = iris)
lm2 <- lm(Sepal.Length ~ Petal.Length + Petal.Width, data = iris)
lm3 <- lm(Sepal.Length ~ Petal.Length * Petal.Width, data = iris)
lmList <- list(lm1, lm2, lm3)
rT1 <- regTable(lmList)
lT1 <- latexTable(
mat = rT1,
colNames = lt_colNumbers(),
rowNames = c(
"Intercept",
"Petal length",
"Petal width",
"Petal length $\\times$ petal width"),
footerRows = list(lt_nobsRow(), lt_rSquaredRow()),
spacerRows = 1, # insert white space between Intercept row and other rows
caption = paste0(
"\\textit{Sepal length as a function of petal length and petal width.} ",
"Entries are estimates and standard errors from OLS regressions..."
)
)
latexTablePDF(lT1, outputFilenameStem = "irisData")
# Create a PDF or .tex file that contains two tables:
lm1v <- update(lm1, subset = (Species == 'versicolor'))
lm2v <- update(lm2, subset = (Species == 'versicolor'))
lm3v <- update(lm3, subset = (Species == 'versicolor'))
rT2 <- regTable(list(lm1v, lm2v, lm3v))
lT2 <- update(lT1, mat = rT2, commandName = "tableVersicolor")
latexTablePDF( # PDF with two pages
lT2,
outputFilenameStem = "irisData_twoTables")
latexTablePDF( # add .tex file with code for two tables
lT2,
outputFilenameStem = "irisData_twoTables",
writeTex = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.