3

I'm getting the following error when trying to compile a master .tex file:

TeX capacity exceeded, sorry [parameter stack size=10000]

There's some info in the .log file that may be relevant but hasn't helped me much:

ABD: EveryShipout initializing macros
LaTeX Font Info:    Try loading font information for OT1+ztmcm on input line 11
.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/ot1ztmcm.fd
File: ot1ztmcm.fd 2000/01/03 Fontinst v1.801 font definitions for OT1/ztmcm.
)
LaTeX Font Info:    Try loading font information for OML+ztmcm on input line 11
.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/omlztmcm.fd
File: omlztmcm.fd 2000/01/03 Fontinst v1.801 font definitions for OML/ztmcm.
)
LaTeX Font Info:    Try loading font information for OMS+ztmcm on input line 11
.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/omsztmcm.fd
File: omsztmcm.fd 2000/01/03 Fontinst v1.801 font definitions for OMS/ztmcm.
)
LaTeX Font Info:    Try loading font information for OMX+ztmcm on input line 11
.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/omxztmcm.fd
File: omxztmcm.fd 2000/01/03 Fontinst v1.801 font definitions for OMX/ztmcm.
)
LaTeX Font Info:    Try loading font information for OT1+ptm on input line 11.

(/usr/local/texlive/2016/texmf-dist/tex/latex/psnfss/ot1ptm.fd
File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm.
)
LaTeX Font Info:    Font shape `OT1/ptm/bx/n' in size <12> not available
(Font)              Font shape `OT1/ptm/b/n' tried instead on input line 11.
LaTeX Font Info:    Font shape `OT1/ptm/bx/n' in size <9> not available
(Font)              Font shape `OT1/ptm/b/n' tried instead on input line 11.
LaTeX Font Info:    Font shape `OT1/ptm/bx/n' in size <7> not available
(Font)              Font shape `OT1/ptm/b/n' tried instead on input line 11.

! TeX capacity exceeded, sorry [parameter stack size=10000].
\@ifnextchar #1#2#3->
                     \let \reserved@d =#1\def \reserved@a {#2}\def \reserved...
l.11 \input{monog_pretextuais.tex}

If you really absolutely need more capacity,
you can ask a wizard to enlarge me.

I have pretty much every LaTeX package installed and updated (including psnfss, collection-fontsextra, etc.), except for a few very Windows-specific packages. I use texlive (tlmgr), as I find the packages in the Ubuntu repository too outdated. I use LaTeXila with latexmk (tex > dvi > ps > pdf) to edit and compile my files. It's very important, for the purposes of my project, for the serif font to be Times New Roman (mathptmx) and the document class to be abntex2, for I need to abide by many ABNT-like standards.

I've attempted to create MWEs.

These are the master file contents:

\input{monog_preambulo.tex}

% ELEMENTOS PRÉ-TEXTUAIS
\begin{document}
\pretextual
\pagestyle{plain}
\aliaspagestyle{chapter}{plain}
\pagenumbering{roman}

\input{monog_pretextuais.tex}
\end{document}

monog_preambulo.tex contents:

\documentclass[
    % -- opções do pacote memoir --
    letter,                                 % estranhamente, Normas do IEL.pdf pag53 recomenda letter
    12pt,                                   % tamanho da fonte
    oneside,                                % para impressão apenas em frente; ver Normas do IEL.pdf pag54
    %openright,                             % capítulos começam em pág ímpar
    %sumario=tradicional,
    oldfontcommands,                        % autoriza certas operações do linguex
    % -- opções do pacote babel --
    english,                                % idioma secundário
    brazil                                  % idioma principal
    ]{abntex2}
%\special{papersize=21.59cm,27.94cm}         % tamanho carta
                                            % https://en.wikibooks.org/wiki/LaTeX/Page_Layout

% margens
\usepackage[
top=3cm,
left=3cm,
bottom=2cm,
right=2cm,
%showframe
]{geometry}
% note que, conforme Norma do IEL.pdf pag53, se essa monografia exceder 100 páginas,
% todas as margens deverão ser de 3cm.

% encoding
\usepackage[utf8]{inputenc}                 % encoding do texto de input
\usepackage[T1]{fontenc}                    % encoding da fonte usada no output

% fontes
\usepackage{mathptmx}                       % serifada: times new roman; integra o pacote psnfss
\usepackage[scaled=.92]{helvet}             % sans: helvetica
\usepackage{courier}                        % monospace: courier
\usepackage{pifont}                         % dingbats, symbols; integra o pacote psnfss

