2

I failed to use "\include" with a file that contain the string "é" in its name like "réserve". so I tried the following without success

\include{\detokenize{réserve}}

After some trials I have noted that the command

\detokenize{é}

produces "Ãľ" in place of "é".

Hence the question "How to obtain the string "é" by using the \detokenize command".

Here is a minimal example

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
  \detokenize{é}
 \end{document}
  • It's much safer not to use special characters in file names. – egreg Aug 5 '16 at 9:56
4

You are better using file names without special characters. If you like to live dangerously, you can patch some kernel macros:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\include}
 {\@include#1}
 {\expandafter\@include\detokenize{#1}}
 {}{}
\patchcmd{\@include}
 {\string\@input{#1.aux}}
 {\string\@input{\string\detokenize{\detokenize{#1}}.aux}}
 {}{}
\makeatother

\begin{document}

\include{réservé}

\end{document}
|improve this answer|||||
0

For the further visitors who, like me, comes from google:// detokenize unicode.

\detokenize is not UTF8-friendly, but sometimes you can replace it with the following command:

\newcommand{\utffriendlydetokenize}[1]{%
\scantokens{%
\catcode`\_=12%
\catcode`\^=12%
\catcode`\{=12%
\catcode`\}=12%
\catcode`\&=12%
\catcode`\$=12%
\catcode`\#=12%
\catcode`\~=12%
\catcode`\\=12%
#1%
}%
}

(source: https://gitlab.com/Nickkolok/biblatex2bibitem/-/blob/master/biblatex2bibitem.sty)

However, it does not work with \include.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.