-3

When the following macro lies in my macro files, the following bug happens:

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

But, this macro in never called.

Do you see any obvious reason?

Thanks

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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

EDIT:

Here is the code of \mycolumnbreak:

\def\mycolumnbreak{%
\ifnum \doublecol@number>\z@
    \vfill\mbox{}\columnbreak%
\fi%
}
David Carlisle
  • 757,742
Colas
  • 6,772
  • 4
  • 46
  • 96
  • 2
    you need to provide an example, you show neither the input nor the error message. – David Carlisle Jun 27 '23 at 16:18
  • After I make this into a MWE, it doesn't cause any problem (unless I call the macro). – Teepeemm Jun 27 '23 at 16:20
  • 1
    you can always make a MWE start from a copy of your document and delete things until small enough to post. You could at least show the error message, which I guess is undefined command ? – David Carlisle Jun 27 '23 at 16:22
  • 1
    Oh! you have \makeatother in the wrong place so \doublecol@number is read as ``\doublecol @number` – David Carlisle Jun 27 '23 at 16:24
  • But you don't have \doublecol@number anywhere in your example. Is it perhaps in the code that immediately follows the example? In which case, the problem is that you don't want this \makeatother, because the code following still needs @ to be a letter. (And an example that actually causes the error would have been more helpful.) – Teepeemm Jun 27 '23 at 16:29
  • 1
    How can we debug if you don't show how you define \mycolumnbreak? – egreg Jun 27 '23 at 16:53
  • I've added a edit to the question. Thanks for your comments and your answer. I've not given a MWE because the fact a macro that is not called creates a bug seemed very strange to me. I've thought that experts could immediately see the problem. – Colas Jun 27 '23 at 19:05
  • @Colas: Is \mycolumbreak surrounded by \makeatletter...\makeatother or in a .sty file? Note that \mycolumnbreak may be called by something else. – Werner Jun 27 '23 at 19:21
  • 1
    @Colas we can spot the problem (see my answer) but for example not showing the error message made it a lot harder to spot. – David Carlisle Jun 27 '23 at 21:41
  • Thanks for all your comments. \mycolumbreak was not surrounded by \makeatletter ... \makeatother. It's strange because I've been using the command for years without a problem. Only now that I am adding \subalignCANNOTBECALLED I have problems. – Colas Jun 28 '23 at 04:38

2 Answers2

2

An MWE is

\documentclass{article}
\makeatletter

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

\mycolumnbreak

You did not show the error message, which is undefined control sequence:

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

?

Note the message shows a break after \doublecol and \z@ as \z @ as @ has catcode other (12) so is not part of the command names.

So presumably the code you show (which ends in \makeatother) is before the code you did not show which defines \mycolumnbreak and you should remove \makeatother

David Carlisle
  • 757,742
0

I replaced

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

by

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

It works.

Colas
  • 6,772
  • 4
  • 46
  • 96
  • 1
    You can also just use \makeatletter and \makeatother once, you just need to take care that all defintions in your document that use @ are between these two commands. Otherwise the @ will be considered a special character and things will break. – Jasper Habicht Jun 28 '23 at 07:41