LaTeX How to format "sub step indentations" in LaTeX

  • Thread starter Thread starter opus
  • Start date Start date
  • Tags Tags
    Format Latex
Click For Summary
The discussion focuses on formatting mathematical steps in a LaTeX editor to clearly present subsets of problems, particularly for evaluating integrals. Users suggest using the align environment to indent steps and align equal signs for clarity. The example provided demonstrates how to structure equations with the align and IEEEeqnarray environments, emphasizing the placement of ampersands for proper alignment. Additionally, the use of phantoms is recommended for spacing when a line does not contain a relation. A link to a helpful resource on typesetting equations is also shared, enhancing the understanding of formatting options in LaTeX.
opus
Gold Member
Messages
717
Reaction score
131
Please see the attached image for reference. I'm looking for a way to kind of "indent" in my steps to make it clear that I'm working on a subset of a problem. For example in this case, I want to evaluate each integral separately in kind of a sub step to so that everything is not running down in one line. If possible, I'd like to be able to line up my equal signs in the subset with each other too.
Please let me know if you can't see the image well.
Thanks!
 

Attachments

  • Screen Shot 2019-01-27 at 3.09.13 PM.png
    Screen Shot 2019-01-27 at 3.09.13 PM.png
    11.3 KB · Views: 507
Physics news on Phys.org
Do you ask the question with respect to a LaTeX editor, or do you want to know how it works here?

In a LaTeX editor you can use structures as
\begin{align*}
A=& A_0 \\
& A_1\\
& A_2\\
\\
B=&B_0\\
& B_1\\
& B_2\\
&\\
etc. &
\end{align*}

which should also work here. Press "Reply" to see the code. Of course you can have more than one tab "&".
 
My eyes hurt from that spacing. :rolleyes: (It is an illness I have, my PhD student has been wondering for years how I can see such things.)

In the align environment, the ampersand needs to go before the relation for proper spacing. If you need to use a line without a relation you can always use phantoms.
\begin{align*}
A&=A_1\\
&=A_2\\
&\phantom{{}={}}A_3
\end{align*}
Note that the additional brackets are necessary in the = phantom to create the appropriate spacing for the created box.
 
Thanks all! Let me try this and see if I can make it look decent.
 
I use IEEEeqnarray and IEEEeqnarraybox for this sort of thing, e.g.:

intexample.png

Source (entire document):
Code:
\documentclass[12pt]{article}

\usepackage{amsmath}
\usepackage[retainorgcmds]{IEEEtrantools}

\newcommand{\rd}{\mathrm{d}}
\newcommand{\lrbrackets}[1]{\biggl[#1\biggr]}

\begin{document}

\begin{IEEEeqnarray}{rCl}
  \int_{-\infty}^{\infty} \rd x \, f(x)
  &=& \int_{-\infty}^{0} \rd x \, f(x)
  + \int_{0}^{\infty} \rd x \, f(x) \nonumber \\
  &=& \int_{-\infty}^{0} \rd x \,
  \begin{IEEEeqnarraybox}[][t]{rl}
    \lrbrackets{ & \text{really long expansion} \\
      & +\> \text{that doesn't fit on one line} }
  \end{IEEEeqnarraybox} \nonumber \\
  &&+\> \int_{0}^{\infty} \rd x \,
  \begin{IEEEeqnarraybox}[][t]{rl}
    \lrbrackets{ & \text{another really long expansion} \\
      & +\> \text{with more terms on the next line} }
  \end{IEEEeqnarraybox} \nonumber \\
  &=& 3 \,.
\end{IEEEeqnarray}

\end{document}

There's a good explanation here: http://moser-isi.ethz.ch/docs/typeset_equations.pdf.
 

Attachments

  • intexample.png
    intexample.png
    3.4 KB · Views: 588
  • Like
Likes Phylosopher and opus
Awesome thanks!
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 36 ·
2
Replies
36
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K