https://bugzilla.wikimedia.org/show_bug.cgi?id=6636

Aleksey Sergushichev <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #6 from Aleksey Sergushichev <[email protected]> 2010-03-23 
18:26:47 UTC ---
(In reply to comment #4)
> I wrote a fix for this bug.  Random832's suggestion is good (use 
> vertical-align
> to set the baseline for math formulas rendered as images), but the question 
> is:
> how do you compute the baseline?  My idea is this: (1) underline the formula,
> on the baseline, in red, (2) write a tool invoked by texvc to find the
> underline (= baseline) in the image, and (3) call ImageMagick to strip out the
> underline in the final image, and (4) store the baseline in the math table for
> use when generating HTML linking to the image.
> 
> The result looks really good.  These changes are mixed with a bunch of others
> in a live wiki, but hopefully next week I'll have time to extract them and 
> post
> diffs.

There is a very simple way to compute baseline position. LaTeX has a standard
package called preview
http://www.gnu.org/software/auctex/manual/preview-latex.html#Package-options.
If a formula is in preview section latex put information about baseline to dvi
file. Then it can be extracted by dvipng with -depth option.

Example:
assa...@assaron:~/tmp$ cat ex.tex                   
\documentclass{article}
\usepackage[displaymath,active]{preview}
\begin{document}
\thispagestyle{empty}
\begin{preview}
$a_{a_a}$
\end{preview}
\end{document}

assa...@assaron:~/tmp$ latex ex.tex                 
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
 restricted \write18 enabled.
entering extended mode
(./ex.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, bulgarian, ukrainian, russian, loaded.
(/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size10.clo))
(/usr/share/texmf/tex/latex/preview/preview.sty) (./ex.aux)
Preview: Fontsize 10pt
[1] (./ex.aux) )
Output written on ex.dvi (1 page, 280 bytes).
Transcript written on ex.log.

assa...@assaron:~/tmp$ dvipng -T tight -depth ex.dvi
This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson
[1 depth=3]

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to