[OS X TeX] Stack size limit error with hyperref

Ross Moore ross at ics.mq.edu.au
Fri Mar 25 08:01:30 CET 2005


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                                         ross at maths.mq.edu.au
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:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list