TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been using dvipng to produce png images of latex equations to be embedded in html, and the output is very nice. However, for equations with a fraction, the non-fraction side produces a font which is too big, almost as though it has expanded to respect the height of the fraction. My latex is:




$\nabla \times \mathbf{E} = \frac{\rho}{\varepsilon_0}$


and my command line arguments are

latex file.tex
dvipng -D 200 file.dvi -T tight -bg transparent

So for example, in this Maxwell equation, the 'del cross E' is noticably too large, whereas in a normal latex document this problem does not exist.


Is there anything wrong with my input?

share|improve this question
Load amsmath and write \dfrac instead of \frac; does it do what you're looking for? – egreg May 5 '12 at 16:04
@egreg Yes, in fact that appears to work! Thank you. – Commander Data May 5 '12 at 16:07
up vote 2 down vote accepted

You're probably comparing this result with what you get when writing

\nabla \times \mathbf{E} = \frac{\rho}{\varepsilon_0}

When TeX typesets a formula to be displayed, as in the example above, it uses \displaystyle where fractions are bigger. The input

$\nabla \times \mathbf{E} = \frac{\rho}{\varepsilon_0}$

produces a formula typeset in \textstyle, where fractions are reduced in size because the formula is supposed to be printed inline and large objects would spoil the pagination balance. Moreover, in \textstyle exponents are a bit lower than in \displaystyle.

You have two choices:

$\displaystyle\nabla \times \mathbf{E} = \frac{\rho}{\varepsilon_0}$


$\nabla \times \mathbf{E} = \dfrac{\rho}{\varepsilon_0}$

(requires \usepackage{amsmath}): the \dfrac command typesets the fraction as if it were given in \displaystyle.

In this particular case there will be no difference among the two; there would be a slight difference if exponents are involved and a big difference for "big operators" such as \sum. Take your pick.

share|improve this answer
Nice explanation, much appreciated. I now understand why the problem existed, as well as how to remedy the problem. – Commander Data May 5 '12 at 16:18
Please, have a look at the site FAQ, particularly to tex.stackexchange.com/faq#howtoask – egreg May 5 '12 at 16:21

Your Answer


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.