0

How can I make the $f(x^0 + d^0) = -b(x^0 + d^0)$ move below the $f(x^0) = -ax^0$?

enter image description here


\documentclass[a4paper,fontsize=13pt]{scrartcl}

\usepackage[english, main=ngerman]{babel}
\usepackage[a4paper,left=3cm,right=3cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{xfrac}
\usepackage{enumitem}
\usepackage{aligned-overset}



\begin{document}

\begin{alignat*}{2}
\rho_{0}
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{f(x^{0}) - \widetilde{q}_{0}(d^{0})}  \\
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{-\widetilde{\phi}(x^{0}, \Delta_{0} ; d^{0})}   \\
    \overset{\star}&{=} \frac{-a x^{0}+b(x^{0}+d^{0})}{a d^{0}}  
        &&\qquad\qquad \text{\%} \quad
           f(x^{0})= -a x^{0} \text{ because } x^{0} < 0,
           f(x^{0} + d^{0}) = - b(x^{0} + d^{0})  \text{ because } x^{0}+d^{0} \in (0,1) \\
    &= \frac{-a x^{0}+b(x^{0}+\Delta_{0})}{a \Delta_{0}}
        &&\qquad\qquad \text{\%} \quad  d^{0}=\Delta_{0}  \\
    &= ... \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\Delta_0} + \frac{b}{a} \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\frac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0}} + \frac{b}{a}
        &&\qquad\qquad \text{\%} \quad  \Delta_{0} = \tfrac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0}  \\
    &= \left( \frac{b}{a} - 1 \right) \frac{\beta_{1}}{\beta_{1} \beta_{2}-1} + \frac{b}{a} \\
    &= \theta \leq \eta_1 \\
\end{alignat*}

\end{document}

1

You can do that with an array. Note your font size is too large for this equation with comments to fit within margins. So I changed some spacings, but it remains nearly 16 pt too wide, and may be you should reconsider the font size, at least for this equation.

\documentclass[a4paper,fontsize=13pt]{scrartcl}

\usepackage[english, main=ngerman]{babel}
\usepackage[a4paper, hmargin=3cm, vmargin=2.5cm]{geometry}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{xfrac}
\usepackage{enumitem}
\usepackage{aligned-overset}

\begin{document}

\begin{alignat*}{2}
\rho_{0}
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{f(x^{0}) - \widetilde{q}_{0}(d^{0})} \\
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{-\widetilde{\phi}(x^{0}, \Delta_{0} ; d^{0})} \\
    \overset{\star}&{=} \frac{-a x^{0}+b(x^{0}+d^{0})}{a d^{0}}
        & & \text{\%}\;\begin{array}{|l@{}}
           f(x^{0})= -a x^{0}\; \text{ because } x^{0} < 0, \\
            f(x^{0} + d^{0}) = - b(x^{0} + d^{0}) \;\text{ because } x^{0}+d^{0} \in (0,1)
           \end{array}\\
    &= \frac{-a x^{0}+b(x^{0}+\Delta_{0})}{a \Delta_{0}}
        & & \text{\%} \; d^{0}=\Delta_{0} \\
    &= ... \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\Delta_0} + \frac{b}{a} \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\frac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0}} + \frac{b}{a}
        &\hskip 1.5em&\text{\%} \; \Delta_{0} = \tfrac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0} \\
    &= \left( \frac{b}{a} - 1 \right) \frac{\beta_{1}}{\beta_{1} \beta_{2}-1} + \frac{b}{a} \\
    &= \theta \leq \eta_1 \\
\end{alignat*}

\end{document}

enter image description here

2
  • Awesome! Many thanks. This is exactly what I have been looking for. I would like to ask you one more question: Does this look overall good to you (excluding the meaning of the maths of course)? Should I use another symbol instead of the percen sign?
    – u49K3df2
    Apr 9 at 10:03
  • 1
    @u49K3df2: For me, it's fine. Of course, maybe you should explain somewhere that comments and justification are preceded by a percent sign (I know it it because it is used in LaTeX code, but think of a non-latex user. Another possibility would be to use a smaller font size than for the equations themselves.
    – Bernard
    Apr 9 at 11:50
0

You could simply start a new line in your equations, and "skip the first columns".

For instance:

\documentclass[a4paper,fontsize=13pt]{scrartcl}

\usepackage[english, main=ngerman]{babel}
\usepackage[a4paper,left=3cm,right=3cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{xfrac}
\usepackage{enumitem}
\usepackage{aligned-overset}



\begin{document}

\begin{alignat*}{2}
\rho_{0}
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{f(x^{0}) - \widetilde{q}_{0}(d^{0})}  \\
    &= \frac{f(x^{0}) - f(x^{0} + d^{0})}{-\widetilde{\phi}(x^{0}, \Delta_{0} ; d^{0})}   \\
    \overset{\star}&{=} \frac{-a x^{0}+b(x^{0}+d^{0})}{a d^{0}}  
        &&\qquad\qquad \text{\%} \quad
           f(x^{0})= -a x^{0} \text{ because } x^{0} < 0, \\
    &&&   \qquad\qquad \text{\%} \quad  f(x^{0} + d^{0}) = - b(x^{0} + d^{0})  \text{ because } x^{0}+d^{0} \in (0,1) \\
    &= \frac{-a x^{0}+b(x^{0}+\Delta_{0})}{a \Delta_{0}}
        &&\qquad\qquad \text{\%} \quad  d^{0}=\Delta_{0}  \\
    &= ... \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\Delta_0} + \frac{b}{a} \\
    &= \left( \frac{b}{a} - 1 \right) \frac{x^0}{\frac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0}} + \frac{b}{a}
        &&\qquad\qquad \text{\%} \quad  \Delta_{0} = \tfrac{\beta_{1} \beta_{2}-1}{\beta_{1}} x^{0}  \\
    &= \left( \frac{b}{a} - 1 \right) \frac{\beta_{1}}{\beta_{1} \beta_{2}-1} + \frac{b}{a} \\
    &= \theta \leq \eta_1 \\
\end{alignat*}

\end{document}

will look like this:

preview

2
  • Thanks for your answer. Is there another way to solve this? Like grouping the two comments such that there are vertically closer to each other?
    – u49K3df2
    Apr 9 at 9:37
  • 1
    you could simply change the linespace by changing \\ to this: \\[-0.2cm]
    – flipper
    Apr 9 at 10:04

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.