5

After installing the new updates I get these errors while compiling my documents

A <box> was supposed to be here.

A <box> was supposed to be here. \setcounter

deleting as much as possible left me with this document

\documentclass[twocolumn]{memoir}

\usepackage{tcolorbox}

\begin{document}

tekst

\end{document}

which gives this error

A <box> was supposed to be here. \end{document}

replace "memoir"with book or article no error, removing twocolumn no error

I updated everything and reinstalled MikTex but the problem remains.

any ideas?

6
  • Same problem on an updated TeXLive installation.
    – user241086
    May 1, 2021 at 17:07
  • If one adds \tracingall before \end{document} one gets some gibberish with hooks. Maybe some LaTeX kernel change plays a role here?
    – user241086
    May 1, 2021 at 17:25
  • hm, I get it too. I will look. May 1, 2021 at 17:27
  • No problem with a non-updated installation. May 1, 2021 at 18:04
  • @PeterWilson I've forced auto loading mparhack under two column mode. Without it the side marginpar lands on are not always correct. Memoir relies on a kernel macro to tell us if we're in col 1 or 2. That macro sometimes fails.
    – daleif
    May 1, 2021 at 21:04

2 Answers 2

5

The problem seems to be an incompability between mparhack and the shipout/background hook.

You can as workaround until this is fixed suppress the loading of the package:

\makeatletter
\disable@package@load{mparhack}{}
\makeatother
\documentclass[twocolumn]{memoir}
\usepackage{tcolorbox}
\begin{document}

blub

\end{document}

The problem is that mparhack redefines \hb@xt@ in the output, and this command is used in various places, beside others in \put, and this means that the code in the shipout/background hooks fails. So another work around is this:

