0

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?

1
  • 2
    That seems to be a question more about R than about latex Jun 6, 2014 at 15:54

1 Answer 1

1

The Hmisc latex command does not appear to have an option to suppress the horizontal rules, so your options are:

  1. Remove the \hline commands from the file produced by R using your text editor
  2. Remove the \hline commands using a filter. Since the \hlines 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

  3. 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.

2
  • I'd assign the definition of \hline to a temporary macro to not mess with hlines elsewhere in the document.
    – 1010011010
    Jun 7, 2014 at 12:38
  • @1010011010 good point. Updated.
    – Thruston
    Jun 7, 2014 at 12:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .