Closed etiennebacher closed 3 months ago
It is correctly displayed if I use XeLaTeX
as compiler but this is not the default in Overleaf and I think it should work out of the box with the default pdflatex
. Alternatively, a warning about that would be nice.
Thanks for the report. This is tricky.
To escape <
we should probably convert it to \textless
or $<$
or \num{<}
. First problem is we don't want nested $$<$$
or \num{\num{<}}
. Second problem is that escaping in this way will break tables like this one:
model <- lm(Sepal.Width ~ Sepal.Length, data = iris)
modelsummary(model, statistic = "p.value", output = "latex")
because that table includes cells with \num{<0.001}
. Note that this doesn't work: \num{\textless 0.001}
, and neither does this:\num{\text{\textless} 0.001}
Also need to be mindful of the possibility of:
options(modelsummary_format_numeric_latex = “mathmode”)
Although I guess people will not want to escape there anyway, so will set escape=FALSE
explicitly.
Finally, note that the actual escaping is delegated to tinytable::format_tt(x, escape="latex")
Yes, I understand that this is tricky and there are many corner cases. But at the same time, I think many people set stars = TRUE
and just want a simple table without having to tweak the output manually.
Can't you escape the text in note{}={+ p < 0.1, * p < 0.05, ** p < 0.01, *** p < 0.001}
as soon as stars = TRUE
(or rather is not FALSE
)?
Also need to be mindful of the possibility of:
options(modelsummary_format_numeric_latex = "mathmode")
Setting this option and using escape = FALSE
doesn't fix the issue:
Oh yes, I agree. Just trying to list all the corner cases to figure out what the best solution is.
Thanks for the report. Should be fixed after installing the latest development versions of both tinytable
and modelsummary
.
Then, restart your R
session completely.
Let me know if it's still broken.
Thanks for the report!
Works for me now, thanks!
Close to #793 but even with the Github version I have this escaping problem.
But if I put this in a
.tex
file (with the packages printed in the warning ofmodelsummary()
that I didn't show here):