[pdftex] TeX output as Java graphic
jeffmcarthur at comcast.net
Fri Dec 5 17:33:05 CET 2003
On Thu, 4 Dec 2003 21:33:44 -0500, you wrote:
>How hard would it be to pull out the code from TeX that typesets small
>snippets of text (the primitives, I guess it would be) so that I could
>pass a string like "$x^2+y^2=25$" (or its MathML equivalent) and a
>starting point and have that small image be typeset correctly at that
>point. Is anyone aware of anybody doing something like this or leaning
>in that direction?
Why pull out the code, just use TeX. Try this:
That will leave the 1in offsets on the page. This is a bit longer:
That will shipout into the DVI file the equation in an hbox. The page size
will be just the size of the equation.
>I've looked at MathML and I must say I'm rather disappointed in the
>lack of open source tools, and the relatively low quality of the
>renderers that currently exist. Maybe I've missed something. If so,
>please correct me. If not, would someone be willing to answer questions
>about how everything hangs together in TeX so my student and I could
>get a handle on what data structure we'd need to set up and which
>primitives we'd have to implement so that we could do small snippets of
>arbitrary math fairly easily.
MathML is XML which implies Unicode. That sort of assumes you would be
working in UTF-8. If you are working in another encoding, you are on you
own. Typesetting UTF-8 Unicode with TeX can be done. I wrote the code to
typeset the Library of Congress Subject Heading books in TeX:
The hardest part about Unicode is finding the glyphs and/or fonts you need.
The Unicode 4.0 standard still does not have many of the glyphs needed for
the Library of Congress Subject Heading book. Since the glyphs are not part
of the standard they are not in in Unicode font. You have to draw and/or
build them yourself. When I did the Library of Congress Subject Headings I
used virtual fonts to create the needed glyphs which I built from several
other fonts and used scaling and placement. That was a lot of work.
For the simple stuff you are describing, why not just use TeX and the DVI
previewer written in Java?
More information about the pdftex