Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use TexLive 2012 (on Mac) and the following minimal example does not work:

\documentclass{article}
\usepackage{ifxetex}
\usepackage[mathletters]{ucs} % Need newline here!
\ifxetex
\else
\fi

\begin{document}
\end{document}

The above example does not compile unless I add at least one extra newline after the comment, as you can see in the log at the end. The garbled characters are garbled in the error message.

I have a workaround, and that source isn't even what I need to write (in the end, I shouldn't load ucs if I'm using xetex, so its loading should also be conditional), but I still wonder about the best course of action for reporting this.

  1. What could cause the error?
  2. Could I be running into more silent errors?
  3. How can I report this best? Should I bother the ifxetex author (it's a very small package) or just the ucs one?
  4. Is this kind of question itself appropriate?

Here's the error I get. It seems that loading ucs didn't complete.

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
 restricted \write18 enabled.
entering extended mode
(./bug.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
 polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbianc, s
lovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,
welsh, loaded.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2012/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/data/uninames.dat
! Undefined control sequence.
G...tempcnta by1\relax \ifnum \@tempcnta =\uc@got
                                                  \expandafter \uncompress \...
l.241 G
       Ч�ϑ������񟂽ĵٵׂԞ��
? X
No pages of output.
Transcript written on bug.log.

Here's the result with the extra newline. Most notably, ucs loads a different file, if I interpret the output correctly.

I can't spot significant differences with XeLaTeX's behavior, in both cases.

$ pdflatex bug
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
 restricted \write18 enabled.
entering extended mode
(./bug.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
 polish, portuguese, romanian, romansh, russian, sanskrit, serbian, serbianc, s
lovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian,
welsh, loaded.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2012/texmf-dist/tex/generic/ifxetex/ifxetex.sty)
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/ucs.sty
(/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/data/uni-global.def))
(./bug.aux) (/usr/local/texlive/2012/texmf-dist/tex/latex/ucs/ucsencs.def)
(./bug.aux) )
No pages of output.
Transcript written on bug.log.
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The problem is the way ucs emulates LaTeX kernel features. If you read the code, you'll find:

\ifx\@ifnextchar\undefined
  \def\@ifnextchar#1#2#3{%
    \let\reserved@d=#1%
    \def\reserved@a{#2}%
    \def\reserved@b{#3}%
    \futurelet\@let@token\@ifnch}\fi

which looks safe enough, but fails in the case where the immediately preceding use of \@let@token was by \newif. That's because it is the \let to \iffalse, meaning that the conditional is unbalanced and everything 'runs away'. What is needed to to make \@let@token@ 'safe', for example by inserting

\let\@let@token\relax

just before this test (or indeed anywhere earlier). As such, the link to ifxetex is coincidental, and it's a bug in ucs.

share|improve this answer
    
Thanks for your answer! I managed to apply the change you propose - I'm don't know enough real TeX to fully follow the answer or get the code, but I'll point to your report. I also verified that the latest Texlive 2012 update didn't fix the problem. –  Blaisorblade May 10 '13 at 0:55
add comment

I have incorporated the patch suggested by Joseph Wright into the ucs package. The updated package should soon appear on CTAN under version number 2.2.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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