# Capacity exceeded error

I am using MacTex 2016 on a Mac (El Captain 10.11.2). My text editor is TexStudio 2.11.0 and all my packages have been updated (TeX live Utility 1.24).

Since I updated MacTex from version 2015 to version 2016, I constantly get the same error when compiling : in a file containing references, when I compile with XeLateX the first time, I get an error about exceeded capacity right where I have an \textcite or \autocite command (the following lines are just warnings) :

TeX capacity exceeded, sorry [parameter stack size=10000]. This book \autocite{adams} 'firstinits' option is deprecated, use 'giveninits' instead. inputenc package ignored with utf8 based engines. Patching footnotes failed. Conflicting options. Add \usepackage{fontspec} to the(frenchb.ldf) preamble of your document,

This file.tex would work just fine before I updated MacTex, I would compile with XeLateX, then bibtex, then XeLatex twice. But before trying to desinstall 2016 and come back to 2015 (if I am ever able to download it somewhere...), I would like to understand what I am doing wrong, and obviously I'm doing something VERY wrong.

\documentclass{book}
\title{Chapitre2}
\makeindex
\date{}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{times}
\usepackage{tipa}
\usepackage{chngcntr}
\usepackage[backend=bibtex, citestyle=authoryear-comp, maxcitenames=2, firstinits=true]{biblatex}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage{longtable}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{colortbl}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{arydshln}
\usepackage{todonotes}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{caption}
\usepackage{phonrule}
\usepackage{tikz-qtree-compat}
\usetikzlibrary{decorations.markings, calc, shapes.misc, decorations.pathreplacing}
\usepackage{xr}
\usepackage{float}
\usepackage{gb4e}
\usepackage{hyperref}

\begin{document}

bla bla

Another awesome book : \textcite{arnason}.

\printbibliography
\end{document}


I know there are a lot of packages, but since some of them are incompatible, maybe that could be the problem. And here are the two references I'm refering to from my bib file :

@Book{adams,
title =     {Faroese: a language course for beginners},
publisher = {Stiðin},
year =      {2014},
author =    {Adams, Jonathan and Petersen, Hjalmar P.},
type =      {Book}
}

@Book{arnason,
title =     {The phonology of Icelandic and Faroese},
publisher = {Oxford University Press},
year =      {2011},
author =    {\'{A}rnason, Kristj\'{a}n},
type =      {Book}
}


• Welcome to TeX SX! There were a few minor problems, but I can compile it. You cannot compile this very file? – Bernard Jul 26 '16 at 22:31
• You can easily reduce the example by commenting out packages and removing them if you still get the error. It is just mechanical. – cfr Jul 27 '16 at 0:51
• Unless you manually deleted your MacTeX 2015 distribution, it is still on your computer, and you can switch between it and the 2016 version using the TeX Live Utility (see the Change Default TeX Live Version item in the Configure menu). – Alan Munn Jul 27 '16 at 1:22
• @Bernard Thank you :) I looked on forums and tried different things and I always ended up with the same error. – Islenska Jul 27 '16 at 7:01
• @cfr I did! But I need all of these packages. I tried to order them differently so they would not conflict, without success. – Islenska Jul 27 '16 at 7:02

The problem is in \automath of gb4e, together with the fact that biblatex uses an internal key with an underscore _ in its name.

This makes TeX enter a loop that ends with the dreaded “TeX capacity exceeded” message.

If you want to use gb4e and biblatex together, you need to issue \noautomath.

Other problems in your preamble are

1. \usepackage[utf8]{inputenc}
2. \usepackage[T1]{fontenc}
3. \usepackage{times}

These should be removed and

\usepackage{fontspec}


should be issued. If you want a Times like font, declare

\setmainfont{TeX Gyre Termes}


Here's an updated version of your preamble that fixes the issue.

\begin{filecontents*}{\jobname.bib}
title =     {Faroese: a language course for beginners},
publisher = {Stiðin},
year =      {2014},
author =    {Adams, Jonathan and Petersen, Hjalmar P.},
type =      {Book}
}

