I want to redefine an environment that include the environment alignat*.

I discovered that I can't do that :

{  \paragraph{Variables :}

\begin{alignat*}{2} }
{  \end{endalignat*} }

so the solution I found is to use the command \alignat but this way, the equations are numebered and I won't.

{  \paragraph{Variables :}

\alignat*{2} }
{  \endalignat* }

So how can I do to include \alignat* in my new environment keeping the star ?


Why define \foo? May be I missed something but you can inglude \csname inside the definitions

  {\paragraph{Variables :}
   \csname alignat*\endcsname{2}}
  {\csname endalignat*\endcsname}
  • hmm actually you can (so +1:-) although it's less efficient in both space and time, although I was thinking when I wrote it that the environment detection trickery that the ams alignments do would require the command token exposed, but I think you're right that isn't actually needed here. Oct 11 '14 at 22:38
  • @DavidCarlisle I think this has been the first tick I've borrowed from someone.
    – Manuel
    Oct 12 '14 at 13:22
  • Beware, keep doing that and you'll turn into egreg, you wouldn't want that:-) Oct 12 '14 at 14:49

\csname endalignat*\endcsname expands to the command \endalignat* that you can't normally type. So \foo here is a helper macro that makes the environment definition that you intended except that the command names are passed as arguments #1 and #2, then \expandafter is used to make the command names socthe construction is the same as


but with * interpreted as part of the command name, as if it were a letter.



{\paragraph{Variables :}
  \csname alignat*\expandafter\endcsname
  \csname endalignat*\endcsname



  • Can you explain how does it work please ?
    – Saroupille
    Oct 11 '14 at 10:18
  • @Saroupille added some notes:-) Oct 11 '14 at 11:02
  • Ok thanks ! I just don't understand the \expandafter command. If we don't use it, what happens ?
    – Saroupille
    Oct 11 '14 at 11:11
  • @Saroupilleif you don't use it then it doesn't work:-) there is probably an answer on site explaining \expandafter I'll post a link Oct 11 '14 at 11:14
  • 1
    @egreg yes, I know, but I thought that would look even more weird (and is specific to those environments:-) Oct 11 '14 at 22:34

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.