bug#81648: 32.0.50; Running LaTeX on files with non-ASCII chars in the name

Arash Esbati <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Eli Zaretskii <[email protected]> writes:

>> From: Arash Esbati <[email protected]>
>> Cc: [email protected],  [email protected]
>> Date: Tue, 18 Aug 2026 15:19:01 +0200
>> 
>> I'm not familiar enough with the internals of tex-mode.el and what
>> happens after hitting "C-c C-c RET", but after having another look, I
>> think that the current invokation:
>> 
>>   pdflatex  \\nonstopmode\\input \ä.tex
>> 
>> should be:
>> 
>>   pdflatex  \\nonstopmode\\input \\detokenize{ä}.tex
>
> I know next to nothing about LaTeX, so can you please explain what
> does detokenize do and why do you think it is needed in this case?

I'm also not familiar with LaTeX's internals, so please take this with a
big grain of salt.

Currently, the invokation does:

  pdflatex \\nonstopmode\\input \ä.tex

I'm not sure how the UTF-8 support of LaTeX is implemented, but I think
it turns ä into an active char like ~ (for unbreakable space), i.e., you
use a TeX macro without a backslash.

Since the invocation above uses \input without braces, the TeX primitive
\input is used which doesn't grok the input.  \detokenize helps now
which is defined:

  \detokenize <general text>.

  The expansion is a list of character tokens representing the token
  list <balanced text>.  As with the lists of character tokens produced
  by TeX’s \the and e-TeX’s \readline, these tokens have category 12
  (‘other’), except that the character code 32 gets category 10
  (‘space’).

And with that, \input understands which file to open.  The difference in
a shell is:

  pdflatex \\nonstopmode\\input ä.tex

throws an error.

  pdflatex \\nonstopmode\\input \\detokenize{ä}.tex

works, and

  pdflatex \\nonstopmode\\input{ä}.tex

works as well.  \detokenize in action seems to be this:

produced with this code:

--8<---------------cut here---------------start------------->8---
\documentclass[12pt,a4paper]{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}

\def\ä{Foo}

\begin{document}
\noindent
\begin{tabular}{lcl}
  \verb|\detokenize{ä}| & $\mapsto$ & \texttt{\detokenize{ä}} \\
  \verb|\detokenize{a}| & $\mapsto$ & \texttt{\detokenize{a}} \\
  \verb|\detokenize{\foo}| & $\mapsto$ &  \texttt{\detokenize{\foo}} \\
  \verb|\ä| & $\mapsto$ & \ä             
\end{tabular}

\end{document}
--8<---------------cut here---------------end--------------->8---

IIRC we had to deal with something similar within AUCTeX and \detokenize
was the solution.

HTH.  Best, Arash
dekonize.png (image/png, 13.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.