@Book{arnason,
title =     {The phonology of Icelandic and Faroese},
publisher = {Oxford University Press},
year =      {2011},
author =    {\'{A}rnason, Kristj\'{a}n},
type =      {Book}
}
\end{filecontents*}

\documentclass{book}
\usepackage[french]{babel}

\usepackage{tipa}
\usepackage{fontspec}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{chngcntr}
\usepackage[
backend=bibtex,
citestyle=authoryear-comp,
maxcitenames=2,
%  firstinits=true
]{biblatex}
\usepackage{csquotes}
\usepackage{array}
\usepackage{longtable}
\usepackage{tabulary}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{colortbl}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{arydshln}
\usepackage{todonotes}
\usepackage{fancyhdr}
\usepackage{titlesec}
\usepackage{caption}
\usepackage{phonrule}
\usepackage{tikz-qtree-compat}
\usetikzlibrary{decorations.markings, calc, shapes.misc, decorations.pathreplacing}
\usepackage{xr}
\usepackage{float}
\usepackage{gb4e}
\usepackage{hyperref}

\setmainfont{TeX Gyre Termes}
\noautomath

\begin{document}
\title{Chapitre2}
\date{}

bla bla

Another awesome book : \textcite{arnason}.

\printbibliography
\end{document}


The filecontents* environment is just to make the document self-contained. Use your own .bib database. You should consider using Biber instead of BibTeX.

If TeX Gyre Termes is not installed as a system font, declare it in the following way:

\setmainfont{texgyretermes}[
Extension=.otf,
UprightFont=*-regular,
ItalicFont=*-italic,
BoldFont=*-bold,
BoldItalicFont=*-bolditalic,
]

• Might be good to recommend replacing tipa if the OP is using XeLaTeX anyway? Also colortbl can go if table is added for xcolor and graphicx can be removed. Do you happen to know why Biblatex recommends xpatch? – cfr Jul 27 '16 at 0:48
• Thanks egreg! I tried your MWE in my TexStudio and I get a new error : fontspec error: "font-not-found" The font "TeX Gyre Termes" cannot be found. For immediate help type H <return>. \setmainfont{TeX Gyre Termes}. On my Tex Live utility, I can see that tex-gyre is installed (which is the required package for this font, if I understood correctly). If I take this line out, then I get this error : Undefined control sequence. \end I still need a little bit more research to get your solution to work, but it's helping since I don't get the "capacity exceeded" error anymore! – Islenska Jul 27 '16 at 8:05
• @Islenska You have to install TeX Gyre Termes as a system font, or do a more complicated call. I'll add the way for setting it. – egreg Jul 27 '16 at 8:16
• It worked, the font is perfect :) Also, I changed backend=bibtex to biber and set biber as my default bibliography tool in the settings. References appear correctly in the text now. However I still get the Undefined control sequence. \end error. If I take out the \printbibliography command then it compiles fine... Ps: I saw this post (tex.stackexchange.com/questions/158731/…) and did what you advised. It is not the problem. – Islenska Jul 27 '16 at 8:42
• @Islenska Sorry, but I get no error. Try retyping the last lines. – egreg Jul 27 '16 at 8:43

The solution that egreg proposes requires you to turn off the \automath feature (which allows use of _ and ^ in text mode). Since this is really a quite useful feature for linguists, here's a solution (due to David Carlisle) which will solve the problem and also allow you to keep using \automath. It is likely that this will be included in the next release of gb4e but that hasn't happened at time of writing.

As cfr mentions in her comment to egreg, it's generally not a great idea to use TIPA if you are using XeLaTeX. Instead use a font with phonetic symbols and enter them directly into your source. See:

\begin{filecontents*}{\jobname.bib}
title =     {Faroese: a language course for beginners},
publisher = {Stiðin},
year =      {2014},
author =    {Adams, Jonathan and Petersen, Hjalmar P.},
type =      {Book}
}

@Book{arnason,
title =     {The phonology of Icelandic and Faroese},
publisher = {Oxford University Press},
year =      {2011},
author =    {\'{A}rnason, Kristj\'{a}n},
type =      {Book}
}
\end{filecontents*}

\documentclass{book}
\usepackage[french]{babel}

\usepackage{fontspec}
\usepackage[
backend=bibtex,
citestyle=authoryear-comp,
maxcitenames=2,
%  firstinits=true
]{biblatex}
\usepackage{csquotes}

\usepackage{gb4e}

\let\gbtmp_
\protected\def_{\ifincsname\string_\else\expandafter\gbtmp\fi}

\usepackage{hyperref}

\setmainfont{TeX Gyre Termes}
%\noautomath

\begin{document}
\title{Chapitre2}
\date{}

bla bla