0

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}
  • 1
    unrelated to the question but never do 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
  • I write this for help to understand – Andrey Vinajera May 04 '18 at 15:31
  • Just so others can make the link more quickly a link to your related earlier question: https://tex.stackexchange.com/q/430029/35864 – moewe May 04 '18 at 15:35
  • 1
    Your problem here is that in the context of \ifstrequal the string monday and the macro \dayone which expands to monday are 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
  • 3
    Maybe consider to accept helpful answers. You have some questions with answers. – Dr. Manuel Kuehner May 04 '18 at 16:04

0 Answers0