16

I have an equation in my document which is unbreakable and does not fit on one line using the twocolumn global option. Am I forced to shrink the text size here? And how do I go about doing it? \resizebox does not function in math mode.

http://i.imgur.com/Bbn2CZj.png?1

\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\sum_{q_\mathrm{total}=0}^{q_A+N_A+q_B+N_B-2}\left(\sum_{q_A=0}^{q_\mathrm{total}}\left(\binom{q_A+N_A-1}{q_A}\binom{q_B+N_B-1}{q_B}\right)\right)x^{q_\mathrm{total}}
\end{equation}
\end{document}
1010011010
  • 6,357

3 Answers3

36

The cuted package (from the sttools bundle) can temporarily leave two columns mode with its strip environment. An example with the equation entered in the second column:

\documentclass[twocolumn]{ltxdoc}
\usepackage{mathtools, cuted}
\usepackage{lipsum, color}

\begin{document}
\lipsum[1-2]

\lipsum[1]

\textsf{\color{red}Equation entered here: }

\begin{strip}
\begin{equation}
  \sum_{q_\mathrm{total}=0}^{q_A+N_A+q_B+N_B-2}\left(\sum_{q_A=0}^{q_\mathrm{total}}\left(\binom{q_A+N_A-1}{q_A}\binom{q_B+N_B-1}{q_B}\right)\right)x^{q_\mathrm{total}}
\end{equation}
\end{strip}

Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.

\lipsum[3-5]
\end{document} 

enter image description here

Bernard
  • 271,350
  • this example shows the wide display entered in the first column. the original question shows it occurring in the second column. can you adjust your example to reproduce that situation? – barbara beeton Aug 20 '14 at 15:54
  • @barbara beeton: see my updated answer. – Bernard Aug 20 '14 at 16:15
  • Is this solution better than the widetext environment? – Dr_Zaszuś Mar 07 '19 at 14:59
  • @Dr_Zaszuś: I don't know this environment, so I can't really tell. However, I've just read on this site that widetext is based on the strip environment. – Bernard Mar 07 '19 at 19:13
13

Resizebox should work.

\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{graphics}
\begin{document}
\lipsum[1]
\begin{equation}
\resizebox{0.5\textwidth}{!}{$\sum_{q_\mathrm{total}=0}^{q_A+N_A+q_B+N_B-2}\left(\sum_{q_A=0}^{q_\mathrm{total}}\left(\binom{q_A+N_A-1}{q_A}\binom{q_B+N_B-1}{q_B}\right)\right)x^{q_\mathrm{total}}$}
\end{equation}
\lipsum[2-4]
\end{document}

Or maybe consider splitting your equation.

  • 10
    It's what the OP asked for, but arbitrarily scaling text so it fits in a space is so evil :-( – David Carlisle Aug 20 '14 at 14:45
  • @DavidCarlisle From a typographic-aesthetic point of view? Or personal preference? – 1010011010 Aug 20 '14 at 19:25
  • 1
    @1010011010 All of above. It shouts as hey I couldn't fit it here so I scaled it, deal with it. Valid but says much about you instead of the equation :P – percusse Aug 20 '14 at 19:54
  • 3
    @1010011010 just ask yourself how many professionally typeset works you have seen where text elements are using arbitrarily scaled fonts to make the element fit the space rather than one of a limited number of matched design sizes. – David Carlisle Aug 20 '14 at 20:04
  • @percusse I may have chosen the wrong layout then.... :-( Going back from twocolumn would take days. – 1010011010 Aug 20 '14 at 20:40
  • 2
    @1010011010 Not really. There is always a better way. Logical argument chain is never too complicated to state concisely. Similar to what @tohecz said, define n=q_a+N_A-1 and m=q_b+N_B-1 then you only need n and m for the sum limits and binomials (or whatever single letter abbreviation you wish). It should then fit. – percusse Aug 20 '14 at 21:09
  • @percusse There's a second reasonable option: define A(x,y)=\binom{x+N_A-1}{x}\binom{y+N_B-1}{y} (or something like that, I'm a bit lost in the variables) in a separate displayed equation. That, with the removal of all the spurious parentheses, would likely be enough. /looking for my PLEASE DO NOT DO THIS banner/ – yo' Aug 20 '14 at 21:17
  • 1
    use \columnwidth within resizebox – remo Jul 31 '15 at 08:16
6

I don't think you have a much better option than this. Btw, you seem to use q_A for two different things.

enter image description here

\documentclass[twocolumn]{ltxdoc}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\sum_{q_\mathrm{tot}=0}^{Q_A+Q_B-2}\sum_{q_A=0}^{q_\mathrm{tot}}{\textstyle\binom{Q_A-1}{q_A}\binom{Q_B-1}{q_B}}x^{q_\mathrm{tot}},
\end{equation}
where $Q_A=q_A+N_A$ and $Q_B=q_B+N_B$.
\end{document}
yo'
  • 51,322
  • @Mico Well, it doesn't hurt :p But you're right that it should not be there. Thanks for pointing out :) – yo' Aug 20 '14 at 21:13