LaTeX Page Size --- how do I produce a page that is "just big enough"?
Asked Answered
M

2

10

I was learning about using the command line version of latex today, and I was experimenting with outputting .tex to .dvi, and then .dvi to .png.

The problem is, I have a simple .tex document which contains some math. The goal is to eventually produce a png form of the equation. But when I run:

$ latex -output-format=dvi test.tex
$ dvipng test.dvi

I get test1.png that is shaped like a regular letter-sized page. I only want an image that is as big as the equation needs to be. I'm sure I'm missing something obvious, but I can't figure it out!

Is there a command line option for either latex or dvipng to specify that the output file should only be set on a page as large as needed to render the equation?

Here's my example test.tex:

\documentclass{article}
\begin{document}
The solution to $\sqrt{x} = 5$ is $x=25$.
\end{document}

Thanks!

Molluscoid answered 6/2, 2010 at 22:28 Comment(0)
S
10

Try

dvipng -T tight filename

EDIT: As Mr tur1ing points out, you'll also want \pagestyle{empty} to avoid having a page number muck up the works.

Sanmicheli answered 6/2, 2010 at 22:31 Comment(0)
B
1

Try mathurl and Roger's Online Equation Editor. There probably several other such sites.

Bruell answered 7/2, 2010 at 23:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.