How do I align enumerated equations to the left and text to the right?
Use a regular enumerate
and set every equation inside the same-sized box (using eqparbox
's \eqmakebox[<tag>][<align>]{<stuff>}
:
\documentclass{article}
\usepackage{eqparbox}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut lorem ac orci ullamcorper mattis.
Nunc at convallis turpis, aliquam vehicula leo. Etiam mollis, urna nec interdum suscipit, lacus
ante mollis risus, placerat efficitur lacus quam at mauris. Vestibulum pretium dolor a eleifend
vestibulum. Duis sed ornare sapien.
\begin{enumerate}
\item First item
\item Second item
\item Third item
\end{enumerate}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut lorem ac orci ullamcorper mattis.
Nunc at convallis turpis, aliquam vehicula leo. Etiam mollis, urna nec interdum suscipit, lacus
ante mollis risus, placerat efficitur lacus quam at mauris. Vestibulum pretium dolor a eleifend
vestibulum. Duis sed ornare sapien.
\begin{enumerate}
\item
\eqmakebox[leq][l]{$f(x) = \Theta$} \qquad (belonging to~$\Theta$)
\item
\eqmakebox[leq][l]{$f(x+y) = x \leftrightarrow x > y$} \qquad (identity of confusion)
\item
\eqmakebox[leq][l]{$\lambda f(x) = f(x^\lambda)$} \qquad (non-sensible relation)
\end{enumerate}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ut lorem ac orci ullamcorper mattis.
Nunc at convallis turpis, aliquam vehicula leo. Etiam mollis, urna nec interdum suscipit, lacus
ante mollis risus, placerat efficitur lacus quam at mauris. Vestibulum pretium dolor a eleifend
vestibulum. Duis sed ornare sapien.
\end{document}
Using a list instead of a tabular
will ensure things line up the same way your other lists do, and setting the content in similarly-sized boxes will ensure horizontal alignment with your "comments."
You can define a new environment based on tabular
combined with an item like command that will provide the numbering and alignment:
\documentclass{article}
\usepackage{array,environ}
\newcolumntype{L}{>{$}l<{$}}
\newcounter{aenum}
\renewcommand{\theaenum}{\arabic{aenum}.}
\newcommand{\aitem}[2]{\refstepcounter{aenum}\theaenum&(#2)\\}
\NewEnviron{annotedeqnlist}{\noindent
\begin{tabular}{rL@{\quad}l}
\setcounter{aenum}{0}%
\BODY
\end{tabular}}
\begin{document}
\begin{annotedeqnlist}
\aitem{f(x) \in \Theta}{belonginess to \( \Theta \)}
\aitem{f(x+y)=x \iff x>y}{identity of confusion}
\end{annotedeqnlist}
\end{document}
I have used the array
package to provide a convenient math type column. You might consider adding \displaystyle
to the column definition as follows:
\newcolumntype{L}{>{$\displaystyle}l<{$}}
The code might seem complicated, but the syntax is quite friendly. The annotedeqn
environment is a list of lines introduced by \item
, with &
as separator. The part before &
is typeset in math mode (this can be changed, if you need it), the second part in text mode.
The first parts will be measured, so we can start the second parts at the same horizontal position, two ems from the end of the widest first part.
The obvious assumption is that every item fits on a line.
\documentclass{article}
\usepackage{environ,xparse}
\usepackage{lipsum}
\ExplSyntaxOn
\NewEnviron{annotedeqnlist}
{
\giusti_annotedeqn_list:V \BODY
}
\seq_new:N \l__giusti_annotedeqn_list_seq
\seq_new:N \l__giusti_annotedeqn_listarg_seq
\seq_new:N \l__giusti_annotedeqn_temp_seq
\box_new:N \l__giusti_annotedeqn_first_box
\cs_new_protected:Nn \giusti_annotedeqn_list:n
{
% get the items
\seq_set_split:Nnn \l__giusti_annotedeqn_list_seq { \item } { #1 }
% discard the first empty item
\seq_pop_left:NN \l__giusti_annotedeqn_list_seq \l_tmpa_tl
% massage the items
\seq_clear:N \l__giusti_annotedeqn_listarg_seq
\seq_map_inline:Nn \l__giusti_annotedeqn_list_seq
{
\seq_set_split:Nnn \l__giusti_annotedeqn_temp_seq { & } { ##1 }
\seq_put_right:Nx \l__giusti_annotedeqn_listarg_seq
{
{\seq_item:Nn \l__giusti_annotedeqn_temp_seq { 1 } }
{\seq_item:Nn \l__giusti_annotedeqn_temp_seq { 2 } }
}
}
% measure the equations
\hbox_set:Nn \l__giusti_annotedeqn_first_box
{
$\begin{array}{@{}l@{}}
\seq_map_function:NN \l__giusti_annotedeqn_listarg_seq \__giusti_annotedeqn_first:n
\end{array}$
}
% produce the enumerate environment
\begin{enumerate}
\seq_map_function:NN \l__giusti_annotedeqn_listarg_seq \__giusti_annotedeqn_item:n
\end{enumerate}
}
\cs_generate_variant:Nn \giusti_annotedeqn_list:n { V }
\cs_new_protected:Nn \__giusti_annotedeqn_first:n
{
\use_i:nn #1 \\
}
\cs_new_protected:Nn \__giusti_annotedeqn_item:n
{
\__giusti_annotedeqn_item:nn #1
}
\cs_new_protected:Nn \__giusti_annotedeqn_item:nn
{
\item
\makebox[\box_wd:N \l__giusti_annotedeqn_first_box][l]{$#1$}
\qquad
#2
}
\ExplSyntaxOff
\begin{document}
\lipsum*[2]
\begin{annotedeqnlist}
\item f(x) \in \Theta & (belonginess to \( \Theta \))
\item\label{confusion} f(x+y)=x \iff x>y & (identity of confusion)
\item \lambda f(x)=f(x^\lambda) & (non-sensible relation)
\end{annotedeqnlist}
with a reference to item~\ref{confusion}.
\lipsum*[3]
\begin{annotedeqnlist}
\item f(x) \in \Theta & (belonginess to \( \Theta \))
\item \lambda f(x)=f(x^\lambda) & (non-sensible relation)
\end{annotedeqnlist}
\end{document}