I want in following examaple change the day of week according the inputted day. When I use dia in the document work, but when I use inside newcommand doesnt (look the example)
\documentclass{article}
\usepackage{etoolbox}
\makeatletter
\def\dia#1{\ifstrequal{#1}{monday}{thuesday}{something}}
\makeatother
\newcommand{\dayone}{monday}
\newcommand{\daytwo}{\dia{\dayone}}
\def\daytwo{\dia{\dayone}}
\begin{document}
If variable dayone is monday the resul must be thuesday, and is \daytwo \\
But if I use dia the result is correct.\\
\dia{monday}\\
\dia{asdasd}\\
\end{document}
But if I use dia the result is correct.\\you get poor output and tex warns about underfull hbox with maximum (10000) measure of badness. – David Carlisle May 04 '18 at 15:18\ifstrequalthe stringmondayand the macro\dayonewhich expands tomondayare two different things. So "\dayone!=monday". What you need to do here is to unpack (in TeX lingo: expand) the definition before you compare the string. – moewe May 04 '18 at 16:02