Comparing the "job name"

The token \jobname amusingly produces a sequence of characters whose category code is 12 (“other”), regardless of what the characters actually are. Since one inevitably has to compare a macro with the contents of another macro (using \ifx, somewhere) one needs to create a macro whose expansion looks the same as the expansion of \jobname. We find we can do this with \meaning, if we strip the “\show command” prefix.

The full command looks like: <!– {% raw %} –

>

snippet.latex
\def\StripPrefix#1>{}
\def\jobis#1{FF\fi
\def\predicate{#1}%
\edef\predicate{\expandafter\StripPrefix\meaning\predicate}%
\edef\job{\jobname}%
\ifx\job\predicate
}

<

!– {% endraw %} –

>

A

nd it's used as:

snippet.latex
\if\jobis{mainfile}%
\message{YES}%
\else
\message{NO}%
\fi

Note that the command \StripPrefix need not be defined if you're using LaTeX - there's already an internal command \strip@prefix that you can use.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Creative Commons Lizenzvertrag Edit this page Old revisions Sitemap Backlinks RSS feed Impressum Flattr this