# \'. gives error when fontspec package is used

The following minimal example:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
The logo \TeX\'.
\end{document}


produces the error:

./test.tex:5: Argument of \end has an extra }.
<inserted text>
\par
l.5 \end
{document}
?


What's wrong here?

Just to avoid why would you want to put an acute accent over a peroid kind of argument, I need to say that for a TeX course that I am teaching, I use The TeXBook and this particular example comes from the TeXBook in chapter 3.

• Hi and welcome. \' is not a valid control sequence there. – Johannes_B Oct 4 '14 at 6:54
• @Johannes_B Why? – ChrisS Oct 4 '14 at 6:57
• @ChrisS Because there is a difference between (plain)TeX and LaTeX. Try \TeX\'. \vfill\eject\bye and compile it using pdftex (not pdflatex). – Johannes_B Oct 4 '14 at 7:00
• @Johannes_B: I do not think so, remove fontspec and run pdflatex and see the result yourself. – vafa Oct 4 '14 at 7:04
• Ok, works with pdflatex as well; my mistake. Then i think fontspec has some kind of failsafe, as it won't put together characters but uses the unicode ones provided by the font. – Johannes_B Oct 4 '14 at 7:04

The command \' becomes \EU1-cmd\' \EU1\' and then \EU1-cmd checks if the combination

\\EU1\'-.


is defined; the control sequence has \EU1\'-. as name and can be checked by

\expandafter\show\csname\string\EU1\string\'-.\endcsname


which gives

> \\EU1\'-.=macro:
->\TIPAaccent {\textdotacute }.


Now the problem follows, because \TIPAaccent wants two arguments, and it finds \end which is surely not a good token for it.

Here's an example:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Gentium}
\begin{document}
\'.e
\end{document}


Gentium is needed because Latin Modern doesn't have the required glyph.

In conclusion, \TeX\'. shows a bad usage of the backslash after \TeX.

If you need \'. for demonstration purposes, you can undeclare the composite using the command I suggested in https://tex.stackexchange.com/a/58115/4427

\documentclass{article}
\usepackage{fontspec}
\setmainfont{CMU Serif}

\providecommand*\UndeclareTextComposite[3]{%
\expandafter\let\csname\expandafter\string\csname
#2\endcsname\string#1-#3\endcsname\relax}

\UndeclareTextComposite{\'}{EU1}{.}

\begin{document}
\TeX\'.
\end{document}


The placement of the accent isn't the same as with cmr10; this depends on the fonts.

• I know you would come along. Thanks for clarifying that. – Johannes_B Oct 4 '14 at 7:09
• Yes, it does but it also shows a fontspec bug. – vafa Oct 4 '14 at 7:53
• @VafaKhalighi Why should it be a bug? The fact that it loads TIPA macros is documented and the construction \'.{<char>} is in the manual of TIPA. Surprising feature, maybe. – egreg Oct 4 '14 at 7:54
• @egreg: Because it is not consistent with what the TeXBook in chapter 3 describes. Knuth says there that \' puts an acute accent over the next nonblank character. – vafa Oct 4 '14 at 8:00
• @VafaKhalighi The TeXbook doesn't talk about LaTeX. Would you say that different behavior of \line in LaTeX from what is described in the TeXbook is a LaTeX bug? – egreg Oct 4 '14 at 8:00