2

I do not seem to be able to split two long sub-equations. I've tried multline, align, split and a few other possibilities but none of them have worked; I reckon a main issue is that I've got brackets everywhere (very long equations indeed!).

What I'd like is to have only two numbered equations (1a and 1b) but for these equations to fit within a standard page width. Any help would be greatly appreciated.

This is my working code, but I'm not sure where to go from here:

\begin{subequations}\label{eqn:MagneticField3D}
    \begin{gather}
        B_{x}(r,x)=\frac{N I \mu_{0}}{2\pi}\left(\frac{1}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(\mathcal{K}(k(r,x-d/2)^{2})+\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)-\frac{1}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(\mathcal{K}(k(r,x+d/2)^{2})+\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)\right), \\
        B_{r}(r,x)=\frac{N I \mu_{0}}{2\pi r}\left(\frac{x-d/2}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(-\mathcal{K}(k(r,x-d/2)^{2})+\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)-\frac{x+d/2}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(-\mathcal{K}(k(r,x+d/2)^{2})+\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)\right).
    \end{gather}
\end{subequations}
  • 2
    subequations has nothing to do with the problem – egreg Apr 24 '19 at 14:42
  • Your equation is too long. Find some way to shorten it. I can't keep focus when reading such a long equation – user156344 Apr 24 '19 at 14:43
  • @egreg I added keywords that were relevant to the question, I never said this was a source of the problem. – Milad Dakka Apr 24 '19 at 14:46
  • @JouleV thanks for the comment, if I could shorten them I would not have posted the question. – Milad Dakka Apr 24 '19 at 14:46
  • You can never split any \left/right constructions, manually scale them using the four big constructions, then things can be split. But you should really rewrite this. – daleif Apr 24 '19 at 14:52
1

Here is a solution that does not require introducing new notation. It makes use of align, plus \left. and \right. where necessary, as well as \vphantom to get the correct sizing of the brackets and parentheses. I also changed the outer parentheses to square brackets because I think it's easier to read, but obviously that's a stylistic choice.

\documentclass{article}

\usepackage{amssymb,amsmath}

\begin{document}

\begin{subequations}\label{eqn:MagneticField3D}

    \begin{align}
        B_{x}(r,x) = & \frac{N I \mu_{0}}{2\pi}\left[\frac{1}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(\mathcal{K}(k(r,x-d/2)^{2}) 
        \vphantom{\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}} % to size the ( correctly
        \right.\right. \nonumber \\
        & \left.\left. +\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right) \right. \nonumber \\
       & \left. -\frac{1}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(\mathcal{K}(k(r,x+d/2)^{2}) 
       \vphantom{\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}} % to size the ( correctly
       \right.\right. \nonumber \\
       &  \left.\left. +\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)
       \vphantom{\frac{1}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}} % to size the ] correctly
       \right], \\
        B_{r}(r,x) = & \frac{N I \mu_{0}}{2\pi r}\left[\frac{x-d/2}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(-\mathcal{K}(k(r,x-d/2)^{2}) 
        \vphantom{\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}} % to size the ( correctly
        \right.\right. \nonumber \\
            & \left.\left. +\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right) \right. \nonumber \\
    & \left. -\frac{x+d/2}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(-\mathcal{K}(k(r,x+d/2)^{2}) 
    \vphantom{\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}} % to size the ( correctly
    \right.\right. \nonumber \\
    & \left.\left. +\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)
    \vphantom{\frac{x-d/2}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}} % to size the ] correctly
    \right].
    \end{align}
\end{subequations}

\end{document}

enter image description here

You could also add some \hspace to bump out the second lines of the "inner" parentheses:

\documentclass{article}

\usepackage{amssymb,amsmath}

\begin{document}

\begin{subequations}\label{eqn:MagneticField3D}

    \begin{align}
        B_{x}(r,x) = & \frac{N I \mu_{0}}{2\pi}\left[\frac{1}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(\mathcal{K}(k(r,x-d/2)^{2}) 
        \vphantom{\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}} % to size the ( correctly
        \right.\right. \nonumber \\
        & \hspace{1cm} \left.\left. +\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right) \right. \nonumber \\
       & \left. -\frac{1}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(\mathcal{K}(k(r,x+d/2)^{2}) 
       \vphantom{\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}} % to size the ( correctly
       \right.\right. \nonumber \\
       &  \hspace{1cm} \left.\left. +\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)
       \vphantom{\frac{1}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}} % to size the ] correctly
       \right], \\
        B_{r}(r,x) = & \frac{N I \mu_{0}}{2\pi r}\left[\frac{x-d/2}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}\left(-\mathcal{K}(k(r,x-d/2)^{2}) 
        \vphantom{\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}} % to size the ( correctly
        \right.\right. \nonumber \\
            & \hspace{1cm} \left.\left. +\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right) \right. \nonumber \\
    & \left. -\frac{x+d/2}{\sqrt{(a+r)^{2}+(x+d/2)^{2}}}\left(-\mathcal{K}(k(r,x+d/2)^{2}) 
    \vphantom{\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}} % to size the ( correctly
    \right.\right. \nonumber \\
    & \hspace{1cm} \left.\left. +\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}\mathcal{E}(k(r,x-d/2)^{2})\right)
    \vphantom{\frac{x-d/2}{\sqrt{(a+r)^{2}+(x-d/2)^{2}}}} % to size the ] correctly
    \right].
    \end{align}
\end{subequations}

\end{document}

enter image description here

| improve this answer | |
  • This is exactly what I was looking for, thank you so much! – Milad Dakka Apr 24 '19 at 16:02
5

You can probably reduce it down to. Dues to the width of the remaining fractions, it did not seem forth it to reduce these.

\documentclass[a4paper]{article}
\usepackage{amsmath}
\begin{document}

To reduce complexity, define
\begin{align*}
  A &= \frac{N I \mu_0}{2\pi}, \\
  B &= \sqrt{(a+r)^{2}+(x-d/2)^{2}},\\
  C &= \mathcal{K}(k(r,x-d/2)^{2}), \\
  D &= \mathcal{E}(k(r,x-d/2)^{2}), \\
  E  &= \sqrt{(a+r)^{2}+(x+d/2)^{2}}, \\
  F &= \mathcal{K}(k(r,x+d/2)^{2}),
\end{align*}
\begin{subequations}\label{eqn:MagneticField3D}
  \begin{gather}
    \begin{aligned}[b]
      B_{x}(r,x)=A\Biggl(&\frac{1}{B}\Biggl(C+\frac{a^{2}-r^{2}-(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}D\Biggr)
      \\
      &-\frac{1}{E}\Biggl(F+\frac{a^{2}-r^{2}-(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}D\Biggr)\Biggr),
    \end{aligned}
    \\
    \begin{aligned}[b]
      B_{r}(r,x)=
      \frac{A}{r}\Biggl(&\frac{x-d/2}{B}\Biggl(-C+\frac{a^{2}+r^{2}+(x-d/2)^{2}}{(a-r)^{2}+(x-d/2)^{2}}D\Biggr)
      \\
      &-\frac{x+d/2}{E}\Biggl(-F+\frac{a^{2}+r^{2}+(x+d/2)^{2}}{(a-r)^{2}+(x+d/2)^{2}}D\Biggr)\Biggr).
    \end{aligned}
  \end{gather}
\end{subequations}

\end{document}

enter image description here

| improve this answer | |
  • Quote from the OP: "if I could shorten them I would not have posted the question". Therefore shortening is not an answer, unfortunately – user156344 Apr 24 '19 at 15:09
  • 2
    @JouleV the OP is using \left/right which cannot be broken. A lot of users does not know that. – daleif Apr 24 '19 at 15:10
1

Another possibility, with geometry (for more sensible margins) and nccmath (for medium-sized formulæ, ~80 % of \displaystyle, and the fleqn environment):

\documentclass[a4paper]{article}
\usepackage[ showframe]{geometry}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{mathtools, nccmath}

\begin{document}

\begin{subequations}\label{eqn:MagneticField3D}
\begin{fleqn}
    \begin{gather}
\raisetag{11.5ex}
\begin{aligned}
B_{x}(r,x)= \medmath{\frac{N I \mu_{0}}{2\pi} \! \left(\frac{1}{\sqrt{(a+r)^{2}+\bigl(x-\mfrac{d}{2}\bigr)^{2}}}\Biggl(\mathcal{K}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr) + \frac{a^{2}-r^{2}-\bigl(x-\mfrac{d}{2}\bigr)^{2}}{(a-r)^{2}+\bigl(x-\mfrac{d}{2}\bigr)^{2}} \mathcal{E}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr)\Biggr) \right.} \\
  \medmath{-\left. \frac{1}{\sqrt{(a+r)^{2}+\bigl(x + \mfrac{d}{2}\bigr)^{2}}}\Biggl(\mathcal{K}\Bigl(k\bigl(r,x + \mfrac{d}{2}\bigr)^{2}\Bigr) + \frac{a^{2}-r^{2}-\bigl(x + \mfrac{d}{2}\bigr)^{2}}{(a-r)^{2}+\bigl(x + \mfrac{d}{2}\bigr)^{2}} \mathcal{E}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr)\Biggr)\! \right)}
\end{aligned}\\[3ex]
\raisetag{11.5ex}
        \begin{aligned}B_{r}(r,x)= \medmath{\frac{N I \mu_{0}}{2\pi r} \! \left(\frac{x-\mfrac{d}{2}}{\sqrt{(a+r)^{2}+\bigl(x-\mfrac{d}{2}\bigr)^{2}}}\Biggl(-\mathcal{K}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr) + \frac{a^{2}-r^{2} + \bigl(x-\mfrac{d}{2}\bigr)^{2}}{(a-r)^{2}+\bigl(x-\mfrac{d}{2}\bigr)^{2}} \mathcal{E}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr)\Biggr) \right.}\\
\medmath{\left. -\frac{x + \mfrac{d}{2}}{\sqrt{(a+r)^{2}+\bigl(x + \mfrac{d}{2}\bigr)^{2}}}\Biggl(-\mathcal{K}\Bigl(k\bigl(r,x + \mfrac{d}{2}\bigr)^{2}\Bigr) + \frac{a^{2} + r^{2} + \bigl(x + \mfrac{d}{2}\bigr)^{2}}{(a-r)^{2}+\bigl(x + \mfrac{d}{2}\bigr)^{2}} \mathcal{E}\Bigl(k\bigl(r,x-\mfrac{d}{2}\bigr)^{2}\Bigr)\Biggr)\! \right)}
    \end{aligned}
    \end{gather}
\end{fleqn}
\end{subequations}

\end{document} 

enter image description here

| improve this answer | |

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.