TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a package that uses the ltxdoc document class and the docstrip program for code and documentation generation. The package deals with some multilingual stuff and needs XeTeX (to be precise, polyglossia itself, but this should be irrelevant), so I process it with xelatex.

Now I wish to use the polyglossia package to typeset a piece of text in another language in the .dtx file. However, I get a bizarre error when I add a \setdefaultlanguage or a \setotherlanguage command to the document:

! Package doc Error: Character table corrupted.

See the doc package documentation for explanation.
Type  H <return>  for immediate help.

l.26 %   Right brace   \}     Tilde         \~}

I've reduced it to this testcase:

% \iffalse


% \fi
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
% Hello World!
% \StopEventually{}
% \Finale

I've observed that once I place \setdefaultlanguage (a single line) in another file and \usepackage (but not \input!) it, then it works. I'm out of ideas. How could one fix the bug?

(I have TeX Live 2010 and the latest polyglossia version.)

share|improve this question
up vote 12 down vote accepted

The language definition files change the catcode of @ to 11, but never restore the original catcode. This is a severe bug that may cause much more trouble. Please report. Minimal example to reproduce:

\the\catcode`@ % should print 12, but prints 11

Until the bug is fixed, add \makeatother directly after the \setmainlanguage command.

(BTW, I wouldn't have thought that the character table check could be useful one day!)

EDIT: Reported at https://github.com/fc7/polyglossia/issues/#issue/13

EDIT 2: Fixed.

share|improve this answer

Your Answer


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.