Equations in list environment

I am trying to write some equations and follow each by a comment using a list environment.

I wanted to start off with an equation and follow it with a comment using the \item tag, so I tried this

\documentclass[a4paper, 11pt]{article}

%For math commands
\usepackage{amsmath}

%For spacing options in lists (enumerate, itemize, description)
\usepackage{enumitem}

\begin{document}
\begin{itemize}[label = {--}, leftmargin = 25mm]

$\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{2}$

\item From any customer vertex, the total inflow should be of exactly 1 edge

$\sum_{j \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{3}$

\item The outflow from any customer vertex should be exactly 1 edge
\end{itemize}
\end{document}


But that threw an error since it seems that list environments must begin
with a \item tag.

\begin{document}
$\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{2}$

\begin{itemize}[label = {--}, leftmargin = 25mm]

\item From any customer vertex the total inflow should be of exactly 1 edge

$\sum_{j \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{3}$

\item The outflow from any customer vertex should be exactly 1 edge
\end{itemize}
\end{document}


One problem with this is that it doesn't seem like the ideal way to do this. Another problem is the alignment. I want these comments slightly to the right (use of the leftitem option). This affects the alignment of the equations as well, I wish to centre align all equations and keep the comments slightly to the right.

Kindly suggest a solution for this.

Edit

The question is not a duplicate of this question since I wish to have equation numbers (tags) associated with the equations and this won't be possible in the inline math mode suggested over there.

• Possible duplicate of itemize equations – naphaneal Jun 21 '18 at 16:00
• @naphaneal I have explained why it is not a duplicate – ijuneja Jun 21 '18 at 16:05
• Your MWE is missing a \begin{document} and \end{document} and you probably don't need most of those packages to illustrate this behaviour. You can get rid of that bullet by using \item[] instead of \item to create an item without a label, but you won't get an equation number if you use the linked solution. – Circumscribe Jun 21 '18 at 16:08
• use align from amsmath and add the textual comments via \intertext{...} – David Carlisle Jun 21 '18 at 16:27
• @IshankJuneja Usually $...$ and $$...$$ are not equivalent and $...$ (or align or equation) should be preferred, see tex.stackexchange.com/q/503/35864 – moewe Jun 21 '18 at 16:36

\documentclass[a4paper, 11pt]{article}

%For math commands
\usepackage{amsmath}

%For spacing options in lists (enumerate, itemize, description)
\usepackage{enumitem}

\begin{document}

zzzz
\begin{align}
\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\}\\
\intertext{From any customer vertex, the total inflow should be of exactly 1 edge}
\sum_{j \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\}\\
\intertext{The outflow from any customer vertex should be exactly 1 edge}
\noalign{\vspace{-\baselineskip}}\nonumber% hmm amsmath could be better here
\end{align}
zzzz
\end{document}

• actually as you are not aligning the = gather would be better than align – David Carlisle Jun 21 '18 at 16:48

The linked question has indeed the solution, if you want to stick to that structure. You can set up your own list and its properties (mylist). Still the problem persists, that the first equation is out of that list. You could of course create a new command to shorten this environment \begin... stuff.

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

\newlist{mylist}{enumerate}{2}

\setlist[mylist,1]{leftmargin=25mm,label={--}}
\setlist[mylist,2]{leftmargin=-25mm,label={}}

\begin{document}
Some text.
$\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{2}$
\begin{mylist}
%    \begin{mylist}
%           \item $\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{2}$
%    \end{mylist}
\item From any customer vertex the total inflow should be of exactly 1 edge
\begin{mylist}
\item $\sum_{j \in V} x_{ij} = 1 \quad \forall j \in V \backslash \{0\} \tag{3}$
\end{mylist}
\item The outflow from any customer vertex should be exactly 1 edge
\end{mylist}
\end{document}


If I understood correctly, you want an itemize environment each of whose items consists of a labelled display equation followed by a short description. And you want the bullet/dash to be aligned with the first line of the description.

Here is one way to do precisely that by encapsulating the equation and the description in a pair of parboxes:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

You'll find a list of equations and corresponding descriptions below.
\begin{itemize}
% \itemsep=0pt %% <- don't add space between items
\abovedisplayshortskip=\abovedisplayskip %% <- always use long skips before equations
\belowdisplayshortskip=\belowdisplayskip %% <- always use long skips after equations
\item
\parbox[b]{\linewidth}{
$$\sum_{i \in V} x_{ij} = 1 \quad \forall j \in V \setminus \{0\}$$
\parbox[t]{\linewidth}{
From any customer vertex, the total inflow should be of exactly 1 edge.
}}
\item
\parbox[b]{\linewidth}{
$$\sum_{j \in V} x_{ij} = 1 \quad \forall i \in V \setminus \{0\}$$
\parbox[t]{\linewidth}{
The outflow from any customer vertex should be exactly 1 edge, with another sentence tacked on to ensure this item contains a line break.
}}
\end{itemize}
\end{document}


The inner parbox is only actually necessary if some of your descriptions span more than one line. (Also, I took the liberty of replacing your \backslash by \setminus and quantifying over i instead of j in the second equation.)

For some reason I'm incapable of writing short answers, so here's some explanation:

Position of the bullet:

I have used \parboxes to align the baseline of the item (and the corresponding bullet) with the top line of the description. The options [b] (for "bottom") and [t] (for "top") govern the vertical position of these boxes: they align the baseline of the bottom/top line of its contents with the baseline of the surrounding text. There is also a [c] (for "centre") option, but you can probably guess what that does. An image probably illustrates this better:

Word \parbox[t]{8mm}{word\\word} \parbox[b]{8mm}{word\\word}  word.


Spacing:

The vertical spacing was a little bit annoying to get right, and whether it is currently correct probably depends on personal preference. Here are some issues:

1. You can't just put a display equation at the top of an \item because an empty paragraph will be inserted right before it (which effectively inserts a \baselineskip worth of vertical space). We don't actually have to deal with this problem, however, since it is solved by wrapping the equation in a \parbox (which we did, albeit for other reasons). Hooray!

2. Normally, a vertical space of length \abovedisplayskip/\belowdisplayskip is inserted above/below every display equation, but if the preceding line is short \abovedisplayshortskip/\belowdisplayshortskip is used instead. In this case, the short distances would be used because the equation doesn't know the length of the preceding paragraph since it that is in a different \item (and outside its \parbox). I've set \abovedisplayshortskip/\belowdisplayshortskip equal to \abovedisplayskip/\belowdisplayskip (within this itemize environment only) so that the long distance is always used.

(Note: I believe the amsmath environments (like align and gather) always use \abovedisplayskip. I have no idea why and would love to know if someone can tell me.)

1. The itemize environment actually also introduces some space between every two items, i.e. above each but the first equation. I think this is probably appropriate since it makes it clear that the equation belongs with the text below it. If you uncomment the \itemsep=0pt line (or add the option itemsep=0pt, since you're using enumitem), the vertical spacing within the environment will be the same as it would be in a normal paragraph (I believe).