I'm trying to create a command that accepts two lists using the \listofitems package where the first list is optional.
In the command I want to check if the first entry in the optional list is "blank", which according to the \listofitems documentation means it is either "empty or spaces". The default value for my optional list "\opt" is [ , -, -]. So from what I understand the first entry would be: " " so it would be blank. However, both \ifblank and \notblank seem to be reading as something else? Maybe?
I'm at a loss, here is some code demonstrating what I'm talking about:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{listofitems}
\newcommand{\myCommand}[2][ , -, -]{
\setsepchar{, }
\readlist\opt{#1}
\readlist\args{#2}
\noindent Using $\backslash$ifblank: \\
\ifblank{\opt[1]}{$\backslash$opt[1] is blank!}{$\backslash$opt[1] is not blank! Here it is: "\opt[1]"} \\ \\
Using $\backslash$notblank: \\
\notblank{\opt[1]}{$\backslash$opt[1] is not blank! Here it is: "\opt[1]"}{$\backslash$opt[1] is blank!} \\ \\
Test of $\backslash$ifblank: \\
\ifblank{ }{yep.}{nope.} \\
Test of $\backslash$notblank: \\
\notblank{ }{nope.}{yep.}
}
\begin{document}
\myCommand{blah, blah}
\end{document}
\ifx
. The reccomended solution involves\detokenize
and\relax
(see tex.stackexchange.com/questions/108518/… for example).