Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing an equaition which is too long-wide. I don't want it to split. I tried to change the fontsize within the equation enviroment but it didn't work. I am using

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\begin{document}
\begin{equation}
{\footnotesize G=centroid\cdot \frac{range[V]}{\#\,channels}\cdot\frac{W_{pair}[eV]}    {E_{particle}[keV]}\cdot \frac{1}{(coarse\,gain)\cdot(fine\,gain)}\cdot \frac{10^6}   {X[mV]\cdot E_{cg}[eV]}}
\label{eq:Gain}
\end{equation}
\end{document}

Is there a way to achieve that? My output is

Any ideas?

share|improve this question
    
It’s also a good idea to avoid using math italics to write normal text, as the kerning is different. Compare $if$ \emph{if}, and $rs$ \emph{rs}. Use of \text, as in the answers below, avoids this. –  Daniel Harbour Oct 10 '12 at 21:33
add comment

3 Answers

up vote 9 down vote accepted

You could set the fractions in \textstyle:

enter image description here

\documentclass[11pt]{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{equation}
  G=\textstyle\text{centroid}\cdot \frac{\text{range}[V]}{\text{\# channels}}\cdot
    \frac{W_{\text{pair}}[eV]}{E_{\text{particle}}[keV]}\cdot 
    \frac{1}{(\text{coarse gain})\cdot(\text{fine gain})}\cdot 
    \frac{10^6}{X[mV]\cdot E_{cg}[eV]}
\label{eq:Gain}
\end{equation}
\end{document}

(you may even consider using \small centroid as well) or scale it to fix using \resizebox from graphicx:

enter image description here

\documentclass[11pt]{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\begin{document}
\begin{equation}
  \resizebox{.9\textwidth}{!}{$\displaystyle
    G=\text{centroid}\cdot \frac{\text{range}[V]}{\text{\# channels}}\cdot
    \frac{W_{\text{pair}}[eV]}{E_{\text{particle}}[keV]}\cdot 
    \frac{1}{(\text{coarse gain})\cdot(\text{fine gain})}\cdot 
    \frac{10^6}{X[mV]\cdot E_{cg}[eV]}$}
\label{eq:Gain}
\end{equation}
\end{document}
share|improve this answer
    
Thank you very for your double approach to this issue!!!Thank you soooo much!It is working like a charm!!! –  Thanos Oct 6 '12 at 20:17
add comment

Package resizegather allows the automatically resizing the equation to line width, if the equation is too large:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{resizegather}
\begin{document}
\begin{gather}
G=centroid\cdot
\frac{range[V]}{\#\,channels}\cdot\frac{W_{pair}[eV]}
{E_{particle}[keV]}\cdot \frac{1}{(coarse\,gain)\cdot(fine\,gain)}\cdot
\frac{10^6}   {X[mV]\cdot E_{cg}[eV]}
\label{eq:Gain}
\end{gather}
\end{document}

Result

And with setting text and units as text and not as product of variables:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{resizegather}
\begin{document}
\begin{gather}
G=\text{centroid}\cdot
\frac{\text{range}[\text{V}]}{\#\,\text{channels}}\cdot
\frac{W_\text{pair}[\text{eV}]}{E_\text{particle}[\text{keV}]}\cdot
\frac{1}{(\text{coarse\,gain})\cdot
(\text{fine\,gain})}\cdot
\frac{10^6}   {X[\text{mV}]\cdot E_{cg}[\text{eV}]}
\label{eq:Gain}
\end{gather}
\end{document}

Also I have used the fonts Latin Modern instead of Computer Modern, because the kerning of eV is much better there.

Result

share|improve this answer
    
Thank you very much for your annswer!I tried to use this package, but to be quite frank I cannot see any difference. It is exactly the same, I'm afraid... –  Thanos Oct 6 '12 at 20:02
2  
There is only a difference, if the equation (as gather) is exceeding the line width. In the first example it is 67.5315pt and the second example it is 45.16924pt. Both values are quite high, remember scaling an equation down or using smaller font sizes are a last resort measure. It's disrupting the uniformity of the document. –  Heiko Oberdiek Oct 6 '12 at 20:14
    
Thank you very much for that comment!It is really useful and I'll keep it in mind while working with equations. Thank's!!! –  Thanos Oct 6 '12 at 20:19
add comment

Now this is a different approach. Practically I am cheating a bit by forcing LaTeX to ignore any proper page settings and go into the margins to fit the equation and its number into one line. I (ab)use the adjmulticol package for this to happen. Then everything return to normal:

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{lipsum}
\usepackage{adjmulticol}
\begin{document}
\lipsum[1]
\begin{adjmulticols}{1}{-2cm}{-2cm}
\begin{equation}
{\footnotesize G=centroid\cdot \frac{range[V]}{\#\,channels}\cdot\frac{W_{pair}[eV]}    {E_{particle}[keV]}\cdot \frac{1}{(coarse\,gain)\cdot(fine\,gain)}\cdot \frac{10^6}   {X[mV]\cdot E_{cg}[eV]}}
\label{eq:Gain}
\end{equation}
\end{adjmulticols}
\lipsum[2]
\end{document}

enter image description here

share|improve this answer
    
This is a very nice way of doing it!!!It can keep the same fontsize, which is something I like a lot!!! However I am having trouble with the package. Even if I install it and refreshing MikteX it doesn't seem to be working...Too bad... –  Thanos Oct 6 '12 at 20:10
    
@Thanos: I can't figure what could be wrong with it. So the MWE I provided does not compile at all? What kind of errors do you get? –  Count Zero Oct 6 '12 at 21:47
    
The typical error when a package isn't installed Package adjmulticol.sty not found...I believe it has to do with my system, because lately it does a lot of crazy stuff... –  Thanos Oct 7 '12 at 6:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.