[R-pkg-devel] Add space between columns in \tabular{} in Rd files.
Rolf Turner
r@turner @end|ng |rom @uck|@nd@@c@nz
Sun Jul 14 03:13:19 CEST 2019
On 13/07/19 9:38 PM, Duncan Murdoch wrote:
> On 12/07/2019 9:43 p.m., Rolf Turner wrote:
>>
>> This is fussing over a very minor issue, but ... well, I have OCD, I
>> guess.
>>
>> I've tried adding extra "blank" columns between my real columns (extra
>> \tab's with blank fields) but these have no effect. The blanks are
>> simply suppressed. There does not seem to be (perhaps I'm overlooking
>> something) any equivalent in the Rd syntax of \hspace{} in LaTeX.
>>
>> Can anyone suggest any possibilities?
>
> You can include raw HTML or Latex in the Rd file using the \out{} macro.
> See the example in section 2.11 of Writing R Extensions.
>
> In HTML there are a lot of "entities" for different size spaces, e.g.
> " ", " ", etc. You can use "\hspace{}" in LaTeX.
Thank you Duncan!!! Worked like a charm!
For the possible benefit (???) of others (Duncan knows all this I'm sure):
Since I had to put in a lot of such spaces I defined a macro "\ics"
("inter column space") and used the syntax:
\tabular{lrllrllr}{
\code{nm1): \tab \code{n1} \tab \ics \tab \code{nm2}: \tab \code{n2}
\tab \ics \tab \code{nm3}: \tab \code{n3}\cr
\code{nm4}: \tab \code{n4} \tab \ics \tab \code{nm5}: \tab \code{n5}
....................
....................
}
I defined the macro "\ics" in ..../man/macros/defns.Rd via:
\newcommand{\icsl}{\out{\hspace*{1em}}}
\newcommand{\icsh}{\out{<a> </a>}}
\newcommand{\ics}{\ifelse{latex}{\icsl}{\ifelse{html}{\icsh}{ }}}
Took me forever (I being a Bear of Very Little Brain) to get a workable
syntax, but I finally managed it, and the end result looks fine in both
*.pdf and *.html. (the pdf seems to need just one em-space whereas the
html needs two.)
Thanks again Duncan.
cheers,
Rolf
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-package-devel
mailing list