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
\documentclass{ltxdoc}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\begin{document}
\DocInput{test.dtx}
\end{document}
% \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
\endinput
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.)