I have a document where I would like to put the jobname into the footer with the \jobname macro. However, if my main file has underscores in its file name, the jobname cannot be printed properly due to the underscore. How can I tell LaTeX to automatically escape any special characters in the jobname?
Asked
Active
Viewed 764 times
1
T. Pluess
- 1,040
1 Answers
4
I tend to use \path from the url package, though you need to expand \jobname first
\expandafter\path\expandafter{\jobname}
Controlling the font of \path (it is tt by default) can be done by making a custom \path command, see the source of url.sty
-
-
Controlling? Or is controling American usage? (I don't want to change it if it is correct American.) – cfr Feb 04 '17 at 03:31
-
\jobnameare not math subscript characters and should not give an error. If you are getting errors please show code that reproduces the problem. – David Carlisle Feb 03 '17 at 08:43\usepackage[T1]{fontenc}might be enough. – campa Feb 03 '17 at 08:49\pathfrom theurlpackage for this, in this case try\expandafter\path\expandafter{\jobname}– daleif Feb 03 '17 at 12:34