TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to to surface subversion revision numbers for use in the contents of my document. svninfo and svn packages rely on svn keyword substitution to accomplish this, but I get this error when I try it:

Error line 6 ! Missing $ inserted.

Here's the entire document that causes this:


\svnInfo $Id: doc.tex 8 2013-04-11 19:37:31Z User Name $ %<= Id keyword substituted by svn  


The usual suggested remedies for this error are to escape the $ like this: \$ However, no combination of escaped and non-escaped $ characters both avoids this error and has useful results.

How do I avoid this error and surface svn revision numbers?

share|improve this question
up vote 10 down vote accepted

The username may not have a space. this runs without error


\svnInfo $Id: doc.tex 8 2013-04-11 19:37:31Z UserName $ %<= Id keyword substituted by svn  


Since Windows user name allows spaces, you can let svnInfo allow them as well. this seems to work:

enter image description here


\def\@svnInfoCrackAndEat #1 #2 #3 #4 #5 #6 $ {\@svnEndRead
  \@svnInfoCrackString #2 #3 #4 #5 {#6} $ %

\svnInfo $Id: doc.tex 8 2013-04-11 19:37:31Z User Name $ %<= Id keyword substituted by svn  


share|improve this answer
@alx9r it may be worth asking the package maintainer to update the package with this patch to support spaces – David Carlisle Apr 11 '13 at 20:55
Thanks very much. That indeed works. I have sent an email linking here to the package maintainer. – alx9r Apr 11 '13 at 21:41

You have a space in the user name:

\svnInfo $Id: doc.tex 8 2013-04-11 19:37:31Z UserName $

should work

share|improve this answer
+1 (9 sec before my deleted answer:-) – David Carlisle Apr 11 '13 at 20:27
That's it. In case it helps someone else, the user name, complete with space, was lifted by ToroiseSVN from the underlying Windows 7 account. – alx9r Apr 11 '13 at 20:31
@alx9r ooh it would be easy enough to modify \svnInfo to allow a space sounds like that would be useful as svn is going to keep putting the space back? – David Carlisle Apr 11 '13 at 20:39
@DavidCarlisle Yes that would be very useful. All of the other workarounds I've found so far are pretty messy. – alx9r Apr 11 '13 at 20:44
@alx9r: User~Name should work – Herbert Apr 12 '13 at 5:56

Your Answer


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.