Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdflatex compiles, but log file "is not encoded in UTF-8" #425

Closed
3 tasks done
martinmodrak opened this issue Oct 12, 2023 · 3 comments
Closed
3 tasks done

pdflatex compiles, but log file "is not encoded in UTF-8" #425

martinmodrak opened this issue Oct 12, 2023 · 3 comments
Assignees

Comments

@martinmodrak
Copy link

martinmodrak commented Oct 12, 2023

On Windows 10, even with latext tinytex + xfun I sometimes get a warning, that the log file could not be read (even though the PDF is created) This leads to minor annoyance in workflow as this seems to disrupt some downstream processes after latex. e.g. knitr will no longer open the built PDF.

The warning looks like:

Warning message: In xfun::read_utf8(log) :   
  The file my_tex_file.log is not encoded in UTF-8. These lines contain invalid UTF-8 characters: 321

I am not sure whether this is primarily an xfun issue (i.e. xfun should be able to handle the file) or an issue with tinytex (i.e. tinytex should be able to force the log file to be valid UTF-8).

Reproducible example:

tex_source <- r"(
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\usepackage{lmodern}
\usepackage[left=4cm,right=4cm,top=2cm,bottom=2cm]{geometry}
\usepackage{longtable,booktabs,array}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

\title{Test}
\author{}

\begin{document}
\maketitle
\begin{itemize}
\tightlist
\item
\begin{itemize}
\tightlist
\item
soukromé financování také obvykle není dostupné ve všech oborech
rovnoměrně (např. soukromé finance je snažší získat na výzkum dětské
            leukemie než na léčbu rezistentní tuberkulózy) a soustředí se na
prestižní týmy/vědce/univerzity
\end{itemize}
\end{itemize}
\end{document}
)"

tmp <- tempfile(fileext = ".tex")
writeLines(tex_source, tmp)
tinytex::pdflatex(tmp, clean = FALSE)

Output of xfun::session_info('tinytex'):

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045), RStudio 2023.9.0.463

Locale: LC_COLLATE=Czech_Czechia.utf8  LC_CTYPE=Czech_Czechia.utf8    LC_MONETARY=Czech_Czechia.utf8 LC_NUMERIC=C                   LC_TIME=Czech_Czechia.utf8    

Package version:
  graphics_4.2.1  grDevices_4.2.1 stats_4.2.1     tinytex_0.47.2  tools_4.2.1     utils_4.2.1     xfun_0.40.1    

LaTeX version used: 
  TeX Live 2022 (TinyTeX) with tlmgr 2022-04-18

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('tinytex'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/tinytex').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

@yihui
Copy link
Member

yihui commented Oct 12, 2023

Should be fixed now. Thanks for the report!

You can install the development version via

remotes::install_github('rstudio/tinytex')

@martinmodrak
Copy link
Author

Confirmed fix. Thanks very much, that was lightning speed.

@yihui
Copy link
Member

yihui commented Oct 13, 2023

Lightning speed thanks to the high-quality reproducible example! :)

New version (0.48) is on CRAN now: https://cran.r-project.org/package=tinytex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants