Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Somehow there is a strange conflict with the svn package and the titling package. The following code gives me an error on TeXLive 2010 (but on an old TeX distribution at my work computer, it compiles just fine).

\documentclass{article}
\usepackage{titling}
\usepackage{svn}

\SVN $Date: 2011-05-06 20:57:26 +0100 (Fri, 06 May 2011) $
\date{\SVNDate}

\title{tesT}
\author{Test}

\begin{document}
\maketitle
\end{document}

When I try to build it, I get hit with a problem with input stack size

This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, pi
nyin, bulgarian, russian, ukrainian, ukenglish, usenglishmax, basque, french, l
oaded.
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/titling/titling.sty)
(/usr/share/texmf-dist/tex/latex/svn/svn.sty)
! TeX capacity exceeded, sorry [input stack size=5000].
\GenericError ->\protect 
                         \GenericError  
l.6 \date{\SVNDate}

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.

The problem goes away if either

  • I don't use the titling package
  • If I don't actually use a real SVN Date. That is, if the SVN line is replaced by just \SVN $Date$

Any ideas? Any more information I should include? (I'm also not sure what tags to use for this question.)


Edit If I increase the stack_size in texmf.cnf, the error becomes

! TeX capacity exceeded, sorry [parameter stack size=14000].
\PackageError #1#2#3->
                      \GenericError {(#1)\@spaces \@spaces \@spaces \@spaces...
l.6 \date{\SVNDate}
share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

As the svn manual states in section 2.5 Known Issues the flexibility of \SVNDate to change its format e.g. when the language is changed does not allow its usage inside an expanded context (e.g. \edef). It is therefore defined to create an error message if it is used inside \edef. I'm personally not sure if this is a wise design decision. Defining \SVNDate as a robust macro would be a better idea. Now the titling package uses \protected@xdef which seems to cause an endless loop while expanding the error message.

This error can be avoided by ensuring that \SVNDate isn't expanded by \date. This can be done by the usual \protect, the plain \noexpand or, if this is required more often, by redefining \SVNDate to be robust:

\date{\noexpand\SVNDate}
% or
\date{\protect\SVNDate}
% or
\usepackage{etoolbox}
\robustify\SVNDate
\date{\SVNDate}
% or
\protected\expandafter\def\expandafter\SVNDate\expandafter{\SVNDate}
\date{\SVNDate}
share|improve this answer
    
Thanks for your answer. This explains everything. –  Willie Wong May 7 '11 at 20:39
add comment

The problem is that titling redefines \date so it can be used again. The redefinition is in the following code:

\appendiargdef{\date}{%
  \begingroup
    \renewcommand{\thanks}[1]{}
    \renewcommand{\thanksmark}[1]{}
    \renewcommand{\thanksgap}[1]{}
    \protected@xdef\thedate{#1}
  \endgroup}

As a workaround, you could comment out this code although you would lose the reuse of date.)

Perhaps someone with more knowledge than me can propose an actual solution.

share|improve this answer
add comment

After a bit more experimenting, apparently a sufficient work around is to protect the argument to the new \date command

 \date{\protect\SVNDate}

So far it works, but I don't know if it has any side-effects or if it is bad practice.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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