3

This question already has an answer here:

I wanted this:

enter image description here

Hence my solution was

Solution:
\begin{enumerate}[label=(\alph*)]
\item 
\leavevmode\\[-2.75\baselineskip]
\begin{flalign*}
\mbox{US}\$10 &= \mbox{S}\$10\times1.33&\\
&= \mbox{S}\$13.30&
\end{flalign*}
\item 
\leavevmode\\[-2.75\baselineskip]
\begin{flalign*}
\mbox{S}\$1 &= \mbox{US}\$1 \div1.33&\\
&= \mbox{US}\$0.75188&\\
\mbox{S}\$20 &= \mbox{US}\$20\times0.75188&\\
&= \mbox{US}\$15.04\mbox{ (2DP)}&
\end{flalign*}
\end{enumerate}

Is there a more elegant way of doing this? As I need to guess about the spacing to shift up the equation beside (a) using [-2.75\baselineskip].

marked as duplicate by Mico, user31729, cmhughes, Malipivo, Andrew Swann Jan 4 '15 at 9:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Not sure whether this will qualify to be elegant but looks better for me.

\documentclass{article}
\usepackage{amsmath,enumitem}
\begin{document}
\noindent
Solution:
\begin{enumerate}[label=(\alph*)]
\item $
\begin{aligned}[t]
\text{US}\$10 &= \text{S}\$10\times1.33\\
&= \text{S}\$13.30
\end{aligned}
$
\item $
\begin{aligned}[t]
\text{S}\$1 &= \text{US}\$1 \div1.33\\
&= \text{US}\$0.75188\\
\text{S}\$20 &= \text{US}\$20\times0.75188&\\
&= \text{US}\$15.04\text{ (2DP)}
\end{aligned}
$
\end{enumerate}
\end{document}
  • Thank you! I thought the \leavevmode\[-2.75\baselineskip] was quite ugly as I needed to guess how much spacing to shift up the equation to align to (a). – Eugene Jan 4 '15 at 7:39
  • Any particular reason why \text should be used instead of \mbox? – Eugene Jan 4 '15 at 7:44
  • 1
    @Eugene \text is capable of detecting fonts (properties) in the surroundings, \mbox is not. – user43963 Jan 4 '15 at 7:45
  • Just one more question, I was trying to search for more information about the aligned package but could not find any so far, most of the Google results gave align instead of aligned. – Eugene Jan 4 '15 at 7:49
  • 2
    @Eugene Search in this site or texdoc amsldoc from command prompt/terminal to get the amsmath manual. – user43963 Jan 4 '15 at 7:59
4

Here's one way using a regular array aligned at the [t]op. Using some \phantoms and overlapping you can also align across the enumeration:

enter image description here

\documentclass{article}

\usepackage{amsmath,enumitem,array}

\renewcommand{\arraystretch}{1.2}
\begin{document}

Solution:
\begin{enumerate}[label=(\alph*)]
  \item 
  $\begin{array}[t]{@{}r@{}>{{}}l@{}}
    \mbox{US}\$10 &= \mbox{S}\$10 \times 1.33 \\
                  &= \mbox{S}\$13.30
  \end{array}$

  \item 
  $\begin{array}[t]{@{}r@{}>{{}}l@{}}
     \phantom{\mbox{US}\$10}\llap{\mbox{S}\$1} &= \mbox{US}\$1 \div 1.33 \\
                  &= \mbox{US}\$0.75188 \\
     \mbox{S}\$20 &= \mbox{US}\$20 \times 0.75188 \\
                  &= \mbox{US}\$15.04 \mbox{ (2DP)}
  \end{array}$
\end{enumerate}

\end{document}

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