[R-pkg-devel] Literal LaTeX Text in Function Arguments

biii m@iii@g oii de@@ey@ws biii m@iii@g oii de@@ey@ws
Fri Aug 23 05:15:08 CEST 2019


Hello,

 

Does anyone know how to include verbatim \ldots (and maybe other LaTeX) in
an .Rd file correctly? 

 

When LaTeX is in the default arguments for a function, the code is
interpreted which makes the documentation not match the default formal
arguments.

 

An example is:

https://github.com/billdenney/TopicLongTableR/blob/1338116767d90e8211533cb6e
7db5ef30368dc33/R/topic_long_table_header_footer.R#L20

 

Which yields:

https://github.com/billdenney/TopicLongTableR/blob/1338116767d90e8211533cb6e
7db5ef30368dc33/man/topic_long_table_header.Rd#L10

 

Which gives the following warning with `devtools::check()`:

```

checking for code/documentation mismatches ... WARNING

Codoc mismatches from documentation object 'topic_long_table_header':

topic_long_table_header

  Code: function(x, col_names = NULL, above_col_names = "\\hline
<file://hline> ",

                 below_col_names = "\\hline <file://hline> ",

                 subsequent_page_notification = "\\ldots continued
<file://ldots%20continued> ",

                 latex_header = NULL)

  Docs: function(x, col_names = NULL, above_col_names = "\\hline
<file://hline> ",

                 below_col_names = "\\hline <file://hline> ",

                 subsequent_page_notification = "\... continued",

                 latex_header = NULL)

```

 

I'm not sure, but I think that the solution is to add more protection to the
\s when generating the roxygen or perhaps wrapping the arguments in some
form of verbatim block (if it's available).

 

Thanks,

 

Bill

 

P.S. This is also discussed in https://github.com/r-lib/roxygen2/issues/837
where it appears to be related to the conversion of .Rd to help files not
the roxygen step.

 


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list