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 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:

\documentclass[12pt]{article}

\usepackage{amssymb}
\usepackage{color}
\usepackage{amsfonts}

\pagestyle{empty}
\begin{document}

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

\end{document}

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.

image

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
add comment

1 Answer 1

up vote 1 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}$

or

$\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
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.