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 wanted to type an equation in LaTeX. But it is too long to fit into one line. It involves big arrays with many columns so I cannot split it. I wanted to reduce the font size so that it can fit in one line. However, \small doesn't work in the equation environment.

share|improve this question
5  
Can we see the actual equation? Perhaps we could then suggest some alternatives. –  Gonzalo Medina Jun 19 '12 at 20:31
    
Will \scriptstyle and \scriptscriptstyle work? –  azetina Jun 19 '12 at 20:31
4  
as a last resort, just pack the whole thing into a \scalebox and shrink as much as necessary. rewriting as much as possible would be advisable first. –  barbara beeton Jun 19 '12 at 20:38
    
I agree with Gonzalo, don't scale unless nothing else can be done. If the equation is so large that scaling is needed, chances are that scaling the equation will not make it be more understandable for the reader. In most cases a rewrite is a better option. –  daleif Jun 20 '12 at 14:49

3 Answers 3

Just put \small before the equation and \normalsize after it if you want to shrink the font, but it's usually better to use an ams multi-line equation environment than to change font size.

It's actually easier to only do the part of a size change command that affects math without changing the baseline to avoid the problems @barabara-beeton mentions. This is a \tiny (5pt) equation in a \large paragraph text, to highlight the differences, and to show that the above and below display skips are not altered.

enter image description here

\documentclass{article}

\showoutput
\showboxdepth3

\begin{document}
\large

hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
$$abc+xyz=44$$
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 

hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
\begingroup\makeatletter\def\f@size{5}\check@mathfonts
$$abc+xyz=44$$\endgroup
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 


\end{document}

with AMS align this would produce: enter image description here

\documentclass{article}
\usepackage{amsmath}

\showoutput
\showboxdepth3

\begin{document}
\large

hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
\begin{align}
abc&+xyz&&=44\\
x&-y&&=2\\
a&+b&&=77
\end{align}
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 

hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
hghghga hghghga hghghga hghghga hghghga hghghga hghghga 
\begingroup\makeatletter\def\f@size{5}\check@mathfonts
\def\maketag@@@#1{\hbox{\m@th\large\normalfont#1}}%
\begin{align}
abc&+xyz&&=44\\
x&-y&&=2\\
a&+b&&=77
\end{align}\endgroup
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 
bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb bbbbbb 


\end{document}
share|improve this answer
    
however, unless there's a paragraph break before the display, the baselines of the preceding paragraph will be fouled up, and if there is a blank line/pargraph break before the display, the vertical space preceding the display will be fouled up, and a page break would also be allowed because of the paragraph break. there's no good (automatic) mechanism defined for this yes, as far as i know. –  barbara beeton Jun 19 '12 at 21:42
    
@barbarabeeton yes I was going to mention that. If there were a MWE I'd have probably shown it with a correction for baselinskip. I suppose I should make one. It can't be that hard can it to insert a par while preserving the predispolay skip. –  David Carlisle Jun 19 '12 at 22:15
    
@barbarabeeton something like the code in the updated answer? –  David Carlisle Jun 19 '12 at 23:08
    
make it a 3-line display and i'll be happier. –  barbara beeton Jun 20 '12 at 13:04
    
@barbarabeeton 3 line display added, so you should be happy, but I guess you wanted tighter line spacing in the display? –  David Carlisle Jun 20 '12 at 13:58

Similar to How to make math font huge, you can use \scalebox to scale down the equation, or \resizebox the box to a specific width to reduce the size. The first is the normal display mode equation, followed by the scaled version with \scalebox and \resizebox:

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%
\newcommand*{\Resize}[2]{\resizebox{#1}{!}{$#2$}}%
\begin{document}
\[y = \sin^2 x\]
%
\[\Scale[0.5]{y = \sin^2 x}\]
%
\[ \Resize{1cm}{y = \sin^2 x}\]
\end{document}
share|improve this answer
1  
Perhaps you could also mention \resizebox{\textwidth}{!}{...} to not have to guess scaling factors. –  Gonzalo Medina Jun 19 '12 at 21:00
2  
And use \sin, please! :) –  egreg Jun 19 '12 at 21:02
    
@GonzaloMedina: Done. –  Peter Grill Jun 19 '12 at 21:37
    
@egreg: How embarrassing! Have corrected it. –  Peter Grill Jun 19 '12 at 21:37
    
@PeterGrill ;-) –  egreg Jun 19 '12 at 21:38

The following illustrates font size alterations in mathmode:

\documentclass[letterpaper]{article}
\usepackage{graphicx}               % Necessary to use \scalebox
\usepackage{amsmath,amssymb}
\begin{document}
\noindent 
normal: $ x^2 + 2xy + y^2 $\\
displaystyle: $ {\displaystyle x^2 + 2xy + y^2} $\\
scriptstyle: $ {\scriptstyle x^2 + 2xy + y^2} $\\
scriptscriptstyle: $ {\scriptscriptstyle x^2 + 2xy + y^2} $\\
textstyle: $ {\textstyle x^2 + 2xy + y^2} $

\noindent
\scalebox{0.5}{%
normal: $ x^2 + 2xy + y^2$}
\end{document}

This yields:

enter image description here

Note that:

  • \displaystyle gives the command to switch the math font size to normal size for displayed formulas.
  • \textstyle is used to go back to normal size font for inline formulas.
  • \scriptstyle is used to set the math font to a size used for subscripted and superscripted symbols.
  • scriptscriptstyle provides the normal size for doubly subscripted and superscripted symbols.

When using the \scalebox command from the graphicx package one can specify the width (or height) and the other dimension will be scaled proportionally. In a similar manner you can specify both dimensions, but in this case it is all about aesthetics. Therefore we have the following under the \scalebox command:

  • \scalebox{h-dimension}{v-dimension}{content to be scaled}: both dimension stated.
  • \scalebox{h-dimension}{content}: both arguments (h-dim and v-dim) scaled with respect to the stated dimension.
share|improve this answer

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.