## LaTeX forum ⇒ General ⇒ long equation across whole page in two-column document

LaTeX specific issues not fitting into one of the other forums of this category.
ozeal
Posts: 2
Joined: Fri Oct 17, 2008 4:17 am

### long equation across whole page in two-column document

G'day all,

I'm getting mad trying to achieve the following (I'm usually pretty good in getting what I want out of LaTeX but this time, no luck!).

I'm writing a two-column article that contains a big equation which I'd like to spread across the whole page in the text. Typically, the equation should stick out into the second column, with two horizontal rules drawn above and below the equation in the second column to separate the equation from the text. It'd basically look something like this:

text in first column. text   text in second column. texin first column. text in f   t in second column. text iirst column. text in first   n second column. text in scolumn. text in first colu   econd column. text in secomn.  text in first column.   Long equation:               ,_________________________     x = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11  text in first column. text   '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯in first column. text in f   irst column. text in first   nd column.  text in secondcolumn. text in first colu   column. text in second colmn.  text in first column.   ...

(the "," and " ' " at the beginning of the rules in the example above symbolize small dashes at right angle, to "show" which column the equation belongs to...).

I could bet my life I've seen several papers using this kind of layout, but of course can't find any right now. I'm also pretty positive I came across some package that would do exactly that a while ago, but again, impossible to get my hands on something similar (I've been doing frantic searches everywhere!).

I've found a few very specific document classes (for particular journals in physics, biometrics, etc.) that allow this (e.g. using the widetext environment), but I'm after something more generic, using e.g. the basic class 'article' (I'm actually using IEEEtran.cls, which instead suggests putting the equation in a figure* float, meaning that the equation would be moved somewhere else in the text).

Does anyone know if e.g. some package exists somewhere to achieve this?

Thanks very much for the help!

jhristov
Posts: 1
Joined: Fri Nov 21, 2008 9:38 am
Howdy,

I don't know the best way to do it in the general article class but here is the example from the Journal of Chemical Physics template (using REVTex 4):
\begin{widetext}\begin{equation}...
Attachments
wide_equation.jpg (27.05 KiB) Viewed 38770 times
Last edited by cgnieder on Mon Oct 29, 2012 11:57 am, edited 2 times in total.
Reason: added code markup, scaled image

Juanjo
Posts: 656
Joined: Sat Jan 27, 2007 12:46 am
After having a look at the doc provided by the Journal of Chemical Physics, I realize that revtex4 places wide formulas (or text) as follows: text before the formula is typeset in two balanced columns; then the formula is written along the full page width; finally, the text after the formula is again typeset in two columns. Since the flow of text goes from the first column to the second, comes backs to the first one and finally continues on the second, two horizontal rules are placed to guide the reader.

In the article class, a similar layout could be imitated with the help of the multicol package. Here there is some code, which, of course, can be improved:
\documentclass{article}\usepackage[margin=3cm]{geometry}\usepackage{lipsum,amsmath,multicol}\begin{document} \begin{multicols}{2}\lipsum[1-3]\end{multicols}\par\noindent\rule{\dimexpr(0.5\textwidth-0.5\columnsep-0.4pt)}{0.4pt}%\rule{0.4pt}{6pt} \begin{equation}\mathcal{R}^{(\text{d})}=  g_{\sigma_2}^e  \left(    \frac{[\Gamma^Z(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}   +\frac{[\Gamma^Z(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}  \right)  + x_WQ_e  \left(    \frac{[\Gamma^\gamma(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}   +\frac{[\Gamma^\gamma(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}  \right)\;. \label{eq:wideeq}\end{equation} \vspace{\belowdisplayskip}\hfill\rule[-6pt]{0.4pt}{6.4pt}%\rule{\dimexpr(0.5\textwidth-0.5\columnsep-1pt)}{0.4pt}\begin{multicols}{2}\lipsum[4-5]\end{multicols} \end{document}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.

ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am
Location: Luleå, SWEDEN
Contact:
This will also do the trick. It takes some manual fiddling to get the equation numbering right, but it should work.
/JC

\newcounter{mytempeqncnt}\section{Introduction}Bla bla... \begin{figure*}[!t]% ensure that we have normalsize text\normalsize% Store the current equation number.\setcounter{mytempeqncnt}{\value{equation}}% Set the equation number to one less than the one% desired for the first equation here.% The value here will have to changed if equations% are added or removed prior to the place these% equations are referenced in the main text.\setcounter{equation}{0}\begin{equation}\label{eqn_dbl_x} x = 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 + 21+ 23 +25 + 27 + 29 + 31\end{equation}\begin{equation}\label{eqn_dbl_y} y = 4 + 6 + 8 + 10 + 12 + 14 + 16 + 18 + 20+ 22 +24 + 26 + 28 + 30\end{equation}% Restore the current equation number.\setcounter{equation}{\value{mytempeqncnt}}% IEEE uses as a separator\hrulefill% The spacer can be tweaked to stop underfull vboxes.\vspace*{4pt}\end{figure*}
Last edited by cgnieder on Mon Oct 29, 2012 11:54 am, edited 1 time in total.

ozeal
Posts: 2
Joined: Fri Oct 17, 2008 4:17 am
Hi Guys!

thanks very much for your help. There's a couple of interesting suggestions here...

jhristov: yes, I'm aware that some document classes allow the use of \begin{widetext} for doing exactly that, which is actually very handy indeed (jasaTeX is another example). The problem is, I'd like to use a more generic document class this time around...

ceke: I think your solution is what is suggested by IEEEtrans.cls, but it puts the equation in a float, which is not quite the intended result...

Juanjo: that looks like an interesting implementation! I'll have a look at some stage. Among others, I'm not sure how easily this approach can be used in the frame of a document that's already declared as being 2-column. It also looks like this might involve significant fiddling to ensure that the page with the long equation fits seamlessly within the whole document (i.e. determine which portion of the document text goes into the two {multicols} environments for that particular page...) ... I guess hacking is one of the beauties of LaTeX!
Last edited by cgnieder on Mon Oct 29, 2012 11:58 am, edited 1 time in total.

timur
Posts: 7
Joined: Tue Sep 20, 2011 10:42 am
Can anybody please suggest how to implement equation two-column spanning this very way?

    text in first column. text   text in second column. tex     in first column. text in f   t in second column. text i     irst column. text in first   n second column. text in s     column. text in first colu   econd column. text in seco     mn.  text in first column.       Long equation:               ,_________________________         x = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11      text in first column. text   '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯     in first column. text in f       irst column. text in first   nd column.  text in second     column. text in first colu   column. text in second col     mn.  text in first column.   ...

The solutions offered here unfortunately do not help in creating a document where the long equations does not force the reader to switch between columns so often.