I would like to be able to replicate the following image. I am not sure how to force the enumerate to align after $M_2 =$
. Could anyone provide an example replicating this?
2 Answers
One option using enumitem
:
\documentclass{article}
\usepackage{enumitem}
\newlength\Separation
\begin{document}
\noindent
$M_2={}$ ``On input string
\settowidth\Separation{$M_2={}$ }
\begin{enumerate}[
nolistsep,
label=\textbf{\arabic*.},
leftmargin=\dimexpr\labelwidth-\labelsep+\Separation\relax
]
\item First.
\item Third.
\item Second.''
\end{enumerate}
\end{document}
The calculation for the horizontal distance for the labels is made with \labelwidth-\labelsep+\Separation
, where \Separation
is the width of the string you need as alignment point; $M_2={}$
, in this case.
This can be done with a tabular
:
\documentclass{article}
\usepackage{array,enumitem}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{\dimexpr0.9\textwidth-2\tabcolsep\relax}}
\begin{document}
\noindent
\begin{tabular}{>{\centering\arraybackslash}p{0.1\textwidth}@{}L}
$M_{2} ={}$ & ``On input string $w$:
\begin{enumerate}[leftmargin=*,label=\textbf{\arabic*.},itemsep=0pt,before=\vspace{-0.5\baselineskip},parsep=0pt]
\item Sweep left to right
\item If in stage 1,
\item If in stage 1, the tape contained more than single 0 and the number of 0s was odd \emph{reject}''
\end{enumerate}
\end{tabular}
\end{document}