3

I want to align the following assignment statements w.r.t the = sign as follows:

\begin{itemize}
\item  $Wd  =$ We are eating the fish.
\item  $Ct  =$ Your Claws tore through my shirt!
\item  $Dhw =$ Your Dolphin swims fast.
\end{itemize}

I guess I could use begin{align*} and then use \text{} but that seems really messy. I actually would like similar use to begin{align} where we can use the & character to determine the position of the alignment.

  1. Is there a better way?
  2. What else can you recommend?

Thanks in advance!

  • 1
    And which is the desired alignment? Math expressions aligned at the = sign? Please describe in a little more detail the desired alignment. – Gonzalo Medina Aug 25 '13 at 0:35
5

Depending on the desired result, you could use align* (for a centered expression) or flalign* (for a flushed left expression):

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

\begin{document}

\lipsum[4]
\begin{align*}
Wd &= \text{We are eating the fish.} \\
Ct &= \text{Your Claws tore through my shirt!} \\
Dhw &= \text{Your Dolphin swims fast.}
\end{align*}
\lipsum[4]
\begin{flalign*}
Wd &= \text{We are eating the fish.} & \\
Ct &= \text{Your Claws tore through my shirt!} \\
Dhw &= \text{Your Dolphin swims fast.}
\end{flalign*}
\lipsum[4]

\end{document}

enter image description here

However, I think that using the equality sign for defining expressions (equating math and text) is not really correct. I would rather use one of the two options below:

\documentclass{article}

\begin{document}

\begin{itemize}
\item $Wd$ represents... 
\item $Ct$ represents... 
\item $Dhw$ represents... 
\end{itemize}

$Wd$ represents..., $Ct$ represents..., and $Dhw$ represents...

\end{document}

enter image description here

  • 1
    It should probably be \mathit{Wd} – egreg Aug 25 '13 at 9:06
0

If you desire to use the itemize environment, you can also use the \makebox macro to ensure that the text is right aligned to the widest text.

enter image description here

Notes:

  • This assumes that the description text is short enough to fit on one line. If longer text is to be allowed, and desire that the text all begin at the same horizontal spot then other options such as using a \parbox, or tabular could be used.

Code:

\documentclass{article}
\usepackage{calc}

\newcommand{\LargestText}{$Dhw =$}%
\newcommand*{\MakeBox}[1]{\makebox[\widthof{\LargestText}][r]{#1}}

\begin{document}

\begin{itemize}
    \item  \MakeBox{$Wd  =$} We are eating the fish.
    \item  \MakeBox{$Ct  =$} Your Claws tore through my shirt!
    \item  \MakeBox{$Dhw =$} Your Dolphin swims fast.
\end{itemize}
\end{document}

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.