1

My goal is to write a one-column equation in a two-column document class. I have used the following answer: https://www.researchgate.net/post/How_to_make_equation_one_column_in_two_column_paper_in_latex .

\usepackage{lipsum, mathtools, cuted}
\begin{strip}
\begin{equation}
                        Your equation goes here
\end{equation}
\end{strip}

But when I use a table in between, it overwrites the equation. Is it possible to prevent this?

My sample code:

\documentclass[twocolumn]{article}
\usepackage{color, etoolbox, lipsum, mathtools, geometry}
\usepackage{cuted, textcomp, setspace, longtable, tabularx, array}
\begin{document}
\begin{center}
    \begin{singlespace}
        \begin{tabular}{ c c c }
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
        \end{tabular}
    \end{singlespace}
\end{center}

\begin{strip} [ a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q ] \end{strip} \begin{equation} \begin{aligned} f(x)= \begin{cases} 1 & \text{if}\ \text{x=0} \ 0 & \text{otherwise}. \end{cases} \end{aligned} \end{equation} \end{document}

AS you can see in the output, my table merges with the whole page equation:

enter image description here

Is it possible to prevent this, where tables and the long equation won't write on top of each other?

Please note that firstly I have tried widetext from this solution: One column equation in twocolumn document class ; but I have received following error: ! LaTeX Error: File 'widetext.sty' not found.

alper
  • 1,389
  • It seems you can have up to 18 rows in your table without overwriting the equation. – Bernard Apr 21 '22 at 10:43
  • Ah in my original file there is one table which has exact 19 rows I believe that one was causing an issue. Is it possible to extend 18 rows update 25 ? – alper Apr 21 '22 at 10:45
  • I have no idea which parameter controls the number of allowed rows. May be with a longtable it would work? – Bernard Apr 21 '22 at 10:59
  • I do have similiar issue with >18 rows algorithm definition – alper Apr 21 '22 at 11:00
  • I found that if I added some text, such as \lipsum[1] before your code for the tabular and \lipsum[1-4] the end of your document it worked OK. I have no idea why but feel that it might have something to do with the definition of the strip environment (wherever that came from). BTW you have use several packages multiple times so your MWE needs clearing up. – Peter Wilson Apr 22 '22 at 17:50
  • I cleared up multiple packages. When I play around the order in some cases works too. I put a wrong link for the approach I tried. Originally I was not able to use widetext package had this issue:(File 'widetext.sty' not found) so I was looking for another solution, strip came from some comment of a user I found in internet from here: https://www.researchgate.net/post/How_to_make_equation_one_column_in_two_column_paper_in_latex ; – alper Apr 22 '22 at 19:52

1 Answers1

1

Maybe using multicol is a nice and easy workaround:

\documentclass{article}
\usepackage{lipsum, mathtools}
\usepackage{setspace}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
\lipsum[1]
\begin{center}
    \begin{singlespace}
        \begin{tabular}{ c c c }
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
            a & b & c \\
        \end{tabular}
    \end{singlespace}
\end{center}
\end{multicols}
\[
    a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q
\]
\begin{equation}
    \begin{aligned}
        f(x)=
        \begin{cases}
            1 & \text{if}\ \text{x=0} \\
            0 & \text{otherwise}.
        \end{cases}
    \end{aligned}
\end{equation}
\begin{multicols}{2}
\lipsum[1]
\end{multicols}
\end{document}

enter image description here

Of course, this is technically not a two-column document. Instead, we can just take a one-column document and add the two-column parts around basically all text that is not your equation.

TiMauzi
  • 841