My question is originally the same as use jobname to "pass parameters"?
But that particular question doesn't seem to have a complete answer. (I'm sure that in the minds of experts who deeply know the issue, it is solved.)
Looking at a few other related threads,
How can I check if the filename of a LaTeX document contains a string?
\jobname, character codes and \detokenize
I've been able to largely solve my original question using \IfSubStringInString
but not using \ifdefstring
. See the example code below.
% run this with pdflatex -jobname=hello thissourcecode.tex
\documentclass{article}
\usepackage{etoolbox}
\usepackage{substr}
\begin{document}
jobname is: ``\jobname''.
% The following gives "true"
\IfSubStringInString{\detokenize{hello}}{\jobname}{substr true}{substr false}
% The following gives "false"
\ifdefstring{\detokenize{hello}}{\jobname}{etoolbox true}{etoolbox false}
\end{document}
The solution with \IfSubStringInString
isn't bad at all, except that the package doesn't seem to include a command for exact match. I'd also love to get \ifdefstring
to work with \jobname
.