Math & ScienceMultiple indentation levels

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
eidolon1977
Posts: 4
Joined: Sun Mar 31, 2013 5:22 pm

Multiple indentation levels

Post by eidolon1977 »

Hello,

I assume this question has been asked before but can't find any relevant answer in the archives of the forum.

To put it simply, I have a long equation which I split using \begin{equation} \begin{split} ...

Still, the last line of the equation is too long for the journal in which I'm going to publish and I'd like to do a linebreak before the last + sign and align the rest of the line with the terms left of the + sign. This implies a second level of indentation.

I'm not sure if this is possible at all with equation or eqarray. Any suggestion would be welcome.

Code: Select all

\begin{equation}
\begin{split}
\frac{\partial^2}{\partial a^2} F =  \frac{1}{\sqrt{\mu}}
& \left [
\frac{3}{4 \sqrt{a}} \left ( \alpha - \beta -\sin{\alpha} + \sin{\beta} \right ) \right. \\
 & \left. + 3 \sqrt{a}  \left (  (1-\cos{\alpha})\frac{\partial \alpha}{\partial a} - (1 - \cos{\beta})\frac{\partial \beta}{\partial a} \right ) \right. \\
& \left. +  \sqrt{a^3} \left ( (1-\cos{\alpha})\frac{\partial^2 \alpha}{\partial a^2} - (1 - \cos{\beta})\frac{\partial^2 \beta}{\partial a^2} + \sin{\alpha} \left ( \frac{\partial \alpha}{\partial a} \right )^2 - \sin{\beta} \left ( \frac{\partial \beta}{\partial a} \right )^2 \right )
\right ]
\end{split}
\end{equation}
Last edited by Stefan Kottwitz on Sun Mar 31, 2013 9:20 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Multiple indentation levels

Post by svend_tveskaeg »

The \hphantom command can do the trick.

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}
  \frac{\partial^2}{\partial a^2}F
  &= \frac{1}{\sqrt{\mu}}
  \Biggl[
  \frac{3}{4\sqrt{a}} (\alpha-\beta-\sin\alpha+\sin\beta)\\
  &\hphantom{{}=\frac{1}{\sqrt{\mu}}\Biggl[} + 3\sqrt{a} \left((1-\cos\alpha)\frac{\partial\alpha}{\partial a} - (1-\cos\beta)\frac{\partial\beta}{\partial a}\right)\\
  &\hphantom{{}=\frac{1}{\sqrt{\mu}}\Biggl[} + \sqrt{a^3} \Biggl((1-\cos\alpha)\frac{\partial^2\alpha}{\partial a^2} - (1-\cos\beta)\frac{\partial^2\beta}{\partial a^2} + \sin\alpha\left(\frac{\partial\alpha}{\partial a}\right)^{\mkern -4mu 2}\\
  &\hphantom{{}=\frac{1}{\sqrt{\mu}}\Biggl[+\sqrt{a^3}\Biggl(} - \sin\beta\left(\frac{\partial\beta}{\partial a}\right)^{\mkern -4mu 2}\Biggr)
  \Biggr]
\end{align*}

\end{document}
P.S. I'm not sure a understand exactly where you want the linebreak, but it should be easy to edit the code accordingly.
Attachments
Output.
Output.
output.jpg (49.75 KiB) Viewed 8598 times
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
eidolon1977
Posts: 4
Joined: Sun Mar 31, 2013 5:22 pm

Re: Multiple indentation levels

Post by eidolon1977 »

That will do the trick, many thanks! I'll have to read about hphantom and mkern to fully make sense of your code but it does work.

PS: Stefan_K, sorry for the inline code; I'll pay attention next time
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Multiple indentation levels

Post by svend_tveskaeg »

\hphantom inserts an empty box that has zero height, zero depth, and the width of its argument.

\mkern adjusts the horizontal spacing in mathmode; here it's used to remove some of the space between the right-hand parenthesis and the superscript '2'.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply