未调用宏就导致错误

未调用宏就导致错误

当我的宏文件中存在以下宏时,会发生以下错误:

 \mycolumnbreak ->\ifnum \doublecol 
                                    @number>\z @ \vfill \mbox {}\columnbreak ... 
l.303 ...names]{_TEST.csv}{}{\feuilleDeCorrection}

但是,这个宏从来没有被调用过。

您是否发现任何明显的原因?

谢谢

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Subalign
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% see: https://tex.stackexchange.com/a/198806/8323
\makeatletter
\newcommand{\subalignCANNOTBECALLED}[1]{%
  \vcenter{%
    \Let@ \restore@math@cr \default@tag
    \baselineskip\fontdimen10 \scriptfont\tw@
    \advance\baselineskip\fontdimen12 \scriptfont\tw@
    \lineskip\thr@@\fontdimen8 \scriptfont\thr@@
    \lineskiplimit\lineskip
    \ialign{\hfil$\m@th\scriptstyle##$&$\m@th\scriptstyle{}##$\hfil\crcr
      #1\crcr
    }%
  }%
}
\makeatother

编辑:

以下是代码\mycolumnbreak

\def\mycolumnbreak{%
\ifnum \doublecol@number>\z@
    \vfill\mbox{}\columnbreak%
\fi%
}

答案1

MWE 是

\documentclass{article}
\makeatletter

\makeatother
\def\mycolumnbreak{\ifnum \doublecol@number>\z@ \vfill \mbox {}\columnbreak\fi}

\mycolumnbreak

您没有显示错误消息,即未定义的控制序列:

! Undefined control sequence.
\mycolumnbreak ->\ifnum \doublecol 
                                   @number>\z @ \vfill \mbox {}\columnbreak \fi 
l.7 \mycolumnbreak
                  
? 

请注意,消息显示在之后有一个中断\doublecol,并且\z@由于\z @具有@catcode other (12),因此它不是命令名称的一部分。

因此,假设您显示的代码(以 结尾\makeatother)位于您未显示的代码之前,该代码定义了\mycolumnbreak您应该删除\makeatother

答案2

我更换了

\def\mycolumnbreak{%
\ifnum \doublecol@number>\z@
    \vfill\mbox{}\columnbreak%
\fi%
}

经过

\makeatletter
\def\mycolumnbreak{%
\ifnum \doublecol@number>\z@
    \vfill\mbox{}\columnbreak%
\fi%
}
\makeatother

有用。

相关内容