Skip to content

is there a way to *not* protect latex? #2

Open
@bbolker

Description

@bbolker

It would be nice to be able to be able to use raw LaTeX text in a specified table column (or in column headings) ... is there a way to do this, or could there be? I poked around for a while ...

huxtable

library(huxtable)
tt <- tribble_hux(
       ~ Name,             ~ Salary,
         "$\\alpha",       50000,
         "Jane Doe$^2$",         50000,
         "$\\sum_{i=1} x_i", 50000,
         add_colnames = TRUE
)
cc <- function(...) cat(...,file="tmp.tex")
cc("\\documentclass{article}\n")
texpkgs <- c("array","caption","graphicx","siunitx","multirow",
             "hhline","calc","tabularx")
for (tt in texpkgs) {
    cc(sprintf("\\usepackage{%s}\n",tt),append=TRUE)
}
cc("\\usepackage[table]{xcolor}\n\\begin{document}",append=TRUE)
cc(to_latex(tt),append=TRUE)
cc("\\end{document}",append=TRUE)
system("pdflatex tmp.tex")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions