I am trying to generate a tex table using xtable. In R, the table contains:
>tvPre
p\\_1 p\\_2 p\\_3
FV "\\textuparrow M" "" "\\textuparrow R"
a "\\textuparrow WH" "" ""
b "\\textuparrow H" "" "\\textuparrow (H)"
c "\\textuparrow (WH)" "" "\\textuparrow (H)"
Oil "\\textuparrow W" "\\textuparrow R" "\\textdownarrow R"
If I print in the console using an identity function for sanitizing, then is fine: The instruction :
print(xtable(tvPre), rotate.colnames=T,
sanitize.text.function = getOption("xtable.sanitize.text.function", function(x)x))
Then, I obtain:
& \begin{sideways} p\_1 \end{sideways} & \begin{sideways} p\_2\end{sideways} & \begin{sideways} p\_3 \end{sideways} \\
\hline
FV & \textuparrow M & & \textuparrow R \\
a & \textuparrow WH & & \\
b & \textuparrow H & & \textuparrow (H) \\
c & \textuparrow (WH) & & \textuparrow (H) \\
O & \textuparrow W & \textuparrow R & "\\textdownarrow R" \\
Nevertheless, when I put the code in a Sweave file (.Rnw
), then in the .tex
I obtain:
& \begin{sideways} p\_1 \end{sideways} & \begin{sideways} p\_2\end{sideways} & \begin{sideways} p\_3 \end{sideways} \\
\hline
FV & \textuparrow M & & \textuparrow R \\
a & \textuparrow W & & \\
b & H & & H \\
c & \textuparrow W & & H \\
O & \textuparrow W & \textuparrow R & \textdownarrow R \\
Then, all parenthesis disappear and the arrow as well. I tried using $\\uparrow$
as well, but still not working.
The third line, second column ("\\textuparrow WH"
) is printed without the "H"
, but in the next line " \\textuparrow H"
is printed only the "H"
.
The rest of cells with parenthesis are printed without arrows nor parenthesis in the .tex
file.
I need to print in the .tex as is printed in the console, some clue??