ERROR: You can't use a prefix with `\begingroup'

3,680

As egreg commented, it seems it suffices to have hypperref as last package, and expl3 avfter newtxtext. It now compiles. Even if I couldn't say why.

Share:
3,680

Related videos on Youtube

Arthur Rainbow
Author by

Arthur Rainbow

Updated on August 01, 2022

Comments

  • Arthur Rainbow
    Arthur Rainbow over 1 year

    Here is a minimal example of a document which does not compile.

    \documentclass{report}
    \usepackage[francais]{babel}
    \usepackage{expl3}
    \usepackage{appendix}
    \usepackage{multicol}
    \usepackage{hyperref}
    \usepackage{enumitem}
    \usepackage{wrapfig}
    \usepackage{subcaption}
    \usepackage{tikz}
    \usepackage{makecell}
    \usepackage{minitoc}
    \usepackage{newtxtext}
    \usepackage{newtxmath}
    \usepackage{algorithm2e}
    \usepackage{algorithmic}
    \newtheorem{test0}{test0}
    \newtheorem{test1}{test1}
    \newtheorem{test2}{test2}
    \begin{document}
    \end{document}
    

    The error message (as seen on emacs) states:

    ERROR: You can't use a prefix with `\begingroup'.

    --- TeX said --- \begingroup l.20 \begin{document}

    --- HELP --- From the .log file...

    I'll pretend you didn't say \long or \outer or \global or \protected.

    I tried adding etex to the list of package, but I can not see any difference

    And I must confess I don't have any clue of why it is a minimal example. I can't imagine how this exact set of package interract so that, any of them removed solve the problem. Furthermore, I find surprising that changing report to article, or [francais] to [english] also solve the problem.

    Alas, I prefer not to do any of those change if I can, because all of those package are useful in my thesis, which is certainly not small enough to be an article.

    • Admin
      Admin almost 8 years
      Welcome to TeX.SX! This example compiles for me without problem. Do you have an outdated TeX distribution?
    • Werner
      Werner almost 8 years
      Here is my guess: l.20 refers to \begin{document}, which is where minitoc starts reading its .mt0, .mt1, ... files. If you have some of those hanging around, and they're out-of-date, it may cause an unexpected error. Clear those from your current folder (in addition to other auxiliary files) and you should be able to compile without problem... well, as something within the document environment. So this has nothing to do with all the other packages interacting with one another... showing the .log file would also help isolate the problem.
    • Stephen
      Stephen almost 8 years
      With updated TeX Live 2015 this works for me without errors. When you use the option "-file-line-error" with pdflatex, you should at least get information about which file the "line 20" is in. (Or maybe you can already get it from the .log-file?)
    • Arthur Rainbow
      Arthur Rainbow almost 8 years
      @ChristianHupfer: pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) last ubuntu version. I'm right now trying to update.
    • Admin
      Admin almost 8 years
      @ArthurRainbow: Well, TL 2013 is 'old'
    • egreg
      egreg almost 8 years
      Yes, I can reproduce this with TL 2013.
    • Arthur Rainbow
      Arthur Rainbow almost 8 years
      @Werner: And the folder are cleared, there is not a single document apart the .tex
    • egreg
      egreg almost 8 years
      It's some bad interaction between expl3 and newtxtext; it seems to be solved if you load expl3 after newtxtext. Also move hyperref as the last loaded package.
    • Arthur Rainbow
      Arthur Rainbow almost 8 years
      Thank you @egreg, it seems to work perfectly now. Even if, to be honest, this seems nonsens to me. It just works.
  • Joseph Wright
    Joseph Wright almost 8 years
    It happens because of the way etex was set up to switch from the standard to the extended pool in conjunction with mistaken use of \begingroup before register assignment.