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.

I have a document I'm trying to render using two classes -- my university's dissertation .cls, and tufte-latex (my uni's styleguide is ugly, and I want to make a pretty-print version for my own gratification). I've written a shim for tufte-latex's \sidefig command, which reads like so:


This works, except in the case where I need to use \url inside \caption, to cite an image source, ie:

  \caption{This is the foobar graphic. Source: \url{http://foo.bar/baz} \label{fig:foobar}}

This renders fine through tufte-latex's own sidefig environment, but errors with the following error text using my shim.

[1] <graphics/foobar.png, id=34, 233.07076pt x 310.761pt>
<use graphics/foobar.png>
! Undefined control sequence.
\Url Error ->\url used in a moving argument. 

l.36 ...p://foo.bar/baz} \label{fig:foobar}}

Any idea how I can modify my shim environment to avoid this error?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Moving argument entries may require protection. In this case, use \protect\url{...}:

enter image description here

\usepackage{url}% http://ctan.org/pkg/url
  \caption{This is the foobar graphic. Source: \protect\url{http://foo.bar/baz} \label{fig:foobar}}
share|improve this answer

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.