PrettyTables.jl
PrettyTables.jl copied to clipboard
LaTeX table_type array
Would it be possible to add a table type array
for LaTeX output? This should be fairly simple to implement, the idea being to replace \begin{tabular} ... \end{tabular}
with \begin{array} ... \end{array}
and \begin{table} ... \end{table}
with a suitable and possibly customizable math environment, e.g., \begin{equation} ... \end{equation}
, \[ ... \]
or ```math ... ```
for markdown output.
I am currently capturing the PrettyTables output and doing those replacements by hand, e.g. for printing tab_arr
the code looks like:
strio = IOBuffer()
pretty_table(strio, tab_arr,
backend = :latex,
vlines = [1],
hlines = [s],
noheader = true)
tab_latex = String(take!(strio))
tab_markdown = replace(tab_latex, "tabular" => "array")
tab_markdown = replace(tab_markdown, "\\begin{table}" => "```math")
tab_markdown = replace(tab_markdown, "\\end{table}" => "```")
print(io, "text/markdown", tab_markdown)
While this works fine, it would be nice to have an in-package solution.
Hi @michakraus
This should be very easy to implement, and also very handy. Thanks for the suggestion 👍🏻
I just need to see how can I make everything work with respect to the headers, highlighters, etc., but I will implement this.
Splendid! Thanks a lot!