I have been struggling with this for some time and can't really find an answer. By default the latex
command in Hmisc
package cab generate code for table with hline
on top, below header row and after the last row. Is there a way to customize this? E.g. I do not want any horizontal line in the table. Is that possible?
-
2That seems to be a question more about R than about latex– David CarlisleJun 6, 2014 at 15:54
1 Answer
The Hmisc latex
command does not appear to have an option to suppress the horizontal rules, so your options are:
- Remove the
\hline
commands from the file produced by R using your text editor Remove the
\hline
commands using a filter. Since the\hline
s are always written on their own lines, then if you have a sensible command shell available, you could try:cat table-from-r.tex | grep -v hline >table-for-latex.tex
Redefine
\hline
to do nothing: just input the table from R inside a group where you have defined\let\hline\space
.
For example, running latex(cars)
in R produces cars.tex
complete with hline
commands, but this:
\documentclass{article}
\begin{document}
{\let\hline\space\input{cars.tex}}
\end{document}
prints the table with no rules. The normal definition of \hline
is restored at the end of the group. I suspect that option 3 is likely to be what you want to do, if you are committed to the Hmisc
package, but you might prefer to try xtable
which does a rather more flexible job of producing LaTeX (and HTML) versions of R data objects, and includes an option to suppress all \hline
commands in the output.
-
I'd assign the definition of
\hline
to a temporary macro to not mess withhline
s elsewhere in the document. Jun 7, 2014 at 12:38 -