Quantcast
Channel: Question and Answer » programming
Viewing all articles
Browse latest Browse all 103

Using multline or equation based on a boolean flag

$
0
0

I am trying to define a new environment myeq which can either be an equation or a multline. My use case is that in the preamble, I will define myeq to be either replicate the functionaly of equation or multline and then the actual document will only contain myeq environments so that by changing the definition in the preamble, it is possible to get the spacing characteristics either of mutline or of equation.

In particular, this requires that I have to define myeq to simply replicate multline, as follows:

newenvironment{myeq}{begin{multline}}{end{multline}}

However, this produces the following error (see MWE below)

begin{multline} on input line 8 ended by end{myeq}.

The error disappears if I replace the multline in the definition of myeq by equation.

MWE:

documentclass{article}
usepackage{amsmath}
newenvironment{myeq}{begin{multline}}{end{multline}}

begin{document}
begin{myeq}
  t
end{myeq}
end{document}

Viewing all articles
Browse latest Browse all 103

Latest Images

Trending Articles



Latest Images