Stack size limit error with hyperref

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Richard Seguin
I'm trying to typeset a 75 page document using the hyperref package,
and I'm getting this error message:

! TeX capacity exceeded, sorry [input stack size=5000].

Is the hyperref package a stack hog? Is this normal on a
less-than-book-size 75 page document? How can the stack size be
increased?

The log file says:

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


Here is how much of TeX's memory you used:
  5745 strings out of 95321
  73014 string characters out of 1187504
  280885 words of memory out of 1707396
  8415 multiletter control sequences out of 10000+50000
  23533 words of font info for 99 fonts, out of 1000000 for 2000
  14 hyphenation exceptions out of 1000
  5000i,14n,5024p,2518b,466s stack positions out of
5000i,500n,6000p,200000b,40000s
  800 PDF objects out of 300000
  290 named destinations out of 131072
  1617 words of extra memory for PDF output out of 65536
!  ==> Fatal error occurred, the output PDF file is not finished!

This is the list of packages I'm using:

\documentclass[11pt,psamsfonts,oneside]{article}
\usepackage{amssymb,amsmath,latexsym,amsthm}
\usepackage{verbatim}
\usepackage{eucal}
\usepackage{mathrsfs}
\usepackage[all]{xy}
\usepackage{bm}
\usepackage{enumerate}
\usepackage{hyperref}

Richard S?guin

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Ross Moore
Hi Richard,


On 24/03/2005, at 3:33 PM, Richard Seguin wrote:

> I'm trying to typeset a 75 page document using the hyperref package,
> and I'm getting this error message:
>
> ! TeX capacity exceeded, sorry [input stack size=5000].

This usually indicates that an infinite loop has developed.
I've seen this before with hyperref, particularly with
special characters (such as '~') used incorrectly within a URL.


I'd guess that you have defined a macro that expands to
something containing a '~' (or perhaps '#' or '&'),
then tried to use this as the URL part of an \href
or similar command.

That cannot work. There are ways around this.



>
> Is the hyperref package a stack hog? Is this normal on a
> less-than-book-size 75 page document? How can the stack size be
> increased?
>
> The log file says:
>
> If you really absolutely need more capacity,
> you can ask a wizard to enlarge me.
>
>
> Here is how much of TeX's memory you used:
>  5745 strings out of 95321
>  73014 string characters out of 1187504
>  280885 words of memory out of 1707396
>  8415 multiletter control sequences out of 10000+50000
>  23533 words of font info for 99 fonts, out of 1000000 for 2000
>  14 hyphenation exceptions out of 1000
>  5000i,14n,5024p,2518b,466s stack positions out of
> 5000i,500n,6000p,200000b,40000s
>  800 PDF objects out of 300000
>  290 named destinations out of 131072
>  1617 words of extra memory for PDF output out of 65536
> !  ==> Fatal error occurred, the output PDF file is not finished!
>
> This is the list of packages I'm using:
>
> \documentclass[11pt,psamsfonts,oneside]{article}
> \usepackage{amssymb,amsmath,latexsym,amsthm}
> \usepackage{verbatim}
> \usepackage{eucal}
> \usepackage{mathrsfs}
> \usepackage[all]{xy}
> \usepackage{bm}
> \usepackage{enumerate}
> \usepackage{hyperref}


I need to see more of your LaTeX source to identify the
exact problem.


>
> Richard S?guin
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:[hidden email]>
>


Hope this helps,

        Ross

>
>
>
------------------------------------------------------------------------
Ross Moore                                         [hidden email]
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Richard Seguin
Ross,

Thanks, you got me on the right track! It turns out that hyperref does  
not like to see a \bm command inside of a section name. It also crashes  
with a \boldsymbol, but not with a \mathbf, although the \mathbf  
doesn't seem to do anything within a section name.

I'm using the article class, and section names are typeset in bold.  
When there is a $...$ string embedded in the section name, it is not  
set in bold and it doesn't look good. The \bm command used within the  
$...$ string, for example $\bm{\beta T}$, corrects this.  
\tableofcontents does not seem to have a problem with this, but  
hyperref crashes.

So how do I get the $...$ string to be typeset in bold within the  
section name, consistent with the rest of the name, and not crash  
hyperref?

  Richard S?guin

On Mar 24, 2005, at 1:13 AM, Ross Moore wrote:

> Hi Richard,
>
>
> On 24/03/2005, at 3:33 PM, Richard Seguin wrote:
>
>> I'm trying to typeset a 75 page document using the hyperref package,  
>> and I'm getting this error message:
>>
>> ! TeX capacity exceeded, sorry [input stack size=5000].
>
> This usually indicates that an infinite loop has developed.
> I've seen this before with hyperref, particularly with
> special characters (such as '~') used incorrectly within a URL.
>
>
> I'd guess that you have defined a macro that expands to
> something containing a '~' (or perhaps '#' or '&'),
> then tried to use this as the URL part of an \href
> or similar command.
>
> That cannot work. There are ways around this.
>
>
>
>>
>> Is the hyperref package a stack hog? Is this normal on a  
>> less-than-book-size 75 page document? How can the stack size be  
>> increased?
>>
>> The log file says:
>>
>> If you really absolutely need more capacity,
>> you can ask a wizard to enlarge me.
>>
>>
>> Here is how much of TeX's memory you used:
>>  5745 strings out of 95321
>>  73014 string characters out of 1187504
>>  280885 words of memory out of 1707396
>>  8415 multiletter control sequences out of 10000+50000
>>  23533 words of font info for 99 fonts, out of 1000000 for 2000
>>  14 hyphenation exceptions out of 1000
>>  5000i,14n,5024p,2518b,466s stack positions out of  
>> 5000i,500n,6000p,200000b,40000s
>>  800 PDF objects out of 300000
>>  290 named destinations out of 131072
>>  1617 words of extra memory for PDF output out of 65536
>> !  ==> Fatal error occurred, the output PDF file is not finished!
>>
>> This is the list of packages I'm using:
>>
>> \documentclass[11pt,psamsfonts,oneside]{article}
>> \usepackage{amssymb,amsmath,latexsym,amsthm}
>> \usepackage{verbatim}
>> \usepackage{eucal}
>> \usepackage{mathrsfs}
>> \usepackage[all]{xy}
>> \usepackage{bm}
>> \usepackage{enumerate}
>> \usepackage{hyperref}
>
>
> I need to see more of your LaTeX source to identify the
> exact problem.
>
>
>>
>> Richard S?guin
>>
>> --------------------- Info ---------------------
>> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>>           & FAQ: http://latex.yauh.de/faq/
>> TeX FAQ: http://www.tex.ac.uk/faq
>> List Post: <mailto:[hidden email]>
>>
>
>
> Hope this helps,
>
> Ross
>
>>
>>
>>
> -----------------------------------------------------------------------
> -
> Ross Moore                                         [hidden email]
> Mathematics Department                             office: E7A-419
> Macquarie University                               tel: +61 +2 9850  
> 8955
> Sydney, Australia                                  fax: +61 +2 9850  
> 8114
> -----------------------------------------------------------------------
> -
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:[hidden email]>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Will Robertson-2
On 25 Mar 2005, at 2:53 PM, Richard Seguin wrote:

> So how do I get the $...$ string to be typeset in bold within the
> section name, consistent with the rest of the name, and not crash
> hyperref?

Hi Richard

The problem here is that section commands, by rights, should not
contain formatting commands because they well may be used in other
parts of the document (running headers and the table of contents,
specifically). Any formatting you desire should be declared by
redefining the article class's \section command or by using one of the
various packages to do so.

In this case, I've just copy/pasted the definition from article.cls,
changed \newcommand to \renewcommand, and added \boldmath to the end of
the font command. \boldmath is to maths what \bfseries is to text, in
case you haven't seen it before. Unfortunately the Table of Contents
makes a similar oversight and we need to patch that up as well in
exactly the same way.

Best of luck,
Will Robertson

\documentclass{article}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                      {-3.5ex \@plus -1ex \@minus -.2ex}%
                                      {2.3ex \@plus.2ex}%
                                     
{\normalfont\Large\bfseries\boldmath}}
\renewcommand*\l@section[2]{%
   \ifnum \c@tocdepth >\z@
     \addpenalty\@secpenalty
     \addvspace{1.0em \@plus\p@}%
     \setlength\@tempdima{1.5em}%
     \begingroup
       \parindent \z@ \rightskip \@pnumwidth
       \parfillskip -\@pnumwidth
       \leavevmode \bfseries\boldmath
       \advance\leftskip\@tempdima
       \hskip -\leftskip
       #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
     \endgroup
   \fi}
\makeatother
\usepackage{amsmath,bm,hyperref}
\begin{document}
\tableofcontents
\section{No problem: $\int^{2\pi}_0\cos\theta\,\mathrm{d}\theta=0$}
Now in running text: $\int^{2\pi}_0\cos\theta\,\mathrm{d}\theta=0$.
\end{document}

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Ross Moore
In reply to this post by Richard Seguin
Hi Richard,

On 25/03/2005, at 3:23 PM, Richard Seguin wrote:

> Ross,
>
> Thanks, you got me on the right track! It turns out that hyperref does
> not like to see a \bm command inside of a section name. It also
> crashes with a \boldsymbol, but not with a \mathbf, although the
> \mathbf doesn't seem to do anything within a section name.

You are...

> I'm using the article class, and section names are typeset in bold.
> When there is a $...$ string embedded in the section name, it is not
> set in bold and it doesn't look good. The \bm command used within the
> $...$ string, for example $\bm{\beta T}$, corrects this.
> \tableofcontents does not seem to have a problem with this, but
> hyperref crashes.

    ... making bookmarks, yes ?

>
> So how do I get the $...$ string to be typeset in bold within the
> section name, consistent with the rest of the name, and not crash
> hyperref?

While I agree with the sentiments expressed by Will concerning
formatting commands within section-titles, there is in fact
a way to avoid the difficulties that you are encountering,
without editing .sty files.


First of all, let's try to understand what is going on.

To make a bookmark from your section's title,  hyperref  needs
to construct a string that will be displayed in the 'Bookmarks'
window of the PDF browser. This requires expanding all macros
that occur in the section-title.

