4

When typesetting a file (using TeXworks on a Windows machine) which includes white spaces, then the jobname will contain the file name enclosed with double quotes. pdflatex Local\ Guide.tex will set jobname to "Local Guide" and currfilename to "Local Guide".tex.

This is somewhat undesirable for me. Is there any way to eliminate the quotation marks? My corporate design requires the file name to appear in the page footer -- including the file extension .tex but excluding the quotes.

0

1 Answer 1

6

The quotes are (or should be) balanced 'behind the scenes'. Thus we can just strip off a set, for example

\documentclass{article}
\newcommand*{\myjobname}{}
\newcommand*{\setmyjobname}{%
  \edef\myjobname{\jobname}%
  \expandafter\expandafter\expandafter\setmyjobnameaux
    \expandafter\myjobname\expandafter"\myjobname"\relax
}
\newcommand*{\setmyjobnameaux}{}
\def\setmyjobnameaux#1"#2"#3\relax{\def\myjobname{#2}}
\setmyjobname
\begin{document}
[\jobname][\myjobname]
\end{document}

The idea here is that "#2" will match the 'real' name whether or not there were any quotes around the original name. We can't change \jobname (or rather we can't change the internal data which it uses), so I've called the 'simplified' value a different name. That also avoids the case where something else uses \jobname and does need the quotes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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