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.

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

Possible Duplicate:
Getting those %#!^& signs in the footnote!

Here's my first version of a clever command for URL-footnotes. It combines pdftex's hyperlink behaviour with a \footnote displaying the URL.

\newcommand{\hrefn}[2]{\href{#1}{#2}\footnote{See {\tt #1}}} %HyperRef and Footnote in one

However it doesn't treat the input as verbatim as \href does. How do I prevent my command \hrefn from treating characters such as # and ~ as special control characters? I already \usepackage{underscore} so _ are not a problem.


share|improve this question

migrated from stackoverflow.com Apr 12 '11 at 10:45

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Martin Scharrer Apr 12 '11 at 11:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Put a \ in front of the character you want to be preserved. – alexy13 Apr 12 '11 at 10:34
up vote 2 down vote accepted

The url package has a command \urldef which allows you to define robust verbatim URLs that can be used in footnotes.

Also, since you’re using LaTeX, you shouldn’t be using \tt – use \ttfamily or \texttt instead.

share|improve this answer
Great answer! Thanks! – Nordlöw Apr 13 '11 at 6:46

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