[R] Greek symbols in xtable rows
Charles C. Berry
cberry at tajo.ucsd.edu
Mon Apr 16 21:38:05 CEST 2007
On Mon, 16 Apr 2007, Andris Jankevics wrote:
> Dear R-helpers,
>
> I am using xtable package to prepare a Latex code of some R tables.
> Is this possible to have a greek symbols in xtable cells?
>
> How can I get for example a string of : $\Delta$
>
>> "$\Delta$"
> [1] "$Delta$"
>
> And string: > "$\\Delta$"
> [1] "$\\Delta$"
>
> Gives a latex aoutput like: \$$\backslash$Delta\$
The posting guide says
Sometimes it helps to provide a small example that someone can
actually run.
which you did not do.
This makes it hard for us to pinpoint the error.
For me, this works
> mat <- diag(c("$\\sigma_1^2$","$\\sigma_2^2$"))
> xtable(mat)
% latex table generated in R 2.4.1 by xtable 1.4-2 package
% Mon Apr 16 12:27:54 2007
\begin{table}[ht]
\begin{center}
\begin{tabular}{rll}
\hline
& 1 & 2 \\
\hline
1 & $\sigma_1^2$ & 0 \\
2 & 0 & $\sigma_2^2$ \\
\hline
\end{tabular}
\end{center}
\end{table}
>
and placing the text output in between
\documentclass{article}
\begin{document}
and
\end{document}
saving the file and running latex (or pdflatex) produces nicely set
output with the Greek letter 'sigma' properly rendered.
>
> Thank You in advance
>
> Andris Jankevics
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list