\documentclass[twocolumn]{article}
\usepackage{mparhack}
\AddToHook{shipout/background}{\put (0,0){}}
\makeatletter
\long\def\put(#1,#2)#3{%
  \@killglue
  \@defaultunitsset\@tempdimc{#2}\unitlength
  \raise\@tempdimc
  \hbox to\z@{% <--- instead of \hb@xt@
    \@defaultunitsset\@tempdimc{#1}\unitlength
    \kern\@tempdimc
    #3\hss}%
  \ignorespaces}
\makeatletter  
\begin{document}

blub

\end{document}
4
  • Either the mparhack needs to be updated or the "fix" it provides really ought to be in the kernel.
    – daleif
    May 1, 2021 at 18:47
  • @daleif I'm just discussing this. Perhaps we will add something to firstaid. (but long term mparhack should disappear ...). May 1, 2021 at 19:01
  • @daleif but is it "really" a fix? that is not a comment on the current issue, but the "hack" in there is rather bad and had resulted (not surprisingly in issues before as can be seen by the package attempts to alter eso-pic) May 1, 2021 at 19:58
  • @FrankMittelbach no, a bandaid rather, it is clear there is a problem, but as far as I could gather there currently is no real solution to this problem
    – daleif
    May 1, 2021 at 21:01
5

As Ulrike said, the problem here is that the package mparhack attempts to patch the kernel command \@dbloutputcol and inject some code into it. To make its life easier it simply redefined \hb@xt@ which is used there and replaces that under certain conditions (when the first argument is \columnwidth) with its own code --- if not it tries to execute the original code (which is basically \hbox to). Unfortunately that breaks very badly in other places where the kernel and package use \hb@t@, i.e., whenever it is used and has to be expandable, for example inside \put where the code looks like this

   \raise \hb@xt@ ...  % means \raise\hbox to ...

After mparhack has acted this now looks like

   \raise \def\mph@tempa{}\hbox to

an \def is not a box hence the error.

Midterm mparhack.sty needs a correct patch (or should vanish eventually), short term, here is a firstaid that we should apply from the kernel side until the package gets fixed. I didn't do much just made sure that \hb@xt@ remains expandable and expands to \hbox to normally (there are better ways to address this):

\makeatletter
\def\mph@outputdblcol{%
    \def\mph@chk@dcl{0}%
    \def\hb@xt@##1##2{%
        \ifx##1\columnwidth
            \mph@step@cnt\mph@chk@dcl
            \protected@edef\mph@tempa{%
                \noexpand\write\noexpand\@auxout{%
                    \noexpand\string\noexpand\mph@setcol{%
                        \romannumeral\mph@chk@dcl:\noexpand\thepage%
                    }{%
                        \noexpand\string\noexpand\mph@nr%
                    }%
                }%
            }%
            \mph@orig@hb@xt@##1{##2\mph@tempa}%
        \else
            \mph@orig@hb@xt@##1{##2}%
        \fi
    }%
    \mph@orig@outputdblcol
    \def\hb@xt@{\mph@orig@hb@xt@}%
    \ifnum\mph@chk@dcl=0\relax
    \else
        \ifnum\mph@chk@dcl=2\relax
        \else
            \mph@error{\string\@outputdblcol}%
        \fi
    \fi
}

\AddToHook{package/after/mparhack}{\let\@outputdblcol\mph@outputdblcol}
\makeatother

%----- above needs to happen before mparhack is loaded or rather fixed there


\documentclass[twocolumn]{memoir}



\usepackage{tcolorbox}

\begin{document}

tekst

\end{document}

As a final remark, especially also in the light of the claims made in Are the latest TeXLive updates failing to provide backwards capability? in the comments:

  • yes with more activity, bug fixes and extended functionality, new releases of LaTex may break things (any change has that ability)
  • but it very often simply shows hidden bugs or misuses that are lurking in many of the aged packages ... seriously you can't alter something as low-level as \hb@xt@and change its semantics and then say it is LaTeX's fault if this breaks when all we do is using it as defined by the kernel. And in that particular case the authors must have seen the problem in the past as they tried to fix it for eso-pic which does (more or less) what is now offered as a standard functionality in the kernel.
  • so yes things can break, but seldom silently, but so far such breakages have been mended by the package authors or by us (and usually for the better) because typically the true cause was a lurking issue that just showed its face

Update 2021-05-04

mparhackgot the necessary patch and it showed up on TL by now. This means that the problem should be gone. As a side-effect mparhack should now also work correctly in older LaTeX releases, for example, in TL18 where it broke the document

\documentclass{article}
\usepackage{draftwatermark,mparhack} 
\begin{document} X \end{document} 
14
  • I am sorry, the last three items do not match reality, at least not the one I am experiencing. Can it happen that users load packages that are a bit murky, perhaps without their knowledge? Yes. Does it help if the kernel gets changed in such a way that old files break and one is much more likely to get a very different output on the arXiv, say, than on an up-to-date TeX installation? I would say "No". In particular as this is a rather recent phenomenon.
    – user241086
    May 1, 2021 at 21:22
  • @user241086 sure that can happen (though "a bit murky" is a question of opinion). The problem with a bit murky is that any change in the kernel (the \hb@xt@ is a perfect example) can have that effect and yes, no one wants that ,which is why we chaise after such issues and normally get them resolved, which is why on arXiv you shouldn't get that problem (often) and if then only for a short period of time on few documents, but other than doing nothing ever there is not way to avoid such intermediate hickups (at least none that I know of --- if you have a receipe please tell me). May 1, 2021 at 21:56
  • Well, I understand that you might have some greater goal in mind, but please accept that some long-term LaTeX users see an increased rate of cases of backward incompatibilities. Some of them lead to errors in L3 syntax, which some of these long-term users like me do not really understand (and as it happens here), and sometimes the output changes. The files in which this happens are, in my case, either very long (we are talking about hundreds of pages) or of confidential nature, so not shareable, and even worse, I do not understand the "modern" error messages (so can't localize the issue well).
    – user241086
    May 1, 2021 at 22:06
  • 1
    @user241086 are you sure you are listening to arguments? In that particular example it was not a kernel change that caused the problem, it was a change in the used class file and it could have happened any time in the last 15 years if a similar change could have been made. May 2, 2021 at 7:58
  • 2
    @user241086 good then. No lies involved in my post. Try \documentclass[twocolumn]{article} \usepackage{draftwatermark,mparhack} \begin{document} X \end{document} in TL18 or earlier just as a simple example. Am I proud about first aid? Yes. It contains 4 fixes for other packages one of which is fixing a bug that is in bigfoot since ages one is for bidi and one for dinbrief last supported in 2000 --- so not a bad record at all imho. May 2, 2021 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .