[Tex/LaTex] Alignment in inline math

#enumerateinline()tablesvertical alignment

I want to enclose a tabular environment with a bracket, inside an enumerate environment, and be aligned to top.

In the following example:

\documentclass[a4paper]{article}
\begin{document}
\begin{enumerate}
  \item
    \(\left.\begin{tabular}{l}
      First line\\
      Second line\\
      Third line
    \end{tabular}\right\}\)
    Text
\end{enumerate}
\end{document}

I get everything centred, and not aligned to top:

enter image description here

If I ask tabular to be aligned at top, then still the inline math is not, so the following happens:

\documentclass[a4paper]{article}
\begin{document}
\begin{enumerate}
  \item
    \(\left.\begin{tabular}[t]{l}
      First line\\
      Second line\\
      Third line
    \end{tabular}\right\}\)
    Text
\end{enumerate}
\end{document}

enter image description here

Is there any way to tell the inline math to also align to top?

Best Answer

I'd define a new environment and use adjustbox for this. The principle is the same as in Heiko's answer.

\documentclass[a4paper]{article}
\usepackage{adjustbox,varwidth,xparse}

\NewDocumentEnvironment{bracedrows}{m}
  {\begin{adjustbox}{valign=t}%
   $\kern-\nulldelimiterspace\left.
   \begin{tabular}{@{}l@{}}}
  {\end{tabular}\right\rbrace
   \begin{varwidth}{.5\linewidth}#1\end{varwidth}$%
   \end{adjustbox}}

\begin{document}
\begin{enumerate}
\item \begin{bracedrows}{Text}
      First line\\
      Second line\\
      Third line
      \end{bracedrows}

\item \begin{bracedrows}{Text in \\ two lines}
      One\\
      Two\\
      Three
      \end{bracedrows}
\end{enumerate}
\end{document}

With varwidth you're sure your side text will occupy only the necessary width.

enter image description here