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

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.

• Welcome to TeX.SX! This example compiles for me without problem. Do you have an outdated TeX distribution? – user31729 Dec 24 '15 at 11:25
• 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. – Werner Dec 24 '15 at 11:26
• 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?) – Stephen Dec 24 '15 at 11:27
• @ChristianHupfer: pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) last ubuntu version. I'm right now trying to update. – Arthur Rainbow Dec 24 '15 at 11:36
• 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. – egreg Dec 24 '15 at 11:45

• 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. – Joseph Wright Dec 24 '15 at 16:01