I have the following:


    & \lim_{x \to 2} f(x)

This results in the following two errors:

LaTeX Error: \begin{examplebox} on input line 47 ended by \end{document}.
LaTeX Error: \begin{flalign*} on input line 47 ended by \end{examplebox}

The environment works fine if I put the flalign in the environment everytime I \begin it. However, I want this to be in a \newenvironemnt because I want to add styling around it and have it be easily reproducable every time I need it. Additionally, I have not decided a style for it because I am focuing more on the content of my document, so I want to be able to change it once and have it change all instances of it.

Is there any particular reason for this error, or is this just a restriction of flalign. If it is a restriction, then are there are alternatives for it?


1 Answer 1


It's a common problem with amsmath alignments. You might do

  % do something with #1

but it's simpler to use ltcmd (formerly xparse):

  % do something with #1
  • This works perfectly, thank you! May I ask what the "mb" means and how I might go about a third (with the second being optional) argument?
    – Eshy
    Apr 3 at 10:39
  • @Eshy m means a mandatory argument, b means the environment's content. See texdoc usrguide.
    – egreg
    Apr 3 at 10:41
  • I understand, thank you for your help!
    – Eshy
    Apr 3 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .