SCM

Forum: support

Monitor Forum | Start New Thread Start New Thread
RE: Latex warnings using exams2pdf [ Reply ]
By: Achim Zeileis on 2023-09-18 11:46
[forum:49768]
Ah, sorry, then my idea doesn't help...

I'll wait for a bit more and when there is no follow-up I'll try posting a GitHub issue for the tinytex R package.

RE: Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-18 11:40
[forum:49767]
Hi Achim,
Many thanks.
I am afraid that I installed TinyTeX LaTeX distribution via tinytex::install_tinytex, since in the first attempt to compile a pdf exam I got an error. In fact,

> tinytex::is_tinytex()
[1] TRUE

and

tinytex::tinytex_root()
[1] "C:\\Users\\Francisco Goerlich\\AppData\\Roaming\\TinyTeX"

I am under case 3 of https://www.R-exams.org/tutorials/latex/.
I also think this is weird, since I not always get the warnings I mentioned before.

Many thanks in any case.

RE: Latex warnings using exams2pdf [ Reply ]
By: Achim Zeileis on 2023-09-18 07:36
[forum:49766]
Francisco, I think you are using your system LaTeX installation, right?

(I mean: You have only installed the "tinytex" R package but not the TinyTeX LaTeX distribution via tinytex::install_tinytex.)

In that case you could try setting:

options(exams_tex = "tools")

If after that, you don't get the warnings anymore, you could also simply de-install the "tinytex" R package.

More details: https://www.R-exams.org/tutorials/latex/

RE: Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-14 09:29
[forum:49764]
Hi,
In cheking all my exercises I found similar warnings that are not solved by the previous solution (\usepackage[nofontenc]{Sweave} instead of \usepackage{Sweave})

Warning messages:
1: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
unable to translate ' also. Si tenemos \emph{n} clases la \textbf{matriz de confusi<c3>...]) (./exercise06.tex' to a wide string
2: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
input string 397 is invalid
3: In grep("^\\s*$", x) :
unable to translate ' also. Si tenemos \emph{n} clases la \textbf{matriz de confusi<c3>...]) (./exercise06.tex' to a wide string
4: In grep("^\\s*$", x) : input string 397 is invalid
5: In xfun::read_utf8(log) :
The file mytemplate1.log is not encoded in UTF-8. These lines contain invalid UTF-8 characters: 397
6: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
unable to translate ' also. Si tenemos \emph{n} clases la \textbf{matriz de confusi<c3>...]) (./exercise06.tex' to a wide string
7: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
input string 397 is invalid

Probably there is a similar workaround, but I couldn't figure it out.

Thanks a lot

RE: Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-14 08:14
[forum:49763]

Latex_2.zip (2) downloads
Hi Achim,

Hyphenation works with both templates, plain.tex and myplain.tex

I attach an example, and the pdf produced.
Note that myplain.tex produces a pdf with much higher resolution, so it has a bigger size but can be seen better on the screen.

Also with this example, that also contains accented words ("excepción") I get no warnings with plain.tex (netither with myplain.tex, off course).

This is a mistery for my!

Thanks for the repex on SO.


RE: Latex warnings using exams2pdf [ Reply ]
By: Achim Zeileis on 2023-09-14 07:38
[forum:49762]
I have posted a minimal self-contained example on StackOverflow now:

https://stackoverflow.com/questions/77102701/tinytex-warnings-due-to-t1-fontenc-and-latin1-log-file

RE: Latex warnings using exams2pdf [ Reply ]
By: Achim Zeileis on 2023-09-13 19:01
[forum:49761]
Thanks for checking Francisco!

I don't understand why this is needed either. I still think this is weird.

Meanwhile I tried to look up what the potential downsides are from using the T1 font encoding, see:

https://tex.stackexchange.com/questions/664/why-should-i-use-usepackaget1fontenc

However, I couldn't find any problems with the PDFs I tried. Copy & paste of accented characters from the PDF worked correctly.

Maybe you could check whether hyphenation still works?

RE: Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-13 14:39
[forum:49760]
I have generated 52 test with 10 questions each and I got any warning after modifying my templates the same as you did: exchanging \usepackage{Sweave} with \usepackage[nofontenc]{Sweave}.

Congratulations, even I don´t understand why this works.

Many thanks,

RE: Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-13 14:27
[forum:49759]
Yes, exams2pdf(file, template = "myplain") works without any warning!
I don´t know why but it seems to work.

I´m going to try with the full test and let you know.

Thanks a lot Achim.

RE: Latex warnings using exams2pdf [ Reply ]
By: Achim Zeileis on 2023-09-12 23:14
[forum:49757]

myplain.tex (4) downloads
I haven't seen any cases where these errors are critical.

I also still don't really understand why they are happening. It's still the overfull hbox with non-UTF-8 characters. Possibly tinytex changed the way how the .log is processed, increasing the number of warnings.

Playing around a bit, I think that possibly the warnings can be avoided when omitting the T1 font encoding. So I made a copy of "plain.tex" to "myplain.tex" and exchanged the simply \usepackage{Sweave} with \usepackage[nofontenc]{Sweave}. See attached.

Could you try whether exams2pdf(..., template = "myplain.tex") works for you?

Latex warnings using exams2pdf [ Reply ]
By: Francisco Goerlich on 2023-09-12 21:07
[forum:49756]

Latex.zip (5) downloads
Hi,

Generaring pdf exams with exams2pdf() and tinytex installed I get a lot of warnings of the following type:

Warning messages:
1: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
unable to translate '\T1/phv/m/n/10 toma dos val-ores ar-bi-trar-ios y en con-se-cuen-cia es una \T1/phv/b/n/10 vari-able cual-i-ta-tiva di-cot<f3>mica\T1/phv/m/n/10 . ' to a wide string
2: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
input string 245 is invalid
3: In xfun::read_utf8(log) :
The file solution1.log is not encoded in UTF-8. These lines contain invalid UTF-8 characters: 244
4: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
unable to translate '\T1/phv/m/n/10 toma dos val-ores ar-bi-trar-ios y en con-se-cuen-cia es una \T1/phv/b/n/10 vari-able cual-i-ta-tiva di-cot<f3>mica\T1/phv/m/n/10 . ' to a wide string
5: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
input string 244 is invalid

In addition to the known warning about "The file solution1.log is not encoded in UTF-8" (see https://r-forge.r-project.org/forum/message.php?msg_id=49126) the other ones are new this year.

However the problems seem to be well generated. See an example attached.
I wonder if this is something to worry about or I can savely ignored the messages.

Thanks a lot.

Thanks to:
Vienna University of Economics and Business Powered By FusionForge