Add vertically-aligned text between two enumerate items
How about a simple \raisebox
, wrapped in a macro taking into account \itemsep
and \parsep
values (thanks to circumscribe, I have change to \glueexpr
, since all involved lengths are glues, not ordinary lengths!)
\documentclass{article}
\usepackage{enumitem}
\newcommand{\raisecontent}[1]{%
\raisebox{\glueexpr\baselineskip/2+\parsep/2+\itemsep/2+\lineskip/2}[\ht\strutbox][\ht\strutbox]{#1}%
}
\begin{document}
\begin{enumerate}
\item $Y^2 - 1 = 0$
\item $Y^2 + 1 = 0$ \raisecontent{\quad (text)}
\end{enumerate}
\begin{enumerate}[itemsep=40pt]
\item $Y^2 - 1 = 0$
\item $Y^2 + 1 = 0$ \raisecontent{\quad (text)}
\end{enumerate}
\end{document}
Another solution, based on tabularx
and listliketab
, which emulates list environments within tables:
\documentclass{article}
\usepackage{tabularx, listliketab, multirow}
\begin{document}
\storestyleof{enumerate}
\begin{listliketab}
\newcounter{tabenum}\setcounter{tabenum}{0}
\newcommand{\tabitem}{\addtocounter{tabenum}{1}\thetabenum.}
\noindent\begin{tabularx}{\linewidth}{@{}L l@{\quad}X@{}}
\tabitem & $Y^2 - 1 = 0$ & \multirow{2}{=}{(Text)}\\
\tabitem & $Y^2 + 1 = 0$
\end{tabularx}
\end{listliketab}
\end{document}