I'm using LaTeX to write manuscripts for plays, I've been looking a bit into conditional expressions. The reason is that I want comments in the manus, and I currently have two different commands for this: One for when in an itemize, and one for when not.

Is it possible to have an if/else, so that I don't need two commands?


You can check for the value of \@currenvir:




  \item Now we are \ifinitemize{in an itemize environment}{somewhere else}

Now we are \ifinitemize{in an itemize environment}{somewhere else}


enter image description here

I created a conditional command that executes the first or the second braced argument depending on the value of \@currenvir. This will not work, for example, if you nest some other environment inside the itemize because the value of \@currenvir will be updated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.