4

I have a large formula in align:

\begin{align}
\overline{r}_D(n_D) = \begin{cases}
r_D(n_D)  & \textrm{ if } r_D(n_D)  < b_{min} \\
\max\{b_{min} , \max \{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), \; 1\leq l \leq m\}\}& \textrm{otherwise} 
\end{cases}
\nonumber
\end{align}

And it looks like this:

enter image description here

It overlaps with the the column on the right. How can I fix it ?

EDIT:

Here is the compilable script:

\documentclass[10pt,a4paper,twocolumn]{IEEEtran}

\usepackage{graphicx,amssymb,amsmath,amsfonts,mathtools, bm}


\begin{document}


Postremo ad id indignitatis est ventum, ut cum peregrini ob formidatam haut ita dudum alimentorum inopiam pellerentur ab urbe praecipites, sectatoribus disciplinarum liberalium inpendio paucis sine respiratione ulla extrusis, tenerentur minimarum adseclae veri, quique id simularunt ad tempus.


\begin{align}
\overline{r}_D(\vec{n}) = \begin{cases}
r_D(\vec{n})  & \textrm{ if } r_D(\vec{n})  < b_{min} \\
\max\{b_{min} , \max \{b_{l-f(\rho_E)} \mid b_l \leq r_D(\vec{n}), \; 1\leq l \leq m\}\}& \textrm{otherwise} 
\end{cases}
\nonumber
\end{align}

Postremo ad id indignitatis est ventum, ut cum peregrini ob formidatam haut ita dudum alimentorum inopiam pellerentur ab urbe praecipites, sectatoribus disciplinarum liberalium inpendio paucis sine respiratione ulla extrusis, tenerentur minimarum adseclae veri, quique id simularunt ad tempus, et tria milia saltatricum ne interpellata quidem cum choris totidemque remanerent magistris.


\end{document}
  • 3
    Could you please make you script compilable? because I think it has to do with the gemoetry of the page. Without that, I think, it is very hard to answer your question. – Raaja Aug 6 at 13:29
  • Don't use align for a single line display; cases doesn't qualify for multiline. – egreg Aug 6 at 13:48
  • 1
    @Raaja I edited the question – A.Afaf Aug 6 at 13:53
6

I would suggest using a temporary variable

Sample output

\documentclass{amsart}

\begin{document}

Text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
\begin{align}
  {r}_D(n_D)
  =
  \begin{cases}
    r_D(n_D),  & \textrm{ if } r_D(n_D)  < b_{\min}, \\
    \max\{b_{\min},c\},& \textrm{otherwise},
  \end{cases}
\nonumber
\end{align}
where
\( c = \max\{ b_{\ell-f(\rho_E)} \mid b_\ell \leq r_D(n_D), \; 1\leq
\ell \leq m \} \).

\end{document}
7

You can move “otherwise” to another line, adding some vertical space for better clarity.

\documentclass{article}
\usepackage{amsmath}

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum*[1][1-3]
\begin{equation*}
\overline{r}_D(n_D) =
\begin{cases}
\begin{alignedat}{2}
&r_D(n_D) && \text{if $r_D(n_D)  < b_{\min}$} \\[2ex]
&\!\max\{b_{\min}, \max \{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), 1 \leq l &&\leq m\}\} \\
 &&& \text{otherwise}
\end{alignedat}
\end{cases}
\end{equation*}
\lipsum*[2]

\end{document}

enter image description here

For two-column output, you need some more. Something like

\max \{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), 1 \leq l \leq m\}

should be given a name; choose what you like more, here I use B(n_D,m).

\documentclass[a4paper]{IEEEtran}
\usepackage{amsmath}
\usepackage{newtxtext,newtxmath}

\usepackage{lipsum} % for mock text

\begin{document}

\lipsum*[1][1-3]
\begin{align*}
&\overline{r}_D(n_D) =
\begin{cases}
r_D(n_D) & \text{if $r_D(n_D)  < b_{\min}$,} \\
\max\{b_{\min}, B(n_D,m)\}& \text{otherwise,}
\end{cases}
\\
&B(n_D,m)=\max \{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), 1 \leq l \leq m\}.
\end{align*}
\lipsum*[2][1-3]
\lipsum[4-9]

\end{document}

Note I used newtxtext and newtxmath to avoid (horrible) formulas in Computer Modern along with Times for text.

enter image description here

  • If it was only the "otherwise" I would have adopted your solution, but I think I will have to do the same for the "if" condition as it overlaps also. I don't know how it is going to be perceived. – A.Afaf Aug 6 at 13:44
  • @A.Afaf You should make clear that you're using a two column format; also, please, add the document class you're using. – egreg Aug 6 at 13:50
  • I am sorry I edited my question – A.Afaf Aug 6 at 13:54
4

You can write this equation smaller by help of macro \medmath{...} from the package nccmath:

enter image description here

(red lines indicate text borders)

\documentclass{amsart}
\usepackage{nccmath}

\usepackage{lipsum}
\begin{document}
\lipsum[66]
\begin{align*}
    \medmath{
\overline{r}_D(n_D) = \begin{cases}
r_D(n_D)  
    & \text{ if } r_D(n_D)  < b_{\min} \\
\max\bigl\{b_{\min}, \max\{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), \; 1\leq l \leq m\}\bigr\}
    & \text{otherwise}
\end{cases}
            }
\end{align*}
\end{document}

Edit: After your editing of your question only answer of Andrew Swann (+1) can solve your problem. To his solution (and your new MWE) I can only add some off-topic remarks (see comments in code below):

\documentclass[10pt,a4paper]{IEEEtran} % it is default twocolumn
\usepackage{amssymb,    % load amsfonts too
            mathtools,  % it is supersede of the amsmath, no need to load it (again) 
            bm}
\usepackage{graphicx}

\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{align*}          % no numbered
\overline{r}_D(n_D) = \begin{cases}
r_D(n_D)  
    & \text{ if } r_D(n_D)  < b_{\min} \\
\max\bigl\{b_{\min}, c_{\max}\bigr\}
    & \text{otherwise}
\end{cases}
\end{align*}
where $c_{max}=\max\{b_{l-f(\rho_E)} \mid b_l \leq r_D(n_D), \; 1\leq l \leq m\}$. 

\lipsum[2-7]
\end{document}

which gives:

enter image description here

  • Thanks, it makes the equation smaller, but that's not enough in my case: I am using two column format (see EDIT in my post) – A.Afaf Aug 6 at 14:02
  • 2
    @A.Afaf, now you see, that our request for MWE is not trivial. How we should know how your document looks? Now only Andrew Swann answer is sensible... – Zarko Aug 6 at 14:06
  • I am sorry I edited my question after realising it – A.Afaf Aug 6 at 14:13
  • There is only Y at the start: Can you edit your question with "Yes"? :-) – Sebastiano Aug 6 at 16:27
  • 1
    @Sebastiano, thank you very much for the tip. Corrected (Y --> You). – Zarko Aug 6 at 18:54

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.