However, it is just trying to get the correct text to display,
and does not care about styles or spacing. Those aspects are
all pre-determined, and only standard characters are allowed.
Thus the \bm is quite irrelevant, yet still needs to be
expanded, as it might (but doesn't) contain characters.
The infinite loop occurs because some things in the expansion
of \bm occur within a quite different context from what it was
designed to handle.


So the best thing to do is to give \bm a temporary expansion
of nothing (i.e., the empty string), at the critical time when
the expansion occurs for constructing the bookmark's anchor-text.


There is a standard mechanism in  hyperref.sty  to do just this:

      \pdfstringdefDisableCommands{\def\bm{}\def\beta{ beta }}

Note that pdfTeX doesn't yet know how to put a real \beta
into the bookmark, so rather than get nothing, we put 'beta'
spelt out instead, and with some space around it.



As I've not had a chance to test your actual source coding,
this is just my best guess at what I think is going wrong
for you, and how to fix it --- based upon past experience
of similar problems, of course.
So if the above doesn't help, please send an explicit
example, cut down as much as possible.



>
>  Richard S?guin
>
> On Mar 24, 2005, at 1:13 AM, Ross Moore wrote:
>
>> Hi Richard,
>>
>>
>> On 24/03/2005, at 3:33 PM, Richard Seguin wrote:
>>
>>> I'm trying to typeset a 75 page document using the hyperref package,
>>> and I'm getting this error message:
>>>
>>> ! TeX capacity exceeded, sorry [input stack size=5000].
>>
>> This usually indicates that an infinite loop has developed.
>> I've seen this before with hyperref, particularly with
>> special characters (such as '~') used incorrectly within a URL.
>>
>>
>> I'd guess that you have defined a macro that expands to
>> something containing a '~' (or perhaps '#' or '&'),
>> then tried to use this as the URL part of an \href
>> or similar command.
>>
>> That cannot work. There are ways around this.


Hope this helps,

        Ross



------------------------------------------------------------------------
Ross Moore                                         [hidden email]
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114
------------------------------------------------------------------------

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Stack size limit error with hyperref

Richard Seguin
Ross,

Thanks, this works exactly as you described!

Richard

On Mar 25, 2005, at 1:01 AM, Ross Moore wrote:

> Hi Richard,
>
> On 25/03/2005, at 3:23 PM, Richard Seguin wrote:
>
>> Ross,
>>
>> Thanks, you got me on the right track! It turns out that hyperref  
>> does not like to see a \bm command inside of a section name. It also  
>> crashes with a \boldsymbol, but not with a \mathbf, although the  
>> \mathbf doesn't seem to do anything within a section name.
>
> You are...
>
>> I'm using the article class, and section names are typeset in bold.  
>> When there is a $...$ string embedded in the section name, it is not  
>> set in bold and it doesn't look good. The \bm command used within the  
>> $...$ string, for example $\bm{\beta T}$, corrects this.  
>> \tableofcontents does not seem to have a problem with this, but  
>> hyperref crashes.
>
>    ... making bookmarks, yes ?
>
>>
>> So how do I get the $...$ string to be typeset in bold within the  
>> section name, consistent with the rest of the name, and not crash  
>> hyperref?
>
> While I agree with the sentiments expressed by Will concerning
> formatting commands within section-titles, there is in fact
> a way to avoid the difficulties that you are encountering,
> without editing .sty files.
>
>
> First of all, let's try to understand what is going on.
>
> To make a bookmark from your section's title,  hyperref  needs
> to construct a string that will be displayed in the 'Bookmarks'
> window of the PDF browser. This requires expanding all macros
> that occur in the section-title.
>
> However, it is just trying to get the correct text to display,
> and does not care about styles or spacing. Those aspects are
> all pre-determined, and only standard characters are allowed.
> Thus the \bm is quite irrelevant, yet still needs to be
> expanded, as it might (but doesn't) contain characters.
> The infinite loop occurs because some things in the expansion
> of \bm occur within a quite different context from what it was
> designed to handle.
>
>
> So the best thing to do is to give \bm a temporary expansion
> of nothing (i.e., the empty string), at the critical time when
> the expansion occurs for constructing the bookmark's anchor-text.
>
>
> There is a standard mechanism in  hyperref.sty  to do just this:
>
>      \pdfstringdefDisableCommands{\def\bm{}\def\beta{ beta }}
>
> Note that pdfTeX doesn't yet know how to put a real \beta
> into the bookmark, so rather than get nothing, we put 'beta'
> spelt out instead, and with some space around it.
>
>
>
> As I've not had a chance to test your actual source coding,
> this is just my best guess at what I think is going wrong
> for you, and how to fix it --- based upon past experience
> of similar problems, of course.
> So if the above doesn't help, please send an explicit
> example, cut down as much as possible.
>
>
>
>>
>>  Richard S?guin
>>
>> On Mar 24, 2005, at 1:13 AM, Ross Moore wrote:
>>
>>> Hi Richard,
>>>
>>>
>>> On 24/03/2005, at 3:33 PM, Richard Seguin wrote:
>>>
>>>> I'm trying to typeset a 75 page document using the hyperref  
>>>> package, and I'm getting this error message:
>>>>
>>>> ! TeX capacity exceeded, sorry [input stack size=5000].
>>>
>>> This usually indicates that an infinite loop has developed.
>>> I've seen this before with hyperref, particularly with
>>> special characters (such as '~') used incorrectly within a URL.
>>>
>>>
>>> I'd guess that you have defined a macro that expands to
>>> something containing a '~' (or perhaps '#' or '&'),
>>> then tried to use this as the URL part of an \href
>>> or similar command.
>>>
>>> That cannot work. There are ways around this.
>
>
> Hope this helps,
>
> Ross
>
>
>
> -----------------------------------------------------------------------
> -
> Ross Moore                                         [hidden email]
> Mathematics Department                             office: E7A-419
> Macquarie University                               tel: +61 +2 9850  
> 8955
> Sydney, Australia                                  fax: +61 +2 9850  
> 8114
> -----------------------------------------------------------------------
> -
>
> --------------------- Info ---------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Post: <mailto:[hidden email]>
>
>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:[hidden email]>



Loading...