Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the gather and align-aligned environments of amsmath package and I want to create a list inside them like the one created with the enumerate environment. How can I achieve that?

A MWE would be that:

\documentclass[12pt]{article}
\usepackage[top=0.3in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}

\setlength{\parindent}{0cm}

\usepackage[fleqn]{amsmath}
\usepackage{unicode-math}

\everymath{\displaystyle}

\newcommand{\3}{\vspace{0.3cm}}

\begin{document}

\begin{gather*}
\begin{aligned}
&x+y=0\\
&y+z=0\\
&z+x=0
\end{aligned}
\end{gather*}

\end{document}
share|improve this question
    
Don't use \everymath{\displaymath}. It's wrong and it will bite you some day. –  egreg May 11 at 21:44
    
@egreg I use it because in the past I was placing \displaystyle everywhere and this is helping very much. I like having this style everywhere. –  Adam May 11 at 21:47
    
It's wrong to be placing \displaystyle everywhere to begin with. –  egreg May 11 at 21:49
    
I understand that it might be wrong but I am not using it to produce a book or a paper. I use it for notes or for exercises that I want to read again so it helps me even though it might be wrong. –  Adam May 11 at 21:54

3 Answers 3

up vote 2 down vote accepted

I would recommend using an aligned within an enumaerated list

enter image description here

otherwise, you should really use the equation numbering built into align:

enter image description here


Alternatively, you can use a custom macro such as \Item below which increments a counter and add is its value before the equation to emulate sort of a enumerate type of environment. I am recommending you not use this as I am sure there are numerous problems with it, even though it appears to work for the test case given.

enter image description here


Code: Recommended

\documentclass{article}
\usepackage{amsmath}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}
\item $\begin{aligned}[t]
        \sin^2 \theta + \cos^2 \theta &= 1 \\
        F &= ma 
      \end{aligned}$
\item $\begin{aligned}[t]
        E &= mc^2 \\
        \sin^2 \theta + \cos^2 \theta &= 1
      \end{aligned}$
\end{enumerate}
%
\begin{align}
        \sin^2 \theta + \cos^2 \theta &= 1 \\
        F &= ma \\
        E &= mc^2 \\
        \sin^2 \theta + \cos^2 \theta &= 1
\end{align}
\end{document}

Code: `Custom "enumerate":

\documentclass[12pt]{article}
%\usepackage[top=0.3in, bottom=1.2in, left=0.8in, right=0.8in]{geometry}

%\setlength{\parindent}{0cm}

\usepackage[fleqn]{amsmath}

%\usepackage{unicode-math}
%\everymath{\displaystyle}
%\newcommand{\3}{\vspace{0.3cm}}

\newcounter{MyCounter}
\newcommand{\Item}{\refstepcounter{MyCounter}\theMyCounter\quad}
\renewcommand{\theMyCounter}{\arabic{MyCounter})}
\newcommand{\ResetMyCounter}{\setcounter{MyCounter}{0}}

\begin{document}

\begin{gather*}
    \begin{aligned}
        &x+y=0\\
        \Item &y+z=0\\
        \Item &z+x=0
    \end{aligned}
\end{gather*}
And in a subsequent set of equations  \emph{with} \verb|\ResetMyCounter|:
\ResetMyCounter% Comment this out if you wish the numbering to continue
\begin{gather*}
    \begin{aligned}
        &x+y=0\\
        \Item &y+z=0\\
        \Item &z+x=0
    \end{aligned}
\end{gather*}
And in a subsequent set of equations \emph{without} \verb|\ResetMyCounter|:
%\ResetMyCounter% Comment this out if you wish the numbering to continue
\begin{gather*}
    \begin{aligned}
        &x+y=0\\
        \Item &y+z=0\\
        \Item &z+x=0
    \end{aligned}
\end{gather*}
With a \verb|\renewcommand| to use non-numerical numbering:
\renewcommand{\theMyCounter}{\alph{MyCounter}.\quad}
\ResetMyCounter% Comment this out if you wish the numbering to continue
\begin{gather*}
    \begin{aligned}
        &x+y=0\\
        \Item &y+z=0\\
        \Item &z+x=0
    \end{aligned}
\end{gather*}
\end{document}
share|improve this answer
    
Athough these are good solutions they are not exactly helpful because I use a lot of consecutive blocks and the first solution would mean that I have to break the one gather into two and the second would suggest that all my equations should be numbered and not only a fraction of them. And I would like the number in front. –  Adam May 11 at 20:21
    
@Adam: It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem, and gives us something to work with. –  Peter Grill May 11 at 20:25
    
Ok sorry I didn't do that, I just thought that because this is a general question that anyone can check without a MWE, my code would only confuse. –  Adam May 11 at 20:27
    
@Adam: Ok, have provided an alternate - Like I mention in the solution, I am not recommending this approach, but this should get you started in the direction I think you want to go, –  Peter Grill May 12 at 5:56
    
Thank you I think that your second solution is what I was looking for. I will try it further to see if it suits me! –  Adam May 14 at 21:43

If I understand your comments to Peter Grill's answer, you want to label some (not all) of your equations and label them on the left. For the small example you give, I think this does roughly what you want, by using leqno in the documentclass and using align rather than aligned inside gather and setting \notag for lines you don't want to have a number.

However, there is probably some good reason why you can't use align or something, that is not clear from your question.

Also, I'm not sure how to get rid of the parentheses around the equation number label if you really want it to look like enumerate.

\documentclass[12pt,leqno]{article}

\usepackage[fleqn]{amsmath}


\begin{document}


\begin{align}
&x+y=0 \\
\intertext{no eq number for the next one} \notag
&y+z=0 \notag \\
&z+x=0 
\end{align}

\end{document}
share|improve this answer
    
This is just a MWE. My code has a lot of blocks and I want all of my equations without numbers. Sometimes I want something like the enumerate environment. with this solution every equation will have a tag and only the ones that I mark are going to be free of tags which is not a good and easy way. Not to mention that my doal is not to tag certain equations. But thank you anyway for your solution! –  Adam May 11 at 21:52
    
@Adam, I suspected as much but as I said it is not really clear from your very minimal example what you actually need to do. Can I suggest you post a more full example (or maybe a png of how you want the numbering from a mock-up in word or something) if Bernard's answer below doesn't help you because I still don't really understand exactly what you want! –  FionaSmith May 12 at 8:05
    
Thank you for your help. The second solution that Peter provided is, I think, what I was looking for. –  Adam May 14 at 21:46

A solution using the newtagform from \mathtools. With the fleqn option, you have to re-define the values of \mathindent to have the number on the same line as the equation:

\documentclass[12pt,leqno]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage[showframe, nomarginpar]{geometry}
\usepackage[fleqn]{mathtools}%
\newtagform{enum}{\hskip\parindent}{. }
\setlength{\mathindent}{\dimexpr\leftmargini + \parindent\relax}

\begin{document}

\usetagform{enum}
This is an example.
\begin{align}
&x+y=0 \\
\intertext{no eq number for the next one:}  \notag
&y+z=0 \notag \\
&z+x=0
\end{align}

\end{document} 

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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