2

I'm writing a paper using a cls file provided by the journal (which I cannot modify). They are using some tricky code for creating table notes under tables. Problem is that this code crashes under my MacPorts version of TeX Live (while working fine on a colleague's linux machine) with the following message:

! TeX capacity exceeded, sorry [input stack size=5000].
\font@name ->
             \OMS/cmr/m/n/12

I've tried modifying texmf.cnf by increasing stack size, that doesn't fix the problem.

I'm not quite good in understanding the original code, but after some reverse engineering I was able to compose a MWE:

\documentclass[a4paper,12pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdftex,unicode]{hyperref}
\makeatletter

\newcounter{mycount}

\newcommand\thecounter{\fnsymbol{mycount}}%
\gdef\MyPrint{}

\def\MyAdd#1#2{%
  \g@addto@macro\MyPrint{
    \refstepcounter{mycount}%
    \xdef\@currentlabel{\thecounter}%
    \label{#1}%
    \thecounter #2
    }%  
}


\begin{document}
\MyAdd{l1}{Hello}
\MyAdd{l2}{World}

My\ref{l1} print\ref{l2}:
\MyPrint
\end{document}

If I replace

\xdef\@currentlabel{\thecounter}%

with

\def\@currentlabel{\thecounter}%

everything works fine and I even get the correct result: Result

Another thing that fixes the problem is replacing

\newcommand\thecounter{\fnsymbol{mycount}}%

with

\newcommand\thecounter{\arabic{mycount}}%

(or with \roman or \Roman)

Here's the full output of pdflatex -version:

pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/MacPorts 2015_6)
kpathsea version 6.2.1
Copyright 2015 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.6.18; using libpng 1.6.18
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with poppler version 0.37.0

Is this a bug or is something missing from my TeX Live installation?

UPD1. Output from \listfiles:

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size12.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
 fontenc.sty
  t2aenc.def    2005/09/27 v1.0i Cyrillic encoding definition file
  t2acmr.fd    2001/08/11 v1.0a Computer Modern Cyrillic font definitions
inputenc.sty    2015/03/17 v1.2c Input encoding file
    utf8.def    2014/09/29 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2014/09/29 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2014/09/29 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2014/09/29 v1.1m UTF-8 support for inputenc
  t2aenc.dfu    2014/09/29 v1.1m UTF-8 support for inputenc
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/05/28 v1.13 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/05/28 v1.13 Construct package bundles (HO)
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2012/05/28 v1.2 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO)
    test.out
    test.out
  omscmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
 ***********
  • Ideally we'd have the versions for the files you are using (add \listfiles to you input), rather than the rather vague TeX system description. Luckily, here I can see the issue .... – Joseph Wright Nov 13 '15 at 18:52
  • @JosephWright just in case I updated the OP with the \listfiles output – SiLiKhon Nov 13 '15 at 19:11
4

The LaTeX team recently (start of 2015) integrated the fixltx2e package into the kernel. There are a small number of places where this may cause issues, primarily where people have relied on problematic behaviour. Here, the class is relying on the expansion safety of \thecounter (or rather of the code to make footnote symbols), which it should not do. The code should be

\def\MyAdd#1#2{%
  \g@addto@macro\MyPrint{
    \refstepcounter{mycount}%
    \protected@xdef\@currentlabel{\thecounter}% Change here
    \label{#1}%
    \thecounter #2
    }%  
}

Of course, for a fixed class you can't alter that. What you can do is back out the kernel changes by adding

\RequirePackage[2014/12/31]{latexrelease}

right at the start of you document (before \documentclass). This will undo all changes to LaTeX since the end of 2014 and so will allow you to compile.

  • Thanks for the answer. The "protected" thing does work indeed, while "RequirePackage" doesn't seem to have any effect... – SiLiKhon Nov 13 '15 at 19:05
  • @SiLiKhon It really should: with your example adding that line works fine for me (I have a very up-to-date TeX system). – Joseph Wright Nov 13 '15 at 19:10
  • Can it be Mac Port issue at this point? :) I've tried feeding in different dates, tried placing this line in different places, nothing changes. Although I do get some warnings when requesting 0000/00/00... – SiLiKhon Nov 13 '15 at 19:33
  • 1
    @SiLiKhon It could be a file version issue: if you add latexrelease to your document, what does it show for the date/version in \listfiles? – Joseph Wright Nov 13 '15 at 19:50
  • For latexrelease.sty it has "latexrelease.sty 2015/05/09 v1.0d LaTeX release emulation and tests", all the other files are same as in the OP – SiLiKhon Nov 14 '15 at 0:10

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.