LaTeX Backend Examples
Here, we can see some examples of LaTeX tables generated by PrettyTables.jl. Notice that the output has been rendered to PDF using LuaTeX and converted to PNG using ImageMagick.
julia> data = Any[
1 false 1.0 0x01
2 true 2.0 0x02
3 false 3.0 0x03
4 true 4.0 0x04
5 false 5.0 0x05
6 true 6.0 0x06
]
julia> pretty_table(data; backend = :latex)

This example uses the predefined format for the LaTeX backend latex_table_format__booktabs
.
julia> data = [
10.0 6.5
3.0 3.0
0.1 1.0
]
julia> row_labels = [
"Atmospheric drag"
"Gravity gradient"
"Solar radiation pressure"
]
julia> column_labels = [
[MultiColumn(2, "Value", :c)],
[
latex_cell"\textbf{Torque} [10$^{-5}$ Nm]",
latex_cell"\textbf{Angular Momentum} [10$^{-3}$ Nms]"
]
],
julia> pretty_table(
data;
backend = :latex,
column_labels,
merge_column_label_cells = :auto,
row_labels,
stubhead_label = "Effect",
style = LatexTableStyle(column_label = []),
summary_row_labels = ["Total"],
summary_rows = [(data, i) -> sum(data[:, i])],
table_format = latex_table_format__booktabs
)
julia> t = 0:1:20
julia> data = hcat(t, ones(length(t) ), t, 0.5.*t.^2);
julia> column_labels = [
[ "Time", "Acceleration", "Velocity", "Distance"],
[ latex_cell"{[s]}", latex_cell"[m / s$^2$]", "[m / s]", "[m]"]
]
julia> hl_p = LatexHighlighter(
(data, i, j) -> (j == 4) && (data[i, j] > 9),
["textcolor{blue!60}"]
)
julia> hl_v = LatexHighlighter(
(data, i, j) -> (j == 3) && (data[i, j] > 9),
["textcolor{red!60}"]
)
julia> pretty_table(
data;
backend = :latex,
column_labels = column_labels,
highlighters = [hl_p, hl_v],
style = LatexTableStyle(column_label = []),
table_format = latex_table_format__booktabs
)
