0

I have an equation which I intend to break into two lines, in a two column environment.

\begin{equation}
f(x, y) =  G_{min} + { \floor*{
                \left(
                    \frac{D(x, y) - D_{min}}{D_{th} - D_{min}} \times \eta 
                \right)  + 0.5} 
            \\
            \times \floor*{
                \frac{G_{max} - G_{min}}{\eta}
            }
        }
\label{eqn_1}
\end{equation}

egn_a

The above equation mixes into the right column from the left, which is understandable. To break the equation into multiple lines, I thus use multline:

\begin{multline}
f(x, y) =  G_{min} + { \floor*{
                \left(
                    \frac{D(x, y) - D_{min}}{D_{th} - D_{min}} \times \eta 
                \right)  + 0.5} 
            \\
            \times \floor*{
                \frac{G_{max} - G_{min}}{\eta}
            }
        }
\label{eqn_1}
\end{multline}

eqn_b

While this looks fine and is what I wanted, Overleaf shows me the two following errors:

Missing } inserted.
Extra }, or forgotten $.

Not quite sure how to resolve these two errors, as I can't insert $ inside multline, and nor can I find any unclosed { brackets.

What am I missing?

3
  • unrelated but use \min (or \mathrm{min}) and similarly for max. Don't use the default math italic for multi-letter identifiers. Jul 5, 2021 at 18:47
  • 3
    you have a missing } in the first row and an extra } in the second. Jul 5, 2021 at 18:50
  • @DavidCarlisle thank you! Using \min and \max actually resolved some other unrelated problems I was facing elsewhere as well.
    – Mercury
    Jul 5, 2021 at 19:45

2 Answers 2

4

Your equation hardly fits in a column. Your error was to have a line break in the equation within a group. Also, the indices min,max should be typed in roman style, and not as the product of three variables.

This being said, I would suggest another solution with aligned, and no alignment points, so the two lines will be right aligned, and replacing \times\eta with ,\eta`, to save some horizontal space:

 \documentclass[twocolumn]{article}
 \usepackage[hmargin=1in]{geometry} 
 \usepackage{mathtools}%
 \DeclarePairedDelimiter{\floor}\lfloor\rfloor

\begin{document}

    \begin{multline}
    f(x, y) = G_{\min} + \floor*{
                    \left(
                        \frac{D(x, y) - D_{\min}}{D_{th} - D_{\min}} \times \eta
                    \right) + 0.5}
                \\
                \times \floor*{
                    \frac{G_{\max} - G_{\min}}{\eta}
                }
    \label{eqn_1}
    \end{multline}

    \begin{equation}
    \begin{aligned}
    f(x, y) = G_{\min} + \floor*{
                    \left(
                        \frac{D(x, y) - D_{\min}}{D_{th} - D_{\min}} \,\eta
                    \right) + 0.5}
                \\
                \times \floor*{
                    \frac{G_{\max} - G_{\min}}{\eta}
                }
    \label{eqn_2}
    \end{aligned}
    \end{equation}

\end{document} 

enter image description here

1
  • Your second solution does look much more neat. Thank you!
    – Mercury
    Jul 5, 2021 at 19:46
2

(...) Overleaf shows me the two following errors:

(...) actually resolved some other unrelated problems I was facing elsewhere as well

In a situation like this I tend to do the following:

  • disable, e.g. by commenting out, deletion etc., one "half"
  • try, if it works
  • repeat with the other "half"
  • watching the results gives some clue, in which part I buit-in trouble
  • repeat this "halfening"-strategy with the suspected "half" until you zoomed in on at least one trouble maker.

The basic idea behind is to separate those segments which do work without errors and my own complaints from their opposite. Add parts from the segment, which does contain some obscure error, until problems become evident. Because it's a controlled stepwise process, resolution is near.

This works fine for me during programming, and even with documents I prepared with Framemaker some decades ago :)

Good luck.

BTW, this 1/2-strategy converges quickly (exponentially, more or less).

You must log in to answer this question.

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