6

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.

vafa
  • 63
  • Hi and welcome. \' is not a valid control sequence there. – Johannes_B Oct 04 '14 at 06:54
  • @Johannes_B Why? – ChrisS Oct 04 '14 at 06:57
  • 1
    @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 04 '14 at 07:00
  • @Johannes_B: I do not think so, remove fontspec and run pdflatex and see the result yourself. – vafa Oct 04 '14 at 07: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 04 '14 at 07:04
  • @VafaKhalighi Could you try to come up with a more descriptive title for this question? Something that gives other users a better idea of what this question is about without having to read it. Also, I’m not sure if your name is very common or if you’ve created a bunch of duplicate accounts (see this search), but if the latter is the case, you can request having your accounts merged. – doncherry Oct 04 '14 at 10:37

1 Answers1

6

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.

enter image description here

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.

enter image description here

egreg
  • 1,121,712
  • I know you would come along. Thanks for clarifying that. – Johannes_B Oct 04 '14 at 07:09
  • Yes, it does but it also shows a fontspec bug. – vafa Oct 04 '14 at 07: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 04 '14 at 07: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 04 '14 at 08:00
  • 1
    @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 04 '14 at 08:00
  • @egreg: No, I would not say that for \line but at least \' behaves the same (provided you do not load fontspec). – vafa Oct 04 '14 at 08:14
  • @VafaKhalighi No, \. works quite differently in LaTeX than in Plain; the effect is similar, but not necessarily in all occasions. – egreg Oct 04 '14 at 08:21
  • @egreg: That is too bad. It is very painful when you have to make some lecture notes about TeX in LaTeX. Anyway, thanks for your clarifications. – vafa Oct 04 '14 at 08:26
  • @vafa I added a workaround for undeclaring the composite character. – egreg Oct 04 '14 at 16:19