[Tex/LaTex] How to reduce the indentation of items in an enumeration

#enumerateindentationlistsmemoir

I am trying to condense a two-level enumeration of some kind of requirements in a figure, with the text referencing the items of the enumeration. I am using a table to separate the two columns (tried \twocolumn and \onecolumn but this didn't have the desired effect) and generate the figure border.

Here is an example of what I managed to do:

examples

Figure 1.2 is essentially what I want, except that references to the items in the list do not work: a \ref refering to e.g. item 1e displays as "5", i.e. only the nested list is shown, and it is shown using arabic numerals instead of letters.

Figure 1.2 was created using the bare list environment, i.e. like this:

\begin{figure}
\newcounter{ctr:templatelang-req}
\newcounter{ctr:templatelang-req:sub}[ctr:templatelang-req]
\begin{tabular}{|p{0.48\textwidth}p{0.45\textwidth}|}
\hline
\begin{list}{\arabic{ctr:templatelang-req}.}{\usecounter{ctr:templatelang-req}\leftmargin=1.4em}
  \item SDF
    \begin{list}{\alph{ctr:templatelang-req:sub}.}{\usecounter{ctr:templatelang-req:sub}\leftmargin=1.4em}
      \item \label{templatelang-req:target-sort}Target sort
      \item \label{templatelang-req:cons-attr}Constructor attribute
      \item \label{templatelang-req:other-attrs}Other attributes
      \item \label{templatelang-req:sort-refs}References to other sorts
      \item \label{templatelang-req:literals-1}Literal text (excl. layout)
      \item \label{templatelang-req:option-op}Option operator \texttt{A?}
      \item \label{templatelang-req:repetition-op}Repetition operators \texttt{A*} and \texttt{A+}
      \item \label{templatelang-req:list-op}List operators \texttt{\{A S\}*} and \texttt{\{A S\}+}
    \end{list}
  \end{list} &
\begin{list}{\arabic{ctr:templatelang-req}.}{\usecounter{ctr:templatelang-req}\leftmargin=1.4em}
  \setcounter{ctr:templatelang-req}{1}
  \item Pretty printer
    \begin{list}{\alph{ctr:templatelang-req:sub}.}{\usecounter{ctr:templatelang-req:sub}\leftmargin=1.4em}
      \item \label{templatelang-req:literals-2}Literal text (incl. layout)
      \item \label{templatelang-req:wordwrap}Optional: word wrap
      \item \label{templatelang-req:alignment}Optional: alignment
      \item \label{templatelang-req:tabstops}Optional: tab stops
    \end{list}\vspace{1ex}
  \item Completion templates
    \begin{list}{\alph{ctr:templatelang-req:sub}.}{\usecounter{ctr:templatelang-req:sub}\leftmargin=1.4em}
      \item \label{templatelang-req:literals-3}Literal text (incl. layout)
      \item \label{templatelang-req:placeholder-text}Placeholder text
    \end{list}
\end{list} \\
\hline
\end{tabular}
\caption{Required information to encode in our syntax templates}
\label{fig:templatelang:requirements}
\end{figure}

Figure 1.3 is the result of using the enumerate environment. The only "hack" here is the use of \setcounter{enumi}{1} to start the outer enumeration in the second column at the proper number. With figure 1.3, \ref works fine: it includes both levels and uses the correct type of numbers. I.e., a reference to item 1e is displayed as 1e.

Code for figure 1.3:

\begin{figure}
\begin{tabular}{|p{0.48\textwidth}p{0.45\textwidth}|}
\hline
\begin{enumerate}
  \item SDF
    \begin{enumerate}
      \item \label{templatelang-req:target-sort}Target sort
      \item \label{templatelang-req:cons-attr}Constructor attribute
      \item \label{templatelang-req:other-attrs}Other attributes
      \item \label{templatelang-req:sort-refs}References to other sorts
      \item \label{templatelang-req:literals-1}Literal text (excl. layout)
      \item \label{templatelang-req:option-op}Option operator \texttt{A?}
      \item \label{templatelang-req:repetition-op}Repetition operators \texttt{A*} and \texttt{A+}
      \item \label{templatelang-req:list-op}List operators \texttt{\{A S\}*} and \texttt{\{A S\}+}
    \end{enumerate}
  \end{enumerate} &
\begin{enumerate}
  \setcounter{enumi}{1}
  \item Pretty printer
    \begin{enumerate}
      \item \label{templatelang-req:literals-2}Literal text (incl. layout)
      \item \label{templatelang-req:wordwrap}Optional: word wrap
      \item \label{templatelang-req:alignment}Optional: alignment
      \item \label{templatelang-req:tabstops}Optional: tab stops
    \end{enumerate}\vspace{1ex}
  \item Completion templates
    \begin{enumerate}
      \item \label{templatelang-req:literals-3}Literal text (incl. layout)
      \item \label{templatelang-req:placeholder-text}Placeholder text
    \end{enumerate}
\end{enumerate} \\
\hline
\end{tabular}
\caption{Required information to encode in our syntax templates}
\label{fig:templatelang:requirements}
\end{figure}

So my question is foremost: how do I reduce the indentation of the list items in the enumerate environment, when using the memoir class?

I tried the things suggested here on stackoverflow, which is how I arrived at figure 1.2, but since this breaks \ref it doesn't really help me.

I also tried to insert \setlength{\leftmargin}{0pt} at various places, as is suggested by figure 8.2 on page 149 (the layout parameters of general lists) of the memoir manual, but this didn't help either.

Do I really need to use an extra package just to reduce the indentation of these enumerations, as suggested here?

Best Answer

The memoir class, by default, adds a bit of horizontal space in front of the labels. In the code below -- which I believe achieves your formatting objectives -- this extra space is suppressed by specifying explicitly the desired forms of the labels ([1.], [a.]) as the argument of each \begin{enumerate} command. In addition, I've allocated a bit more horizontal widths to the left-hand column. The instruction \firmlists* reduces the amount of vertical spacing, and the command \frenchspacing suppresses the extra space after periods.

An additional suggestion: consider placing the tabular stuff in a table rather than in a figure environment: people tend to associate "figures" with graphical information, not tabular information.

\documentclass[a4paper]{memoir}
\frenchspacing

\begin{document}

\begin{figure}
\firmlists*

\begin{tabular}{|p{0.51\textwidth}p{0.45\textwidth}|}
\hline
\begin{enumerate}[1.]
  \item SDF
    \begin{enumerate}[a.]
      \item \label{templatelang-req:target-sort}Target sort
      \item \label{templatelang-req:cons-attr}Constructor attribute
      \item \label{templatelang-req:other-attrs}Other attributes
      \item \label{templatelang-req:sort-refs}References to other sorts
      \item \label{templatelang-req:literals-1}Literal text (excl. layout)
      \item \label{templatelang-req:option-op}Option operator \texttt{A?}
      \item \label{templatelang-req:repetition-op}Repetition operators 
            \texttt{A*} and \texttt{A+}
      \item \label{templatelang-req:list-op}List operators 
            \texttt{\{A S\}*} and \texttt{\{A S\}+}
    \end{enumerate}
  \end{enumerate} &
\begin{enumerate}
  \setcounter{enumi}{1}
  \item Pretty printer
    \begin{enumerate}[a.]
      \item \label{templatelang-req:literals-2}Literal text (incl. layout)
      \item \label{templatelang-req:wordwrap}Optional: word wrap
      \item \label{templatelang-req:alignment}Optional: alignment
      \item \label{templatelang-req:tabstops}Optional: tab stops
    \end{enumerate}
  \vspace{1.8ex}
  \item Completion templates
    \begin{enumerate}[a.]
      \item \label{templatelang-req:literals-3}Literal text (incl. layout)
      \item \label{templatelang-req:placeholder-text}Placeholder text
    \end{enumerate}
\end{enumerate} \\
\hline
\end{tabular}
\caption{Required information to encode in our syntax templates}
\label{fig:templatelang:requirements}
\end{figure}

\end{document}
Related Question