[R-pkg-devel] .Rd, LaTeX and Unicode
Hi, I am preparing a package where I would like to use UTF characters in .Rd files. When the LaTeX comes to play, I got well known errors e.g.: ! Package inputenc Error: Unicode character ∂ (U+2202) (inputenc) not set up for use with LaTeX. It is coherent with what is said on this page https://developer.r-project.org/Encodings_and_R.html : "Since LaTeX cannot handle Unicode we would have to convert the encoding of latex help files or use Lambda (and tell it they were in UTF-8)." But LaTeX can support UTF8 as shown with this small example: \documentclass{article} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc} \begin{document} The vorticity ω is defined as $ω = ∇ × u$. \end{document} I can compile it with my LaTeX without problem. May be you too? So my suggestion would be to place these two lines somewhere in LaTeX header generated by R doc system: \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc} Note "utf8x" and not just "utf8" which is crucial for this example. With a hope that it would fix unicode errors from LaTeX. Best, Serguei. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] .Rd, LaTeX and Unicode
utf8x is deprecated https://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc#13070 On Tue, 18 Jun 2019 at 7:52 pm, Serguei Sokol wrote: > Hi, > > I am preparing a package where I would like to use UTF characters in .Rd > files. When the LaTeX comes to play, I got well known errors e.g.: > ! Package inputenc Error: Unicode character ∂ (U+2202) > (inputenc)not set up for use with LaTeX. > > It is coherent with what is said on this page > https://developer.r-project.org/Encodings_and_R.html : > "Since LaTeX cannot handle Unicode we would have to convert the encoding > of latex help files or use Lambda (and tell it they were in UTF-8)." > > But LaTeX can support UTF8 as shown with this small example: > > \documentclass{article} > \usepackage[mathletters]{ucs} > \usepackage[utf8x]{inputenc} > > \begin{document} > The vorticity ω is defined as $ω = ∇ × u$. > \end{document} > > I can compile it with my LaTeX without problem. May be you too? > So my suggestion would be to place these two lines somewhere in LaTeX > header generated by R doc system: > \usepackage[mathletters]{ucs} > \usepackage[utf8x]{inputenc} > > Note "utf8x" and not just "utf8" which is crucial for this example. > With a hope that it would fix unicode errors from LaTeX. > > Best, > Serguei. > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] .Rd, LaTeX and Unicode
> Hugh Parsonage > on Tue, 18 Jun 2019 20:03:41 +1000 writes: > utf8x is deprecated > https://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc#13070 Hmm... interestingly, I've tried quite a few versions of the above which started in 2011, but had been updated in April 2016 : https://tex.stackexchange.com/a/203804/7228 from where it seems that \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} should be sufficient. Further, note that from https://tex.stackexchange.com/a/238135/7228 the {ucs} package should no longer be needed since ca. 2013, hence your \usepackage[mathletters]{ucs} would not be needed either. HOWEVER: After losing at least half an hour now, trying many variants I found that the only version that works correctly for me (with a teTeX / TeXlive version of 2018) is the version Serguei Sokol proposes (below), including the use of the 'utf8x' option *and* the 'ucs' package ... which is pretty surprising after having read the tex.statexchange threads ... > On Tue, 18 Jun 2019 at 7:52 pm, Serguei Sokol > wrote: >> Hi, >> >> I am preparing a package where I would like to use UTF characters in .Rd >> files. When the LaTeX comes to play, I got well known errors e.g.: >> ! Package inputenc Error: Unicode character ∂ (U+2202) >> (inputenc)not set up for use with LaTeX. >> >> It is coherent with what is said on this page >> https://developer.r-project.org/Encodings_and_R.html : >> "Since LaTeX cannot handle Unicode we would have to convert the encoding >> of latex help files or use Lambda (and tell it they were in UTF-8)." That whole document has been very important and crucial, written by Prof Brian Ripley who had worked a *LOT* to bring unicode to R, -- but it has been written 2004-2005 and indeed, I think it is probably fair to say that the above sentence no longer applies to current LaTeX engines (including "simple" pdflatex)... though really, I'm not the expert here, but I think it's a good point in time to reconsider how much UTF8 should be allowed/supported in *.Rd files. One problem: This is (slightly) the wrong mailing list; this would have been a perfect topic for 'R-devel' (discussing about new features etc for R) instead ( but we'd rather keep it here for now.) Martin Maechler ETH Zurich and R Core Team >> But LaTeX can support UTF8 as shown with this small example: \documentclass{article} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc} \begin{document} The vorticity ω is defined as $ω = ∇ × u$. \end{document} >> I can compile it with my LaTeX without problem. May be you too? >> So my suggestion would be to place these two lines somewhere in LaTeX >> header generated by R doc system: >> \usepackage[mathletters]{ucs} >> \usepackage[utf8x]{inputenc} >> >> Note "utf8x" and not just "utf8" which is crucial for this example. >> With a hope that it would fix unicode errors from LaTeX. >> >> Best, >> Serguei. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[R-pkg-devel] R package manual failing only on R-devel-linux-x86_64-debian-gcc
Hello, I'm having a really strange problem that I cannot reproduce locally (Ubuntu bionic) or on Rhub. I've run into an issue where the R package manual is failing only on this platform with ancient LaTeX runes that I struggle to decipher [0] > * checking PDF version of manual ... WARNING > LaTeX errors when creating PDF version. > This typically indicates Rd problems. > LaTeX errors found: > ! pdfTeX error (ext4): \pdfendlink ended up in different nesting level than > \pd > fstartlink. > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox > \fi \fi > l.186 \item \code > ! ==> Fatal error occurred, no output PDF file produced! > * checking PDF version of manual without hyperrefs or index ... OK > * checking for non-standard things in the check directory ... NOTE > Found the following files/directories: > ‘poppr-manual.tex’ > > The only information I could find on the error was a question with answers that were more questions: https://stackoverflow.com/q/2765229/2752888 Uwe Ligges was kind enough to trigger a second build to see if this was an anomaly, but the same incantation appeared again. I've tried building this on Rhub debian-devel-gcc, but could not reproduce the error [1] and no other platform does this. Has anyone seen this before? Thanks, Zhian [0]: https://win-builder.r-project.org/incoming_pretest/poppr_2.8.3_20190618_151346/Debian/00check.log [1]: https://builder.r-hub.io/status/original/poppr_2.8.3.tar.gz-130d92cdeb2c4c46b94d8cc13b8921b9 [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] R package manual failing only on R-devel-linux-x86_64-debian-gcc
You can build the PDF manual locally with R CMD Rd2pdf --no-clean . and then look at line 186 in the poppr-manual.tex file to see where there error is coming from. You can also try R-hub's windows builder, to see if you can reproduce it there. Gabor On Tue, Jun 18, 2019 at 3:37 PM Zhian Kamvar wrote: > > Hello, > > I'm having a really strange problem that I cannot reproduce locally (Ubuntu > bionic) or on Rhub. I've run into an issue where the R package manual is > failing only on this platform with ancient LaTeX runes that I struggle to > decipher [0] > > > * checking PDF version of manual ... WARNING > > LaTeX errors when creating PDF version. > > This typically indicates Rd problems. > > LaTeX errors found: > > ! pdfTeX error (ext4): \pdfendlink ended up in different nesting level than > > \pd > > fstartlink. > > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox > > \fi \fi > > l.186 \item \code > > ! ==> Fatal error occurred, no output PDF file produced! > > * checking PDF version of manual without hyperrefs or index ... OK > > * checking for non-standard things in the check directory ... NOTE > > Found the following files/directories: > > ‘poppr-manual.tex’ > > > > > The only information I could find on the error was a question with answers > that were more questions: https://stackoverflow.com/q/2765229/2752888 > > Uwe Ligges was kind enough to trigger a second build to see if this was an > anomaly, but the same incantation appeared again. I've tried building this > on Rhub debian-devel-gcc, but could not reproduce the error [1] and no > other platform does this. > > Has anyone seen this before? > > Thanks, > Zhian > > [0]: > https://win-builder.r-project.org/incoming_pretest/poppr_2.8.3_20190618_151346/Debian/00check.log > [1]: > https://builder.r-hub.io/status/original/poppr_2.8.3.tar.gz-130d92cdeb2c4c46b94d8cc13b8921b9 > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] R package manual failing only on R-devel-linux-x86_64-debian-gcc
Unfortunately this error is caused by a hyperlink straddling a page, so it’s difficult to solve uniformly. The LaTeX error message provides a clue as to where the hyperlink might be (near an \item near a \code) but no exact location. My advice would be to look where you have hyperlinks (including cross references) in your documentation and either reword the documentation or omit hyperlinks until you can produce a full pdf manual. Then, examine where the hyperlink might have straddled two pages and more surgically reword that paragraph/list to enable the original intent to be typeset. The hyperlink may also occur in a bibliography where you may have to make more drastic omissions or additions in order for compilation to succeed. On Wed, 19 Jun 2019 at 12:37 am, Zhian Kamvar wrote: > Hello, > > I'm having a really strange problem that I cannot reproduce locally (Ubuntu > bionic) or on Rhub. I've run into an issue where the R package manual is > failing only on this platform with ancient LaTeX runes that I struggle to > decipher [0] > > > * checking PDF version of manual ... WARNING > > LaTeX errors when creating PDF version. > > This typically indicates Rd problems. > > LaTeX errors found: > > ! pdfTeX error (ext4): \pdfendlink ended up in different nesting level > than \pd > > fstartlink. > > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox > > \fi \fi > > l.186 \item \code > > ! ==> Fatal error occurred, no output PDF file produced! > > * checking PDF version of manual without hyperrefs or index ... OK > > * checking for non-standard things in the check directory ... NOTE > > Found the following files/directories: > > ‘poppr-manual.tex’ > > > > > The only information I could find on the error was a question with answers > that were more questions: https://stackoverflow.com/q/2765229/2752888 > > Uwe Ligges was kind enough to trigger a second build to see if this was an > anomaly, but the same incantation appeared again. I've tried building this > on Rhub debian-devel-gcc, but could not reproduce the error [1] and no > other platform does this. > > Has anyone seen this before? > > Thanks, > Zhian > > [0]: > > https://win-builder.r-project.org/incoming_pretest/poppr_2.8.3_20190618_151346/Debian/00check.log > [1]: > > https://builder.r-hub.io/status/original/poppr_2.8.3.tar.gz-130d92cdeb2c4c46b94d8cc13b8921b9 > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] .Rd, LaTeX and Unicode
Since April 2018 'utf8' is the default input encoding in LaTeX, see http://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/doc/ltnews.pdf and they added some symbols in December. Georgi Boshnakov -Original Message- From: R-package-devel [mailto:r-package-devel-boun...@r-project.org] On Behalf Of Martin Maechler Sent: 18 June 2019 15:01 To: serguei.so...@gmail.com; Hugh Parsonage Cc: r-package-devel@r-project.org Subject: Re: [R-pkg-devel] .Rd, LaTeX and Unicode > Hugh Parsonage > on Tue, 18 Jun 2019 20:03:41 +1000 writes: > utf8x is deprecated > https://tex.stackexchange.com/questions/13067/utf8x-vs-utf8-inputenc#13070 Hmm... interestingly, I've tried quite a few versions of the above which started in 2011, but had been updated in April 2016 : https://tex.stackexchange.com/a/203804/7228 from where it seems that \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} should be sufficient. Further, note that from https://tex.stackexchange.com/a/238135/7228 the {ucs} package should no longer be needed since ca. 2013, hence your \usepackage[mathletters]{ucs} would not be needed either. HOWEVER: After losing at least half an hour now, trying many variants I found that the only version that works correctly for me (with a teTeX / TeXlive version of 2018) is the version Serguei Sokol proposes (below), including the use of the 'utf8x' option *and* the 'ucs' package ... which is pretty surprising after having read the tex.statexchange threads ... > On Tue, 18 Jun 2019 at 7:52 pm, Serguei Sokol > wrote: >> Hi, >> >> I am preparing a package where I would like to use UTF characters in .Rd >> files. When the LaTeX comes to play, I got well known errors e.g.: >> ! Package inputenc Error: Unicode character ∂ (U+2202) >> (inputenc)not set up for use with LaTeX. >> >> It is coherent with what is said on this page >> https://developer.r-project.org/Encodings_and_R.html : >> "Since LaTeX cannot handle Unicode we would have to convert the encoding >> of latex help files or use Lambda (and tell it they were in UTF-8)." That whole document has been very important and crucial, written by Prof Brian Ripley who had worked a *LOT* to bring unicode to R, -- but it has been written 2004-2005 and indeed, I think it is probably fair to say that the above sentence no longer applies to current LaTeX engines (including "simple" pdflatex)... though really, I'm not the expert here, but I think it's a good point in time to reconsider how much UTF8 should be allowed/supported in *.Rd files. One problem: This is (slightly) the wrong mailing list; this would have been a perfect topic for 'R-devel' (discussing about new features etc for R) instead ( but we'd rather keep it here for now.) Martin Maechler ETH Zurich and R Core Team >> But LaTeX can support UTF8 as shown with this small example: \documentclass{article} \usepackage[mathletters]{ucs} \usepackage[utf8x]{inputenc} \begin{document} The vorticity ω is defined as $ω = ∇ × u$. \end{document} >> I can compile it with my LaTeX without problem. May be you too? >> So my suggestion would be to place these two lines somewhere in LaTeX >> header generated by R doc system: >> \usepackage[mathletters]{ucs} >> \usepackage[utf8x]{inputenc} >> >> Note "utf8x" and not just "utf8" which is crucial for this example. >> With a hope that it would fix unicode errors from LaTeX. >> >> Best, >> Serguei. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] R package manual failing only on R-devel-linux-x86_64-debian-gcc
Thank you for the the insights, Gabor and Hugh! Line 186 happens to be a \begin{itemize} in the package documentation section (which is chock-full of links), I didn't change that, but I did expand the DESCRIPTION, so I guess it makes sense that one of those links have slid down and gotten stuck between the pages. Now if only I had a reliable way of reproducing the error -_- Thank you both for the quick responses! Zhian On Tue, Jun 18, 2019 at 4:00 PM Hugh Parsonage wrote: > Unfortunately this error is caused by a hyperlink straddling a page, so > it’s difficult to solve uniformly. > > The LaTeX error message provides a clue as to where the hyperlink might be > (near an \item near a \code) but no exact location. > > My advice would be to look where you have hyperlinks (including cross > references) in your documentation and either reword the documentation or > omit hyperlinks until you can produce a full pdf manual. Then, examine > where the hyperlink might have straddled two pages and more surgically > reword that paragraph/list to enable the original intent to be typeset. > > The hyperlink may also occur in a bibliography where you may have to make > more drastic omissions or additions in order for compilation to succeed. > > On Wed, 19 Jun 2019 at 12:37 am, Zhian Kamvar wrote: > >> Hello, >> >> I'm having a really strange problem that I cannot reproduce locally >> (Ubuntu >> bionic) or on Rhub. I've run into an issue where the R package manual is >> failing only on this platform with ancient LaTeX runes that I struggle to >> decipher [0] >> >> > * checking PDF version of manual ... WARNING >> > LaTeX errors when creating PDF version. >> > This typically indicates Rd problems. >> > LaTeX errors found: >> > ! pdfTeX error (ext4): \pdfendlink ended up in different nesting level >> than \pd >> > fstartlink. >> > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox >> > \fi \fi >> > l.186 \item \code >> > ! ==> Fatal error occurred, no output PDF file produced! >> > * checking PDF version of manual without hyperrefs or index ... OK >> > * checking for non-standard things in the check directory ... NOTE >> > Found the following files/directories: >> > ‘poppr-manual.tex’ >> > >> > >> The only information I could find on the error was a question with answers >> that were more questions: https://stackoverflow.com/q/2765229/2752888 >> >> Uwe Ligges was kind enough to trigger a second build to see if this was an >> anomaly, but the same incantation appeared again. I've tried building this >> on Rhub debian-devel-gcc, but could not reproduce the error [1] and no >> other platform does this. >> >> Has anyone seen this before? >> >> Thanks, >> Zhian >> >> [0]: >> >> https://win-builder.r-project.org/incoming_pretest/poppr_2.8.3_20190618_151346/Debian/00check.log >> [1]: >> >> https://builder.r-hub.io/status/original/poppr_2.8.3.tar.gz-130d92cdeb2c4c46b94d8cc13b8921b9 >> >> [[alternative HTML version deleted]] >> >> __ >> R-package-devel@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-package-devel >> > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] R package manual failing only on R-devel-linux-x86_64-debian-gcc
For the curious, an update from Uwe Ligges: Kurt Hornik found: > > < > https://tex.stackexchange.com/questions/1522/pdfendlink-ended-up-in-different-nesting-level-than-pdfstartlink > > > > and you shoudl be able to reproduce via > >R_PAPERSIZE=a4 R CMD Rd2pdf /path/to/poppr > > Suggestion: > > Add a blank line before > >Examples of analyses are available in a primer written by Niklaus > J. Grünwald, Zhian N. Kamvar, and Sydney E. Everhart at > \url{http://grunwaldlab.github.io/Population_Genetics_in_R}.} > Zhian On Tue, Jun 18, 2019 at 4:22 PM Zhian Kamvar wrote: > Thank you for the the insights, Gabor and Hugh! Line 186 happens to be a > \begin{itemize} in the package documentation section (which is chock-full > of links), I didn't change that, but I did expand the DESCRIPTION, so I > guess it makes sense that one of those links have slid down and gotten > stuck between the pages. > > Now if only I had a reliable way of reproducing the error -_- > > Thank you both for the quick responses! > Zhian > > On Tue, Jun 18, 2019 at 4:00 PM Hugh Parsonage > wrote: > >> Unfortunately this error is caused by a hyperlink straddling a page, so >> it’s difficult to solve uniformly. >> >> The LaTeX error message provides a clue as to where the hyperlink might >> be (near an \item near a \code) but no exact location. >> >> My advice would be to look where you have hyperlinks (including cross >> references) in your documentation and either reword the documentation or >> omit hyperlinks until you can produce a full pdf manual. Then, examine >> where the hyperlink might have straddled two pages and more surgically >> reword that paragraph/list to enable the original intent to be typeset. >> >> The hyperlink may also occur in a bibliography where you may have to make >> more drastic omissions or additions in order for compilation to succeed. >> >> On Wed, 19 Jun 2019 at 12:37 am, Zhian Kamvar wrote: >> >>> Hello, >>> >>> I'm having a really strange problem that I cannot reproduce locally >>> (Ubuntu >>> bionic) or on Rhub. I've run into an issue where the R package manual is >>> failing only on this platform with ancient LaTeX runes that I struggle to >>> decipher [0] >>> >>> > * checking PDF version of manual ... WARNING >>> > LaTeX errors when creating PDF version. >>> > This typically indicates Rd problems. >>> > LaTeX errors found: >>> > ! pdfTeX error (ext4): \pdfendlink ended up in different nesting level >>> than \pd >>> > fstartlink. >>> > \AtBegShi@Output ...ipout \box \AtBeginShipoutBox >>> > \fi \fi >>> > l.186 \item \code >>> > ! ==> Fatal error occurred, no output PDF file produced! >>> > * checking PDF version of manual without hyperrefs or index ... OK >>> > * checking for non-standard things in the check directory ... NOTE >>> > Found the following files/directories: >>> > ‘poppr-manual.tex’ >>> > >>> > >>> The only information I could find on the error was a question with >>> answers >>> that were more questions: https://stackoverflow.com/q/2765229/2752888 >>> >>> Uwe Ligges was kind enough to trigger a second build to see if this was >>> an >>> anomaly, but the same incantation appeared again. I've tried building >>> this >>> on Rhub debian-devel-gcc, but could not reproduce the error [1] and no >>> other platform does this. >>> >>> Has anyone seen this before? >>> >>> Thanks, >>> Zhian >>> >>> [0]: >>> >>> https://win-builder.r-project.org/incoming_pretest/poppr_2.8.3_20190618_151346/Debian/00check.log >>> [1]: >>> >>> https://builder.r-hub.io/status/original/poppr_2.8.3.tar.gz-130d92cdeb2c4c46b94d8cc13b8921b9 >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> R-package-devel@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-package-devel >>> >> [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel