[Rd] Potential cross-platform package building issue

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jan 4 01:19:18 CET 2015


On 03/01/2015 6:53 PM, Dirk Eddelbuettel wrote:
> 
> On 3 January 2015 at 13:49, Steven Ranney wrote:
> | I am using 32-bit R 3.1.2 on Windows 7.
> | 
> | I recently conducted an `R CMD check --as-cran` on a recently-developed
> | package and received only the 'New submission' note. Research on
> | StackOverflow and on R-devel suggested this could be ignored. I also used
> | devtools::build_win() and received no notes or warnings, other than the one
> | mentioned previously. Lastly, I conducted an `R CMD check` with the
> | development version of R.  Further, I built the package locally with `R CMD
> | build` and `R CMD INSTALL --build` and everything worked as it should,
> | including the PDF manual.
> | 
> | Upon submission to CRAN, I was told that a warning was thrown:
> | 
> | This fails to make its manual:
> | * checking PDF version of manual ... WARNING
> | LaTeX errors when creating PDF version.
> | This typically indicates Rd problems.
> | LaTeX errors found:
> | ! Missing $ inserted.
> | <inserted text>
> | $
> | l.682 }{}
> | ! Missing } inserted.
> | <inserted text>
> | }
> | l.682
> | }{}
> | ...
> | 
> | The line appears to be
> | \widehat{R_1} =
> | \frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}
> | 
> | I asked for assistance in resolving this issue as I could not replicate the
> | WARNING.  Another user could replicate the warning on Ubuntu 12.04 but was
> | able to resolve the issue by removing the DOS end-of-line markers (^M or
> | Ctrl-M) from the .Rd file.  Neither he nor I could find anything in the R
> | Extensions Manual that discussed removing end-of-line markers.
> | 
> | Link to the thread on StackOverflow.com:
> | http://stackoverflow.com/questions/27756679/cran-finds-an-warning-that-r-cmd-check-as-cran-does-not
> | 
> | Link to GitHub repository: http://www.github.com/stevenranney/creelSurvey
> | 
> | Is this an obscure cross platform issue?  If so, I would have thought that
> | someone else would have already discovered this.  If this is normal
> | behavior, is there a simple way to remove these end of line markers so I
> | can minimize WARNINGS from CRAN in the future?
> 
> Given that you pointed to a GH repo, I quickly fetched it as a zip archive.
> This looks like a vanilla tex coding issue to me:

But Steven didn't write any tex, R did.

I do think the problem is with the CR/LF line endings.  I think the
first error comes from this line in man/SimulateBusRoute.Rd:

\deqn{^M
\widehat{R_1} =
\frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}^M
}^M

(Those ^M's are really CR characters.)

This is translated by R to


\deqn{


\widehat{R_1} =
\frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}


}{}

and I think those extra blank lines are causing the problem.  The \deqn
macro is defined as

\newcommand{\deqn}[2]{\[#1\]}

and the \[ for display equations doesn't like the blank lines.

Generally R is good at reading text input in a variety of formats, but
in this context it doesn't.  (Since the input might be in some weird
encoding, it doesn't fix up the line endings.)  Steven should save his
files with Unix-style line endings, and R should have told him to do
this (or should have done it automatically when it built the tarball.)

Duncan Murdoch

> 
> * checking PDF version of manual ... WARNING
> LaTeX errors when creating PDF version.
> This typically indicates Rd problems.
> LaTeX errors found:
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.682 }{}
>          
> ! Missing } inserted.
> <inserted text> 
>                 }
> l.682 }{}
>          
> ! Display math should end with $$.
> <to be read again> 
>                    \@@par 
> l.682 }{}
>          
> ! Extra }, or forgotten \endgroup.
> \par ...m \@noitemerr {\@@par }\fi \else {\@@par }
>                                                   \fi 
> l.682 }{}
>          
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.682 }{}
>          
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.682 }{}
>          
> ! Missing } inserted.
> <inserted text> 
>                 }
> l.682 }{}
>          
> ! Extra }, or forgotten \endgroup.
> \par ...m \@noitemerr {\@@par }\fi \else {\@@par }
>                                                   \fi 
> l.682 }{}
>          
> ! LaTeX Error: Bad math environment delimiter.
> 
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...                                              
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.724 }{}
>          
> ! Missing } inserted.
> <inserted text> 
>                 }
> l.724 }{}
>          
> ! Display math should end with $$.
> <to be read again> 
>                    \@@par 
> l.724 }{}
>          
> ! Extra }, or forgotten \endgroup.
> \par ...m \@noitemerr {\@@par }\fi \else {\@@par }
>                                                   \fi 
> l.724 }{}
>          
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.724 }{}
>          
> ! Missing $ inserted.
> <inserted text> 
>                 $
> l.724 }{}
>          
> ! Missing } inserted.
> <inserted text> 
>                 }
> l.724 }{}
>          
> ! Extra }, or forgotten \endgroup.
> \par ...m \@noitemerr {\@@par }\fi \else {\@@par }
>                                                   \fi 
> l.724 }{}
>          
> ! LaTeX Error: Bad math environment delimiter.
> 
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...                                              
> * checking PDF version of manual without hyperrefs or index ... ERROR
> edd at max:/tmp/creel$ 
> 
> Dirk
>



More information about the R-devel mailing list