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'm compiling .tex with pdftex and to align some PNG images created with dvipng (I love it's speed), I need to use the --depth value from this utility. But as I can read, correct values are output only when using preview-latex.

I also tried the standalone class, but the pages are all joined and I need them splitted as dvipng output, if the previw package is off.

Is there another possibility?

share|improve this question
    
Have you read the manual page of dvipng? It offers several options for making use of baseline information. –  user9588 May 12 '12 at 12:28
add comment

2 Answers

The TeX code referred to above is too long for the comment, so I'm putting it here. The original PHP version is in class.latexrender_offset.php at LaTeX Plugin for DokuWiki:

\documentclass[10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{mathrsfs}
\usepackage{color}
\pagestyle{empty}
\newsavebox{\formulabox}
\newlength{\formulawidth}
\newlength{\formulaheight}
\newlength{\formuladepth}
\setlength{\\topskip}{0pt}
\setlength{\parindent}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\definecolor{MyRed}{rgb}{0.408,0.094,0.059}    // For colored output
\begin{lrbox}{\formulabox}
{\color{MyRed}                                // For colored output
$latex_formula
}                                              // For colored output
\end{lrbox}
\settowidth {\formulawidth}  {\usebox{\formulabox}}
\settoheight{\formulaheight} {\usebox{\formulabox}}
\settodepth {\formuladepth}  {\usebox{\formulabox}}
\\newwrite\foo
\immediate\openout\foo=\jobname.depth
\addtolength{\formuladepth} {1pt}
\immediate\write\foo{\the\formuladepth}
\closeout\foo
\begin{document}
\usebox{\formulabox}
\end{document}
share|improve this answer
add comment

Have a look at The baseline problem corrected which discusses in detail how to adjust the image baseline. LaTeX Plugin for DokuWiki is an implementaion of this in PHP.

share|improve this answer
    
Thank's for the answer but in that article preview latex is used to handle multi-line conent into one instance (page). I need to split them to know the single-line baseline. Any other suggestion ? Thank's –  Flavio Aug 9 '11 at 23:08
    
The second link doesn't use preview latex. It uses LatexRender to obtain the image but the same technique as the first link to obtain the baseline. It uses the TeX code in the answer below to put the baseline information of a single formula into a depth file. –  stevem Aug 10 '11 at 12:45
    
Really thank's, i'll study linked php code! –  Flavio Aug 20 '11 at 17:15
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.