LaTeX forum ⇒ Generallong 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

Postby ozeal » Fri Oct 17, 2008 5:02 am

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:

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

Postby jhristov » Fri Nov 21, 2008 9:51 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):
  1. \begin{widetext}
  2. \begin{equation}
  3. ...
Attachments
wide_equation.jpg
wide_equation.jpg (27.05 KiB) Viewed 36720 times
Last edited by cgnieder on Mon Oct 29, 2012 11:57 am, edited 2 times in total.
Reason: added code markup, scaled image

User avatar
Juanjo
Posts: 656
Joined: Sat Jan 27, 2007 12:46 am

Postby Juanjo » Fri Nov 21, 2008 11:58 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:
  1. \documentclass{article}
  2. \usepackage[margin=3cm]{geometry}
  3. \usepackage{lipsum,amsmath,multicol}
  4. \begin{document}
  5.  
  6. \begin{multicols}{2}
  7. \lipsum[1-3]
  8. \end{multicols}
  9. \par\noindent\rule{\dimexpr(0.5\textwidth-0.5\columnsep-0.4pt)}{0.4pt}%
  10. \rule{0.4pt}{6pt}
  11.  
  12. \begin{equation}
  13. \mathcal{R}^{(\text{d})}=
  14. g_{\sigma_2}^e
  15. \left(
  16. \frac{[\Gamma^Z(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}
  17. +\frac{[\Gamma^Z(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}
  18. \right)
  19. + x_WQ_e
  20. \left(
  21. \frac{[\Gamma^\gamma(3,21)]_{\sigma_1}}{Q_{12}^2-M_W^2}
  22. +\frac{[\Gamma^\gamma(13,2)]_{\sigma_1}}{Q_{13}^2-M_W^2}
  23. \right)\;. \label{eq:wideeq}
  24. \end{equation}
  25.  
  26. \vspace{\belowdisplayskip}\hfill\rule[-6pt]{0.4pt}{6.4pt}%
  27. \rule{\dimexpr(0.5\textwidth-0.5\columnsep-1pt)}{0.4pt}
  28. \begin{multicols}{2}
  29. \lipsum[4-5]
  30. \end{multicols}
  31.  
  32. \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:

Postby ceke » Sat Nov 22, 2008 8:28 pm

This will also do the trick. It takes some manual fiddling to get the equation numbering right, but it should work.
/JC

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

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

Postby ozeal » Mon Nov 24, 2008 1:43 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.
Reason: added inline code markup

timur
Posts: 7
Joined: Tue Sep 20, 2011 10:42 am

Postby timur » Mon Oct 29, 2012 11:33 am

Can anybody please suggest how to implement equation two-column spanning this very way?

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

Thanks in advance!


Return to “General”

Who is online

Users browsing this forum: No registered users and 10 guests