0

The last equations in these two mini pages in a mdframed-environment have a weird indent and the spacing for the text underneath them is also strange. How can one fix this?

\documentclass[
10pt, % Main document font size
a4paper, % Paper type, use 'letterpaper' for US Letter paper
]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage{amsmath}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usepackage{float}
\usepackage{commath}
\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{MyFrame}{%
linecolor=orange,
outerlinewidth=2pt,
roundcorner=20pt,
innertopmargin=\baselineskip,
innerbottommargin=\baselineskip,
innerrightmargin=20pt,
innerleftmargin=20pt,
backgroundcolor=gray!20!white}

\begin{document}
\begin{mdframed}[style=MyFrame]
\begin{center}
{\textbf{Wiederholung}: Quadratische Erg{\"a}nzung} 
\end{center}%
\bigskip
\noindent Manchmal kommt die Kreisgleichung in ausmultiplizierter Form    
vor, zum Beispiel $x_{1}^2 + 8x_{1} + x_{2}^2 + 6x_{2} = 0$. In diesem 
Fall kann man die Gleichung durch \textbf{quadratische Erg{\"a}nzung} 
auf die Koordinatengleichung zur{\"u}ckf{\"u}hren, in dem man die 
Gleichung in zwei Gleichungen aufteilt und beide auf eine binomische 
Formel zur{\"u}ckf{\"u}hrt:

\begin{minipage}[t]{0.45\linewidth}
\begin{equation*}
(x_{1}+a)^2 \Leftrightarrow x_{1}^2 + 8x_{1} = 0 \quad |+16
\end{equation*}%
\begin{equation*}
(x_{1}+a)^2 \Leftrightarrow x_{1}^2 + 8x_{1} + 16 = 16 \quad
\end{equation*}%
\begin{equation*}
(x_{1}+a)^2 \Leftrightarrow (x_{1} + 4)^2 = 16 \quad
\end{equation*}%
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\linewidth}
\begin{equation*}
(x_{2}+b)^2 \Leftrightarrow x_{2}^2 + 6x_{2} = 0 \quad |+9
\end{equation*}%
\begin{equation*}
(x_{2}+b)^2 \Leftrightarrow x_{2}^2 + 6x_{2} + 9 = 9
\end{equation*}
\begin{equation*}
(x_{2}+b)^2 \Leftrightarrow (x_{2} + 3)^2 = 9
\end{equation*}
\end{minipage}%
\newline
\smallskip
Durch Gleichsetzen beider Gleichungen erh{\"a}lt man folgende    Gleichung:
\begin{equation*}
(x_{1} + 4)^2 + (x_{2} + 3)^2 = 0 + 16 + 9
\end{equation*}
\begin{equation*}
(x_{1} + 4)^2 + (x_{2} + 3)^2 = 25
\end{equation*}
Dies ist die Koordinatenform, aus der  sich nun der Mittelpunkt    
$M(-4|-3)$ und der Radius $r = 5$ ablesen lassen. 
\end{mdframed}


\end{document}

enter image description here

Please note how the third equations are shifted to the left and the line spacing with the paragraph below is not proper. Neither \newline nor \smallskip has an effect on it though.

Sorry, the text is in German but it shouldn't matter.

The math is totally broken, as the comments pointed out. I fixed it in the MWE (just for it to look halfway serious) but haven't updated the picture.

  • 1
    Unrelated comment: the radius isn't $r=29$ but $r=\sqrt{26}$ and M is (-1|-5). – clemens Mar 5 '17 at 17:30
  • Oh dear, what was I doing... thanks ;) I'm writing just a few demo things to get the lay-out correct, but this is a pretty huge mistake 😂 – Narusan Mar 5 '17 at 17:44
1

You don't need minipages, you should never use a flock of equations. Use one of the align* or alignat* environments:

    \documentclass[
    10pt, % Main document font size
    a4paper, % Paper type, use 'letterpaper' for US Letter paper
    ]{scrartcl}

    \usepackage[ngerman]{babel}
    \usepackage{amsmath}
    \usepackage{mathrsfs}
    \usepackage{float}
    \usepackage{pgf,tikz}
    \usepackage{lipsum}
    \usepackage[framemethod=TikZ]{mdframed}

    \mdfdefinestyle{MyFrame}{%
    linecolor=orange,
    outerlinewidth=2pt,
    roundcorner=20pt,
    innertopmargin=\baselineskip,
    innerbottommargin=\baselineskip,
    innerrightmargin=20pt,
    innerleftmargin=20pt,
    backgroundcolor=gray!20!white}

    \begin{document}

    \begin{mdframed}[style=MyFrame]
    \begin{center}
    {\textbf{Heading}: This is a title!}
    \end{center}%
    \bigskip
    \lipsum[1]
    Text text text text text
    \begin{align*}
     &
    \begin{gathered}
    (x_{1}+a)^2 \Leftrightarrow x_{1}^2 + 2x_{1} = 0 \quad |+4\\
    (x_{1}+a)^2 \Leftrightarrow x_{1}^2 + 2x_{1} + 4 = 4 \quad\\
    (x_{1}+a)^2 \Leftrightarrow (x_{1} + 2)^2 = 4 \quad
    \end{gathered}%
     & &
    \begin{gathered}
    (x_{2}+b)^2 \Leftrightarrow x_{2}^2 + 10x_{2} = 0 \quad |+25\\
    (x_{2}+b)^2 \Leftrightarrow x_{2}^2 + 10x_{2} + 25 = 25\\
    (x_{2}+b)^2 \Leftrightarrow (x_{2} + 5)^2 = 25
    \end{gathered}
    \end{align*}%
    \lipsum[2]
    Text text text text text
    \begin{alignat*}{2}
     (x_{1}+a)^2 & \Leftrightarrow x_{1}^2 + 2x_{1} = 0 \quad |+4 &\qquad (x_{2}+b)^2 &\Leftrightarrow x_{2}^2 + 10x_{2} = 0 \quad |+25\\
    (x_{1}+a)^2 & \Leftrightarrow x_{1}^2 + 2x_{1} + 4 = 4 \quad & (x_{2}+b)^2 & \Leftrightarrow x_{2}^2 + 10x_{2} + 25 = 25\\
    (x_{1}+a)^2 & \Leftrightarrow (x_{1} + 2)^2 = 4 \quad & (x_{2}+b)^2 & \Leftrightarrow (x_{2} + 5)^2 = 25
    \end{alignat*}%
    \end{mdframed}

    \end{document} 

enter image description here

  • Thanks a lot! Didn't know the feature gathered before! – Narusan Mar 5 '17 at 16:58
  • 1
    Every amsmath environment has a ‘relative’ version, for nested environments (aligned, alignedat, gathered, multlined — the latter requires mathtools. – Bernard Mar 5 '17 at 17:12

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.