3

I'm writing a file which I need the equations inside the gather environment to not be numbered. I was able to see the normal version (this answer, which works great:

\newenvironment{Lgather}{\useshortskip\leavevmode\vspace*{-\baselineskip}\fleqn\gather}{\endgather\endfleqn}  

But when I try to create the starred version, so the equations will not be numbered (that 1.1, 1.2... thing), it fails:

\newenvironment{Lgather}{\csname \useshortskip\leavevmode\vspace*{-\baselineskip}\fleqn\gather*\endcsname}{\csname \endgather*\endfleqn \endcsname}

I even tried

\newenvironment{Lgather}{\useshortskip\leavevmode\vspace*{-\baselineskip}\fleqn\gather*}{\endgather*\endfleqn} 

But it also fails...

Thank you very, very much in advance!

3
  • 1
    Welcome to TeX.SE.
    – Mico
    Sep 26, 2020 at 20:37
  • 1
    Which kind of sorcerer are you, sir? Works perfectly. Super nice and clean. Thank you very, very much! Sep 26, 2020 at 20:49
  • Environments are always expanded using \csname ...\endcsname, so including a * in the name is legal. In other words, use \newenvironment{Lgather*}{...}{...} with a completely different definition. Sep 27, 2020 at 17:01

2 Answers 2

3

Since you don't require equation numbering, you might employ a gathered environment.

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\noindent
The following conditions are true:
\begin{enumerate}
\item $\begin{gathered}[t]
       x^2 \ge 0 \\
       x^2-y^2 \le 0 
       \end{gathered} $
\end{enumerate}
\end{document}

If you have lots of instances of such gathered environments, you may want to simplify the process of entering them by setting up a macro, say,

\newcommand{\Lgather}[1]{\ensuremath{\begin{gathered}[t] #1 \end{gathered}}}

and then entering the equations as follows:

\Lgather{x^2 \ge 0 \\ x^2-y^2 \le 0} 
1
  • 1
    Beautiful. Absolutely beautiful. Yes, I am doing an math exercises pdf and I will use this command over and over again. It gets much, much better. Thank you! Sep 26, 2020 at 20:51
2

One can deduce it from the \meaning\gather, but substituting \st@arredtrue for \st@rredfalse.

\documentclass{article}
\usepackage{amsmath,nccmath}
\begin{document}
\makeatletter
\newenvironment{Lgather}{\useshortskip\leavevmode
   \vspace*{-\baselineskip}\fleqn\start@gather\st@rredtrue}
  {\endgather\endfleqn}
\makeatother
\begin{Lgather}
a =1\\
b=2\\c=3
\end{Lgather}

\meaning \gather
\end{document}

enter image description here

2
  • Very clever this idea of using this \st@arredtrue. Going to save this for next environments where I need the starred version. Thank you very much! Sep 26, 2020 at 21:02
  • @BrunoAndrade I can't guarantee it will work in other circumstances, but perhaps across the amsmath environments. In any event, remember \meaning to explore such things. Sep 26, 2020 at 21:20

You must log in to answer this question.

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