4

I'm trying to align in LaTeX all equal signs, but I'm encountering a problem. If the line is too long it won't automatically break.

My code at the moment:

\begin{align*}
n &= \text{number of days in the support and resistance range;} \\
e &= \text{used for an alternative definition of extrema where a low (high) can be defined as the most recent closing price that is less (greater) than the n previous closing prices;} \\
b &= \text{fixed band multiplicative value;}
\end{align*}

Result at the moment: Result

What I want to get:

End Result

So I want the line to automatically break if it's too long and put the new line right under the first line (after the equal sign).

How can I do this? P.s. Additional: Does somebody also know how much (cm/mm) the "align" command shifts the text vertical down? I don't really want the command to shift the text downwards, and want to correct this with "\vspace{-Xmm}".

  • Can you clarify about the text being pushed down? Which text? It is the \belowdisplayskip which is the vertical space between the text below and the last line of the equation. – user11232 Sep 26 '15 at 13:32
  • I think the \align* function in combination with my template made the text (box) shifts down (in relation to my header), however such thing won't happen with \tabularx. – Wildman Sep 26 '15 at 14:09
  • Welcome to TeX.SX! Usually, we don't put a greeting or a “thank you” in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say “thank you” to users who helped you. – Martin Schröder Sep 26 '15 at 14:25
6

An equation-oriented environment such as align* isn't well suited for the task at hand. Instead, consider using a table-like environment such as tabularx.

The following code uses the construct @{${}={}$} to insert a properly-spaced = symbol between the first and second column of the tabularx environment; the X column type, used for the second column, "wraps" its contents automatically as needed. The overall width of the table is set to 0.75\textwidth -- adjust this setting as you see fit.

enter image description here

\documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{center}
\begin{tabularx}{0.75\textwidth}{>{$}r<{$} @{${}={}$} X}
  n &number of days in the support and resistance range; \\
  e &used for an alternative definition of extrema where 
     a low (high) can be defined as the most recent closing     
     price that is less (greater) than the n previous closing 
     prices; \\
  b &fixed band multiplicative value.\\
\end{tabularx}
\end{center}
\end{document}
  • Thanks, this is maybe even smarter/faster as the \align* command! – Wildman Sep 26 '15 at 14:10
5

You can use a \parbox:

\documentclass{article}
\usepackage{amsmath}
\usepackage{linegoal}
\begin{document}
  \begin{align*}
n &= \text{number of days in the support and resistance range;} \\
e &= \parbox[t]{\linegoal}{used for an alternative definition of extrema where a low (high) can be defined as the most recent closing price that is less (greater) than the n previous closing prices;} \\
b &= \text{fixed band multiplicative value;}
\end{align*}
\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.