2

I am writing few equations and it's coming out of column in overleaf.

enter image description here

\begin{equation}
Loss_{\text {de}}=\sum_{i=1}^{N_{\text {steps}}} \sum_{b=1}^{B} \sum_{j=1}^{D} \frac{-\mathbf{M}_{\mathbf{b}, \mathbf{j}}[\mathbf{i}]}{N_{\text {steps}} \cdot B} \log \left(\mathbf{M}_{\mathbf{b}, \mathbf{j}}[\mathbf{i}]+\epsilon\right)
\end{equation}

enter image description here

\begin{equation}
X(k)=\sum_{n=0}^{N-1} x(n) w(n) e^{\frac{-2 \pi i k n}{N}}, \quad k=0,1, \ldots, N-1
\end{equation}

and

enter image description here

\begin{equation}
\hbar_{k}=-\sum_{n=1}^{N-1}\left(\hat{s}_{k}(n)^{2}\right) \ln \left(\hat{s}_{k}(n)^{2}\right), \quad 1 \leq n \leq N-1
\end{equation}

How can I modify those equations to make it looking good and small to fit in one column easily?

How to convert the first equation like this format?

enter image description here

0

1 Answer 1

3

(At the OP's request, I've edited my answer to provide a version of the first equation that places the limits of summation off to the right. Unsurprisingly, the result of this change is awful.)

  • For the first equation, I suggest you omit the \left and \right sizing directives (they do nothing but inflate the horizontal spacing, replace \cdot with \,, change Loss to \mathrm{Loss}, and use a \smashoperator{...} wrapper on the first summation term (to let the upper limit of summation protrude into the left-hand space). Conversely, I would add a bit of whitespace between , and \mathbf{j} in order to avoid a visual collision of the glyphs.

  • To place the limits of summation off to the right instead of above and below the \sum symbols in the first equation, simply change the 3 instances of \sum to \sum\nolimits (and remove the \smashoperator directive). Unsurprisingly, the equation no longer fits in a single line. Moreover, it just looks awful from a typographic perspective. But, as the saying goes, there's no arguing about tastes...

  • For the second equation, I suggest using a 2-row multline environment, writing \exp(...) instead of e^{\frac{...}{...}}, and encasing the sum term in a \smash[b]{...} directive in order to reduce the distance to the next row.

  • For the third equation, get rid of the \left and \right directives and get rid of the redundant parentheses around the first multiplicative term.

enter image description here

\documentclass[twocolumn]{article} % or some other suitable document class
\usepackage{mathtools} % for '\smashoperator' macro
\usepackage{lipsum}    % for filler text
\begin{document}
\lipsum[1] % produce a paragraph of filler text
\begin{equation}
\mathrm{Loss}_{\mathrm{de}}=
\smashoperator{\sum_{i=1}^{N_{\mathrm{steps}}}}
\sum_{b=1}^{B} \sum_{j=1}^{D} 
\frac{-\mathbf{M}_{\mathbf{b},\mkern1.5mu \mathbf{j}}[\mathbf{i}]}{%
   N_{\mathrm{steps}}\, B} 
\log (\mathbf{M}_{\mathbf{b},\mkern1.5mu \mathbf{j}}[\mathbf{i}]+\epsilon)
\end{equation}

\begin{equation} \tag{$1'$}
L_{\mathrm{sparse}}=
\sum\nolimits_{i=1}^{N_{\mathrm{steps}}}
\sum\nolimits_{b=1}^{B} \sum\nolimits_{j=1}^{D} 
\frac{-\mathbf{M}_{\mathbf{b},\mkern1.5mu \mathbf{j}}[\mathbf{i}]}{%
   N_{\mathrm{steps}}\, B} 
\log (\mathbf{M}_{\mathbf{b},\mkern1.5mu \mathbf{j}}[\mathbf{i}]+\epsilon) 
\end{equation}

\begin{multline}
X(k)=\smash[b]{\sum_{n=0}^{N-1}} x(n) w(n) \exp(-2 \pi i k n/N), \\
   k=0,1, \ldots, N-1
\end{multline}

\begin{equation}
\hbar_{k}=-\sum_{n=1}^{N-1}\hat{s}_{k}(n)^{2} \ln (\hat{s}_{k}(n)^{2}), 
   \quad 1 \leq n \leq N-1
\end{equation}
\lipsum[2-10] % more filler text
\end{document}
8
  • Hi, I am using first equation and getting "undefined control sequence" error. Commented Sep 23, 2020 at 22:41
  • Can you please take a look at edited question, how can I use N steps, B, D front of \sum as shown in new image? Commented Sep 23, 2020 at 23:01
  • @AadityaUra - Please see Show inline math as if it were display math (and vice versa).
    – Mico
    Commented Sep 23, 2020 at 23:53
  • @AadityaUra - On your first question: Did you load the mathtools package?
    – Mico
    Commented Sep 24, 2020 at 0:02
  • Yes, I used both mathtools and mathptmx. Can you edit your answer to show an example How to make that new equation image small with N steps, B, D front of \sum to fit in one column easily? Commented Sep 24, 2020 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .