2

I am trying to align inline math to the top of a line of text. Currently I have the following:

\documentclass[varwidth]{standalone}
\begin{document}
\begin{enumerate}
\item
Solve the system
$\begin{array}{r}
a2-3x_1+5x_2 = 0 \\
1+x_2 = 0 \\
x_3-2x_1 = 0
\end{array}$ in $\textbf{R}^3$.
\end{enumerate}
\end{document}

This is the result:

enter image description here

I would like for the top line of the array to be at the same vertical level as the text before and after it, instead of centered. I tried just making extra columns in the array with the text, but then that doesn't align with the item number of enumerate (it just vertically centers the whole thing). Other solutions I've found don't quite solve my problem, for instance this solution doesn't seem to allow text in the same line after it.

  • 2
    Beware! It should be \mathbf{R}. If you try \emph{We work in $\textbf{R}^{3}$}, you'll know why. – egreg Apr 6 '17 at 7:13
  • @egreg great point, thank you. Not too long ago I was still using {\bf R}... – Jānis Lazovskis Apr 6 '17 at 18:22
4

All you need to do is change \begin{array}{r} to \begin{array}[t]{r}.

enter image description here

\documentclass[varwidth,border=1pt]{standalone}
\begin{document}
\begin{enumerate}
\item
Solve the system
$\begin{array}[t]{r}
a2-3x_1+5x_2 = 0 \\
1+x_2 = 0 \\
x_3-2x_1 = 0
\end{array}$ in $\mathbf{R}^3$.
\end{enumerate}
\end{document}
1

You can use a stack.

\documentclass[varwidth,border=1pt]{standalone}
\usepackage[usestackEOL]{stackengine}
\stackMath
\begin{document}
\begin{enumerate}
\item
Solve the system
$\Longunderstack[r]{
a2-3x_1+5x_2 = 0 \\
1+x_2 = 0 \\
x_3-2x_1 = 0
}$ in $\mathbf{R}^3$.
\end{enumerate}
\end{document}

enter image description here

If you need alignment points, you can use a TABstack:

\documentclass[varwidth,border=1pt]{standalone}
\usepackage{tabstackengine}
\TABstackMath
\TABbinary
\begin{document}
\begin{enumerate}
\item
Solve the system
$\tabbedLongunderstack[r]{
2&-3x_1&+5x_2& =& 0 \\
1&&+x_2& =& 0 \\
&-2x_1&& + x_3 =& 0
}$ in $\mathbf{R}^3$.
\end{enumerate}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.