% desenhos
\usepackage{float}                           % permite ambientes float
\usepackage[section]{placeins}              % evita que floats ultrapassem a seção pretendida
%\usepackage{caption}                       %
\usepackage[absolute]{textpos}              % cria caixas em posições absolutas
\usepackage{graphicx}                       % inclui figuras
\usepackage[dvipsnames]{xcolor}             % controle das cores
%\usepackage{pstricks}                       % faz os desenhos vetorizados
%\usepackage[all]{xy}
%\usepackage{tikz}
\usepackage{tikz-qtree}                     % árvores sintáticas
\usepackage{tikz-qtree-compat}              % permite \qroof e \1, \0 nos nodes

% lógica
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
    %\providecommand{\abs}[1]{\lvert#1\rvert}
    % comando para a cardinalidade de conjuntos; \abs{2} retorna |2|
    %\let\emptyset\varnothing                % muda a aparência do símbolo do conjunto vazio

% linguística
\usepackage{linguex}                        % exemplos numerados e glosas
\automath                                   % permite árvores dentro dos exemplos do linguex

% comentários e debugging
%\usepackage{lipsum}                        % texto genérico
\usepackage{verbatim}                       % ambientes código e comentário
\usepackage[portuguese]{todonotes}

% dados para a capa e a folha de rosto
\usepackage{monografiaiel}
\titulo{O t{\'\i}tulo da monografia}
\autor{Daniel Alves da Silva Lopes Diniz}
\orientador[Orientadora:]{Profa. Dra. Ruth Elisabeth Vasconcellos Lopes}
\local{Campinas}
\data{2016}
\instituicao{%
Universidade Estadual de Campinas
\par
Instituto de Estudos da Linguagem
}
\tipotrabalho{Monografia (gradua{\c c}\~ao)}
\preambulo{Monografia apresentada ao Instituto de Estudos da Linguagem da Universidade Estadual de Campinas como requisito parcial para a obten{\c c}\~ao do t\'\itulo de bacharel em Lingu\'\istica.}

% tipografia
% hyperref deve ser declarado antes de abntex2cite
\setlength{\parindent}{2cm}                 % tamanho da tabulação; ver Normas do IEL.pdf pag53
\setlength{\ABNTEXcitacaorecuo}{4cm}        % recuo para citações longas; ver Normas do IEL.pdf pag40
\setlength{\parskip}{.2cm}                  % espaço entre parágrafos
\usepackage{indentfirst}                    % 1º parágrafo indentado
\usepackage{needspace}                      % bloco de texto ininterruptível
%\usepackage{microtype}                      % justificação melhorada
\raggedbottom                               % evita preenchimento da página
%\usepackage{booktabs}                      % tabelas melhores
%\usepackage{multirow}                      % mesclar células verticalmente
\usepackage{hyperref}                       % links internos
\makeatletter
\hypersetup{
    pdftitle={vers\~ao 3},
    pdfauthor={\@author},
%
    colorlinks      = true,                 % cores em vez de caixas
    urlcolor        = Black,                % links externos
    linkcolor       = Black,                % link internos
    citecolor       = Black                 % citações
}
\makeatother

% referências bibliográficas
%\begin{comment}
\usepackage[
    alf,                                    % autor-data
    %versalete,                             % versalete
    abnt-emphasize = bf,                    % destaques em negrito, e não em itálico
    abnt-etal-list = 3,                     % abrevia autorias maiores que 3 (Normas do IEL.pdf pag22
    %abnt-etal-text = it,                   % escreve o et al., em italico
    %abnt-and-type = &,                     % usa o carater '&' no lugar de 'e' para mais de um autor
    abnt-last-names = abnt,                 % trata sobrenomes "estritamente" conforme a ABNT
    abnt-repeated-author-omit = yes         % autores com mais de uma entrada recebem ______
]{abntex2cite}

monog_pretextuais.tex contents:

nothing; that is, even when all its contents are commented out, I still get an error.

I'm getting quite desperate with this error because I need to finish this work somewhat quickly and it doesn't compile anymore.

6

The code below identifies the cause and prevents the infinite loop but unfortunately \protected definitions still expand while handling primitive input file names so the _ will still be misinterpreted.

It seems safest to say that \automath is incompatible with _ in filenames and that \noautomath should be used locally (or better, for the whole document) to disable the feature.



You are in an infinite loop

\@ifnextchar #1#2#3->\let \reserved@d =
                                       #1\def \reserved@a {#2}\def \reserved...

\@ifnextchar #1#2#3->\let \reserved@d =
                                       #1\def \reserved@a {#2}\def \reserved...

\@ifnextchar #1#2#3->\let \reserved@d =
                                       #1\def \reserved@a {#2}\def \reserved...

\@ifnextchar #1#2#3->\let \reserved@d =

One of the packages you load defines _ in a somewhat brave way so it is no longer safe in filenames

\input{monog\string_pretextuais.tex}
            %%%%%%%%

works.


The culprit is \automath.

\automath is actually defined in gb4e package (indirectly loaded via linguex).

In the example below I show a safer definition that could be proposed to the package maintainers, it allows _ to be used in filenames and other places without being prefixed with \string

\documentclass{article}
\usepackage{gb4e}

{ % Temporarily change catcodes
  \catcode`\_=\active
  \catcode`\^=\active
   \makeatletter

  \global\def\automath{%
    \catcode`\_=\active
    \catcode`\^=\active
    \protected\def_##1{\gb@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
    \protected\def^##1{\gb@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}}
}


\automath
\begin{document}

\errorcontextlines10000
a_b

\input{monog_pretextuais.tex}
\end{document}

If you try the above without the code between {...} then you get the same infinite loop.

|improve this answer|||||
  • 2
    \usepackage{linguex}\automath – egreg Oct 18 '16 at 21:21
  • @egreg yep just found it – David Carlisle Oct 18 '16 at 21:26
  • Unfortunately I have to use \automath as it is what allows me to put trees drawn with tikz-tree inside linguex examples. So what I did is use \string_ instead of _ in the filenames. It seems that's not the best workaround, but looks good enough (at least the master file is compiling). Thanks a lot! – Daniel Diniz Oct 20 '16 at 8:32
  • side note: package gb4e makes the caret active already in the preamble. This is doomed to make loading of next packages fail, if they do any serious stuff... (for example filecontents can not be loaded after gb4e). – user4686 Oct 20 '16 at 15:26
  • in fact, gb4e.sty not only defines but executes \automath... – user4686 Oct 20 '16 at 17:02
3

Here is a solution which will avoid you to modify in any way the body of the document. It assumes you always use the recommended by the LaTeX books form: \input {foo} (i.e. with braces, the space is optional).

When I was working on this solution I discovered a big problem with gb4e: it leaves the caret active after its loading already in the preamble !! This is doomed to create problems with loading of other packages. For example filecontents can not be loaded after it.

BEFORE: 7
AFTER: 13

Anyway, here is a possible approach under the constraint mentioned above.

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{name_with^underscore^and_caret}
Hello: c_d^e
\end{filecontents}

% IMPORTANT NOTE. There is something WRONG with gb4e.
% IT MAKES THE CARET ACTIVE !!!!!!!!!!!!!!!!

\typeout{BEFORE: \the\catcode`\^}
\usepackage{gb4e}
\typeout{AFTER: \the\catcode`\^}

\begingroup
% Temporarily change catcodes
  \catcode`\_=\active
  \catcode`\^=\active
  \makeatletter

% redefine \automath

\gdef\automath{%
    \catcode`\_=\active
    \catcode`\^=\active
    \def\automath@sub##1%
      {\gb@ifnextchar^{\automath@two_{##1}}{\ensuremath{\sb{##1}}}}%
    \def\automath@sup##1%
      {\gb@ifnextchar_{\automath@two^{##1}}{\ensuremath{\sp{##1}}}}%
    \def_{\ifzzz@ininput\string_\else\expandafter\automath@sub\fi}%
    \def^{\ifzzz@ininput\string^\else\expandafter\automath@sup\fi}%
    }

\endgroup

% patch LaTeX
\makeatletter
\newif\ifzzz@ininput
% but this will not have the characters active during file input
% \let\zzz@iinput\@iinput
% \def\@iinput#1{\zzz@ininputtrue\zzz@iinput{#1}\zzz@ininputfalse}

% thus we proceed rather this way:
\long\def \InputIfFileExists#1#2{\zzz@ininputtrue
    \IfFileExists{#1}%
    {#2\@addtofilelist{#1}\zzz@ininputfalse\@@input \@filef@und}}

\makeatother

\automath

% check this does work:
\listfiles

\begin{document}

a_b

\input {name_with^underscore^and_caret.tex}

a_b

\end{document}

enter image description here

enter image description here

|improve this answer|||||
  • the toggle is not reset if we try to input a non-existing file. Thus use it only or existing files. (we can patch more, naturally) – user4686 Oct 20 '16 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.