Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align="d" is not supported for rows: style_tt(i = 1, align = "d") #361

Open
simonheb opened this issue Oct 16, 2024 · 3 comments
Open

align="d" is not supported for rows: style_tt(i = 1, align = "d") #361

simonheb opened this issue Oct 16, 2024 · 3 comments

Comments

@simonheb
Copy link

The following code produces uncompilable LaTeX:

z <- data.frame(pi = c(pi * 100, pi * 1000, pi * 10000, pi * 100000))
tt(z) |>
    format_tt(j = 1, digits = 8, num_fmt = "significant_cell") |>
    style_tt(i = 1, align = "d") |> print("latex")

LaTeX:

\begin{table}
\centering
\begin{tblr}[         %% tabularray outer open
]                     %% tabularray outer close
{                     %% tabularray inner open
colspec={Q[]},
row{2}={si={table-format=-6.5,table-align-text-before=false,table-align-text-after=false,input-symbols={-,\*+()}},},
row{1}={guard},
}                     %% tabularray inner close
\toprule
pi \\ \midrule %% TinyTableHeader
314.15927 \\
3141.5927 \\
31415.927 \\
314159.27 \\
\bottomrule
\end{tblr}
\end{table} 

TeX Error message: "Undefined color `si'. \end".

I'm not sure what the ideal solution would be, since the user requests a rather unusual table configuration, but I guess it should be a t least some kind of error/warning.

@vincentarelbundock
Copy link
Owner

What did you insert in the LaTeX document preamble?

https://vincentarelbundock.github.io/tinytable/man/tt.html#latex-preamble

@simonheb
Copy link
Author

This is the whole doc:

\documentclass{article}
\usepackage{tabularray}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amssymb}
\UseTblrLibrary{booktabs}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{table}
	\centering
	\begin{tblr}[         %% tabularray outer open
		]                     %% tabularray outer close
		{                     %% tabularray inner open
			colspec={Q[]},
			row{2}={si={table-format=-6.5,table-align-text-before=false,table-align-text-after=false,input-symbols={-,\*+()}},},
			row{1}={guard},
		}                     %% tabularray inner close
		\toprule
		pi \\ \midrule %% TinyTableHeader
		314.15927 \\
		3141.5927 \\
		31415.927 \\
		314159.27 \\
		\bottomrule
	\end{tblr}
\end{table}
\end{document}

@vincentarelbundock vincentarelbundock changed the title Uncompilable LaTeX code when setting alignment for rows align="d" is not supported for rows: style_tt(i = 1, align = "d") Oct 16, 2024
@vincentarelbundock
Copy link
Owner

aah, sorry, I misread your original post.

align="d" is only supported as a column format, not as a row format.

I will add an informative error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants