# How can I indent formula to different tab position across a couple of pages?

I am very new to Latex and trying to document a long list of mathematical transformations. I would like to indent certain formula, so that the whole thing looks like one would do as a DO/FOR-loop in coding.

In Word I would define a set of tabulators and indent the formula then. But I can't get it to work within Latex. The outcome should look like this:

   Formula 1
Formula 2
<=> Modified Formula 2, maybe a text comment
<=> Modified Formula 1
Formula 3
Formula 4
Formula 5
<=> Modified Formula 3


I tried the following code:

%&latex
\documentclass[12pt,fleqn]{scrreprt}
\usepackage[latin1]{inputenc}
\usepackage[german]{babel}
\usepackage{amsmath}
\usepackage{nccmath}

\usepackage{tabto}
\TabPositions{1.0cm, 3.0cm, 5.0cm, 7.0cm}

\newcommand\tapp[1][1cm]{\hspace*{#1}}

\begin{document}

%  Normal Text can be indented.
\tab 1.Tab\tab 2.Tab \tab 3.Tab \tab 4. Tab

%  Formula can not be indented.

$$\tab \tab h_1 + \frac {c_1^2}{2} = h_{2s} + \frac {c_{2s}^2}{2}$$

%  Same exercise using selfdefined "tapp". Gives relative space.

A \tapp b c d

Alpha \tapp b c d

%  Try with "tabto". That doesn't work within equations.

$$\tabto{3.5cm} h_1 + \frac {c_1^2}{2} = h_{2s} + \frac {c_{2s}^2}{2}$$

$$\tabto{0.5cm} \Leftrightarrow \tabto{3.4cm} c_{2s}^2 = 2 \cdot (h_1 - h_{2s}) + c_1^2$$

$$h_1 - h_{2s} = -w_{t,12s} \text{ ,Some text added behind formula as a comment}$$

$$\Leftrightarrow h_1 - h_{2s} = -\frac{\kappa R T }{\kappa - 1} \left[ \left( \frac{p_2}{p_1} \right) ^ \frac{\kappa-1}{\kappa} - 1 \right]$$

\end{document}


I hope someone has a feasible idea.

%%

I am not sure if it is correct to put the next text in here. I used your code to get

%
\documentclass[fleqn]{scrreprt}
\usepackage{amsmath} % for "align*2 and "aligned" environments
\usepackage{showframe}

\begin{document}

\begin{align*}
&\ h_1 + \frac {c_1^2}{2} = h_{2s} + \frac {c_{2s}^2}{2} \\
\Leftrightarrow{}
&\ c_{2s}^2 = 2 \cdot (h_1 - h_{2s}) + c_1^2 \\
\begin{aligned}
&\ h_1 - h_{2s} = -w_{t,12s} \\
\Leftrightarrow{}
&\ h_1 - h_{2s} = \frac{\kappa R T }{\kappa - 1}
\left[ \left( \frac{p_2}{p_1} \right) ^
\frac{\kappa-1}{\kappa} - 1 \right]\\
\end{aligned} \\
\Leftrightarrow{}
&\ c_{2s}^2 = 2 \cdot \frac{\kappa}{\kappa - 1}
p_1 v_1 \left[ \left( \frac{p_2}{p_1} \right) ^
\frac{\kappa-1}{\kappa} - 1 \right] + c_1^2\\
\begin{aligned}
&\ c_1 = 0 \text{ , assumption: } c_1 <<c_{2s} \\
\end{aligned}
\end{align*}

\end{document}


The c_1 in the last row should be aligned to the h_1 in the 3 one.

As one can see the code becomes pretty confusing right now already. Since this will go on for a while it would be interesting, if there is a different solution.

• Another approach is to use $\displaystyle ...$ (single line) with some list. For multiple line formulas one could use \begin{minipage}{\linewidth}$$...$$\end{minipage}. Dec 14 '17 at 22:20

Tabbing is a text-mode operation. For displayed equations, I would like to suggest you use aligned environments nested in an align* environment.

If \qquad produces too much indentation for your taste, consider using \quad instead.

\documentclass{scrreprt}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&\text{Formula 1}\\
\begin{aligned}
&\text{Formula 2} \\
\Leftrightarrow{}
&\text{Modified Formula 2}
\end{aligned} \\
\Leftrightarrow{}
&\text{Modified Formula 1}\\
\begin{aligned}
&\text{Formula 3}\\
\begin{aligned}
&\text{Formula 4} \\
&\text{Formula 5}
\end{aligned} \\
\Leftrightarrow{}
&\text{Modified Formula 3}
\end{aligned}
\end{align*}
\end{document}


Addendum to address the OP's follow-up comment: The second ("real"?) formula you've posted is very different, in struccture, from the first. I'd use the following code to typeset it. Observe that the new solution uses aligned[t] environments instead of aligned environments inside an align* environment and that all \quad and \qquad statements are gone.

\documentclass[fleqn]{scrreprt}
\usepackage{amsmath,amssymb} % "amssymb" for "\ll" macro
\begin{document}

\begin{align*}
&h_1 + \frac {c_1^2}{2} = h_{2s} + \frac {c_{2s}^2}{2} \\
\Leftrightarrow{}
&c_{2s}^2
\begin{aligned}[t]
={} &2  (h_1 - h_{2s}) + c_1^2 \\
&h_1 - h_{2s} = -w_{t,12s} \\
\Leftrightarrow{}
&h_1 - h_{2s} = \frac{\kappa R T }{\kappa - 1}
\biggl[ \biggl( \frac{p_2}{p_1} \biggr) ^
{\!\!(\kappa-1)/\kappa} \!- 1 \biggr]
\end{aligned} \\
\Leftrightarrow{}
&c_{2s}^2
\begin{aligned}[t]
={} &2  \frac{\kappa}{\kappa - 1}
p_1 v_1 \biggl[ \biggl( \frac{p_2}{p_1} \biggr) ^
{\!\!(\kappa-1)/\kappa} \!- 1 \biggr] + c_1^2\\
&c_1 = 0 \text{ ; assumption: $c_1 \ll c_{2s}$}
\end{aligned}
\end{align*}

\end{document}

• Insert the instruction \allowdisplaybreaks if it's necessary to allow page breaks inside the align* environment.
– Mico
Dec 14 '17 at 10:09
• I introduced my formula into your code and have this now Dec 14 '17 at 12:13