I am making a multi-language document. With the big help of Mr. Steven B. Segletes, I am able to deal with several languages mixed document, which can only output in wanted one or several laguages. See the thread Parse command argument separated by comma

I also aliased \mulan to new commands such as \mulanp and \mulanr so that the \mulan command can be simplified when the text is seperated by \par or /.

Now I am defining an aliasing command to make \mulan also works in table. (I have no idea about how to define a variable number argument command, so I just fix the number of arguments to three) When I compile the following minimal example, it works as expected. But when I comment a meaningless statement before the table, it gives an error message,

!Missing  \endcsname inserted.

Could you help out? Thanks in advance.

% Command \mulan usage example
% Compiled by XeLatex

%Table packages
\usepackage{longtable}     %long table across multi pages

% \mulan comand defintion to deal with multiple language
\newif\ifen %English
\newif\iffr %French
\newif\ifru %Russian
\newif\ifjp %Japanese
\newif\ifcn %Chinese
\newif\ifkr %Korean
\def\en#1{\ifen\callsep #1\fi\langcmd}
\def\fr#1{\iffr\callsep #1\fi\langcmd}
\def\ru#1{\ifru\callsep #1\fi\langcmd}
\def\jp#1{\ifjp\callsep #1\fi\langcmd}
\def\cn#1{\ifcn\callsep #1\fi\langcmd}
\def\kr#1{\ifkr\callsep #1\fi\langcmd}

%specify the multi languge sequence variable globaly


  \expandafter\def\csname arg\romannumeral\value{mulan@args}\endcsname{relax}%

  \expandafter\def\csname arg\romannumeral\value{mulan@args}\endcsname{#1}%

  \csname\csname arg\romannumeral\value{mulan@args}\endcsname\endcsname%

%Convient alias command for \mulan
\def\mulanr{\expandafter\mulan{ \space {\textbf{/}}\space}}

% multiline in tab cell !!! problem yet !!!
    \mulan{\\}{#2}{#3}{#4}  %


\entrue \jptrue \cntrue

%%%---------This command has not been finished yet------

\title{\mulanp{English Document}{Japanese Document}{Chinese Document}}
\author{\mulanr{English name}{Japanese name}{Chinese name}}




\section{\mulanr{English title}{Japanese title}{Chinese title}}

%%% !!! if the following statement is commented, there will be an error occured.
%\mulan{}{}{}{}  % I just make it do nothing

 \mulanT{English item}{Japanese item}{Chinese item} & Price(USD) & \mulanT{Englishi-Repark}{Japanese-Repark}{Chinese-Remark}\\
 \mulanT{IamEnglish}{IamJapanese}{IamChinese}  & 15.0 & \mulanT{This is remark in English and is very long.}{This is remark in Japanese and is very long.}{This is remark in Chinese and is very long.}    \\

  • 1
    It's difficult to compile your example since not everybody has the CJK extensions installed. Could you reduce your example to something without CJK - content? (I suspect that your \mulanr macro call in \section{\mulanr{Title}... is the cause, try to use \section{\protect\mulanr{.....}} – user31729 Feb 13 '15 at 7:32
  • I have removed teh CJK characters in my example. Could you please kindly check it again? Even I add \protect command, it does not work yet. – Jilong Yin Feb 13 '15 at 8:19
  • 1
    since you are using the @ sign in command names appearing in your definitions, you need to wrap that portion of the preamble with \makeatletter ... \makeatother. – barbara beeton Feb 13 '15 at 13:47

The coding of your \mulan command is a little strange, I am not sure what it is intended to do so I won't suggest a change but the comment is misleading:

\mulan{}{}{}{}  % I just make it do nothing

It does not do nothing. That command defines several commands, in particular \argiii and the error you get is due to that command not being defined (or to be more exact, it is defined to be \relax)

! Missing \endcsname inserted.
<to be read again> 
l.96 ...English item}{Japanese item}{Chinese item}
  • The full usage of the command \mulan is \mulan[en,jp,cn,xx]{en-sentence}{jp-sentence}{cn-sentence}{xx-sentence}. The replacement text of the command will be \en{en-sentence} \jp{jp-sentence} \cn{cn-sentence} \xx{xx-sentence} The number of the arguments is variable. and the argument [en,jp,cn,xx] can be an option. So according some if conditions, I can control the appereance of each clause. For example, I can control if it will be output. – Jilong Yin Feb 13 '15 at 8:53
  • @JilongYin if it works fine, although its definition looks more complicated than necessary, but just put the version with empty arguments in the package or preamble where you define the command, so that its internal macros get initialised in a safe place. – David Carlisle Feb 13 '15 at 9:02
  • Thanks for your patient explaination. So the initialization is the reason. – Jilong Yin Feb 13 '15 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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