12

I am listing a few relations with short and descriptive statements about them. The way I envision it, I'm trying to put relations on the left and labels on the right, aligned with respect to the left margin. The bogus attempt below illustrates my intent:

Silly example

I only want this to look like an "extended" enumerated list. So it should have the same indentation and vertical spacing as my other lists and no equation numbers. I thought of using the tabular environment, but I don't know how to express the spacings in terms of what enumerate uses.

What would be one sensible way to do it?

Werner
  • 603,163
giusti
  • 587

4 Answers4

15

Use a regular enumerate and set every equation inside the same-sized box (using eqparbox's \eqmakebox[<tag>][<align>]{<stuff>}:

enter image description here

\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."

Werner
  • 603,163
7

You can define a new environment based on tabular combined with an item like command that will provide the numbering and alignment:

Sample output

\documentclass{article}

\usepackage{array,environ}

\newcolumntype{L}{>{$}l<{$}}

\newcounter{aenum}
\renewcommand{\theaenum}{\arabic{aenum}.}
\newcommand{\aitem}[2]{\refstepcounter{aenum}\theaenum&#1&(#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<{$}}
Andrew Swann
  • 95,762
5

enter image description here

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
%% Useful packages
\usepackage{amsmath}
\newcommand\lreqn[2]{\noindent\makebox[\textwidth]{$\displaystyle#1$\hfill(#2)}\vspace{2ex}}


\begin{document}
\lreqn{f(x)= \Theta}{first function}
\lreqn{f(x+y)=f(x)+f(y)}{second function}
\end{document}

or visit Write 'text' **correctly** in equations.

Sebastiano
  • 54,118
5

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}

enter image description here

egreg
  • 1,121,712