TTM(1)
π TTM(1) β TeX to MathML translator π
okay bestie, grab a boba, because this whole page is about ttm β the TeX/LaTeX β MathML translator β plus its little helper squad. it's giving academic but make it slay β¨
πΈ NAME πΈ
not one icon, not two, but four of them, bestie:
ttm,latex2gif,ps2gif,ps2pngβ TeX and LaTeX to MathML translator and its auxiliary programs π«Ά
β¨ SYNOPSIS β¨
here's how you summon them, exactly as written:
ttm [options] [<file.tex] [>file.xml] [2>err]
filter mode, feed it stdin, catch stdout, dump the drama on stderr π
ttm [options] file.tex [2>err]
or just hand it a file, queen π
latex2gif file (no extension)
ps2gif file.ps file.gif [icon.gif]
ps2png file.ps file.png [icon.png]
π DESCRIPTION π
first things first: the scripts latex2gif, ps2gif and ps2png live in the recommended package tth-common. noted, bestie π
ttm translates TeX source that uses the plain macro package or LaTeX β including most mathematics β into a near equivalent in MathML. the formal standard that TTM-translated documents follow is strictly HTML4.0 Transitional. periodt.
real talk: the complete documentation lives in ttm_manual.html, which is distributed with the program. this man page is an incomplete summary and gets updated on an irregular basis. [Last updated 1 May 2002 by Hans Fredrik Nordhaug.] π
the program is a filter, i.e. it reads from standard input and writes to standard output. and also, diagnostic messages about its detection of unknown or untranslated constructs get sent to standard error. so keep an eye on that stderr, diva π
when it's handling embedded graphical files, ttm can make use of auxiliary programs, ps2gif or ps2png, which in turn make use of the ghostscript interpreter gs (1) and the Portable Bitmap Graphics suite of commands, see pbm (1). it's a whole little ecosystem fr fr π¦
ttm is extremely fast in default mode on any reasonable hardware. conversion of even large TeX files should be a matter of a second or two. this makes it possible to use ttm in a CGI script to output MathML directly from TeX source if desired; (standard error may then need to be redirected.) main character energy, truly π
π TeX things ttm handles π
okay here's the roster, no skips:
- Almost all mathematics, including symbols, fractions, delimiters. π₯
{}\begingroup\endgroupgrouping.\it\bf\sletc styles.\beginsection.\centerline{}.\item{...}\itemitem{...}{\obeylines ...}.- Almost all accented latin characters written like
\"o, or\"{e}. \hang\hangindent\narrowerfor entire paragraphs (\hangafterignored).\headlineis made into a title.%Comments. Simply removed.\haligntables, checks template for the presence of\vrule, to decide if the table is to be border style.\settabs\+style tables.\input: But, of course, not from the implicittexinputspath.\newcount,\number,\advanceand counter setting.\def,\edef,\xdefbut no delimited arguments.- All definitions are global.
\matrix,\pmatrixbut not\bordermatrix.\cases.
π LaTeX support π
LaTeX support includes essentially all mathematics plus the following environments:
emverbatimcenterflushright[one paragraph only]versequotationquoteitemizeenumeratedescriptionlist[treated as if description]figuretabletabular[*,x]equationdisplaymatheqnarray[only one equation number]matharraythebibliography[raw]htmlindex[as description]
and LaTeX commands:
[re]newcommandnewenvironment[optional arg not permitted]chaptersectionsubsectionsubsubsectioncaptionlabelrefpageref[no number]emphtextittexttttextbfcenteringraggedleftincludegraphics[e]psfigtitleauthordate[not automatic]lefteqnfractableofcontentsinputinclude[as input]textcolorcolor[8 standard colors]footnote[ignoring optional arg]citebibitembibliographytiny ... normalsize ... Hugenewcounter[no ``within'' support]setcounteraddtocountervalue[inside set or addto counter]arabicthestepcounternewlineverb[*]bfseriesitshapettfamilytextscensuremathlistoftableslistoffiguresnewtheorem[no optional arguments permitted]todayprintindexboldmathunboldmathnewfontthanksmakeindexindex
hypertext cross-references within the document are automatically generated by (e.g.) ref, and tableofcontents. cute, right? π
when ttm encounters TeX constructs that it cannot handle β either because there is no MathML equivalent, or because it is not clever enough β it tries to remove the mess they would otherwise cause in the MathML code, generally giving a warning of the action if it is not sure what it is doing. Untranslatable TeX math tokens are inserted verbatim. so, like, don't be shocked when weird stuff shows up raw π
π¦ Independence of [La]TeX installation and the -L switch π¦
a major difference between ttm and latex2html is that ttm does not call the latex or tex programs at all by default, and is not specifically dependent upon these, or indeed any other (e.g. perl), programs being installed on the translating system. its portability is therefore virtually universal. self-sufficient queen π
forward references in LaTeX are handled by multiple passes that write auxiliary files. ttm does only a single pass through the source. if you want ttm to use LaTeX constructs (e.g. tableofcontents, bibliographic commands, etc.) that depend on auxiliary files, then you do need to run LaTeX on the code so that these files are generated. alternatively, the ttm switch -a causes ttm automatically to attempt to run latex on the file, if no auxiliary file .aux exists.
when run specifying a filename on the command line as a non-switch argument, ttm constructs the name of the expected auxiliary LaTeX files in the usual way and looks for them in the same directory as the file. if you are using ttm as a filter, you must tell ttm, using the switch -Lfilename, the base file name of these auxiliary files (which is the name of the original file omitting the extension). if ttm cannot find the relevant auxiliary file because you didn't run LaTeX and generate the files or didn't include the switch, then it will omit the construct and warn you. Forward references via ref will not work if the .aux file is unavailable, but backward references will.
the -L switch with no filename may be used to tell ttm that the document being translated is to be interpreted as a LaTeX file even though it lacks the usual LaTeX header commands. this may be useful for translating single equations that (unwisely) use the \frac command. π
π BibTeX bibliographies π
ttm supports bibliographies that are created by hand using \begin{thebibliography} etc. such bibliographies do not require anything beyond the .aux file. ttm also supports bibliographies created using BibTeX from a biblography database. the filename.bbl file is input at the correct place in the document.
however β and this is the part nobody warns you about β this filename.bbl is not created automatically by latex. in addition to running latex on the source file to create the auxiliary file, you must also execute bibtex filename in the same directory, to create the filename.bbl file, and then run latex again to get the references right. (this is, of course, no more than the standard procedure for using bibtex with latex but it must be done if you want ttm to get your bibliography right). if you don't create the .bbl file, or if you create it somewhere else that ttm does not search, then naturally ttm won't find it. π
since the BibTeX process is relatively tortuous, ttm offers an alternative. using the -a switch with ttm will cause it to attempt to generate the required .bbl file automatically using bibtex and latex. slay, automation π
there are many different styles for bibliographies and a large number of different LaTeX extension packages has grown up to implement them, which ttm does not support. more recently, a significant rationalization of the situation has been achieved by the package natbib. ttm has rudimentary support built in for its commands \citep and citet in the default author-date form without a second optional argument. a style file for natbib is distributed with TTMgold which makes it possible to accommodate most of its more useful styles and commands and easily switch from author-date citation to numeric citation. iconic, honestly π
π Indexing π
ttm can make an extremely useful hyperlinked index using LaTeX automatic indexing entries. but indexing an MathML document is different from indexing a printed document, because a printed index refers to page numbers, which have no meaning in MathML because there are no page breaks. TTM indexes LaTeX documents by section number rather than by page; assuming, of course, that they have been prepared with index entries in the standard LaTeX fashion. adaptation, she ate π
ttm will construct an index based on the standard LaTeX commands "\makeindex" and "\index{...}", and automatically process it and read it in when "\printindex" is encountered. the command line for calling the makeindex program (not part of this distribution) may be changed using the -x switch. for a file without the "\makeindex" command, ttm will write no index files, just read in an existing one "file.ind" if it exists.
πΌοΈ Graphics inclusion: epsfbox/includegraphics πΌοΈ
the standard way in plain TeX to include a graphic is using the epsf macros. the work is done by \epsfbox{file.ps} which ttm can parse. by default ttm produces a simple link to such a postscript file, or indeed any format file. lowkey minimal, love that for her β¨
optionally TTM can use a more appropriate graphics format, by using ps2gif or ps2png to convert the postscript file to a png or gif file, "file.png" or file.gif". when the switch -e1 or -e2 is specified, if file.png, file.gif or file.jpg already exists in the same directory as implied by the reference to file.ps then no conversion is done and the file found is used instead. that graphics file is then automatically either linked (-e1) or inlined (-e2) in the document. if no such file is found, TTM tries to find a postscript file with extension that starts either .ps or .eps and convert it, first using ps2png then, if unsuccessful, ps2gif. by popular request, a third graphics option -e3 for generating icons is now available. the people asked, and she delivered π
the LaTeX command \includegraphics{...} and the older \[e]psfig{file=...} are treated the same as \epsfbox. their optional arguments are ignored. no notes. π
π¨ Picture Environments π¨
the picture environment cannot be translated to MathML. pictures using the built-in LaTeX commands must be converted to a graphics file such as a gif or png, and then included using \includegraphics. the switch -a causes ttm to attempt automatic picture conversion using latex2gif. workaround queen π«Ά
β¨ OPTIONS β¨
okay bestie here's the whole menu, buckle up π every single flag, no skips, no cap:
-aβ tries to auto-convert picture environments for u. default is omit (so like, off).-cβ slaps the header"Content-type: text/MathML"at the top, for when you're serving it straight to the web π.-dβ disables definitions with delimited arguments. default is enable, so they're on unless you say otherwise.-e?β the epsfbox handling squad πΌοΈ:-e1converts the figure to png/gif using your user-suppliedps2png/ps2gif.-e2converts it and includes it inline.-e3is likee2but with an icon.-e0(the default) does no conversion at all, just a ref. pick ur fighter.-f?β sets the depth of grouping to which fractions are constructed built-up.f5(default) allows five levels built-up,f0is none,f9is lots.-gβ don't even try to guess an MathML equivalent for font definitions, just remove them. bye π-hβ prints some help. and-?prints usage. besties helping besties π«Ά-iβ use an italic font for equations (like TeX does). default is roman.-j?β use index page length?. default is 20 lines.-jon its own means single column.-Lfileβ tellsttmthe base file (no extension) for LaTeX auxiliary input.-n?β MathML title format control.0raw,1expand macros,2expand eqns.-ppathβ specify additional directories (path) to search for input files.-rβ output raw MathML (no preamble or postlude) so u can drop it into other MathML.-tβ permits built-up items in textstyle equations. default is in-line items only.-uβ unicode character encoding. (default isiso-8859-1.)-vβ gives verbose commentary, spill the tea β-Vβ even MORE verbose (for debugging, iykyk).-w?β MathML writing style. default has no head/body tags.-w -w0means no title.-w1means a single title only, with head/body tags.-w2means XMathML.-xmakindxcmdβ specify a non-standardmakeindexcommand line.-y?β equation style: bit 1 compresses vertically; bit 2 does inline overaccents.
π SEE ALSO π
the ttm manual, which is more likely to be up-to-date fr. a local copy should be chillin' in the Debian package. also, reading the man pages for latex, latex2html, tex and makeindex might be useful if u wanna go deeper π₯
π¦ Browser Problems π¦
ttm translates (La)TeX into standard MathML and takes account, as far as possible, of the idiosyncrasies of the major browsers. nevertheless, there are several problems that are associated with the browsers. authors and publishers should recognize that these are not ttm bugs, okay? not our girl's fault, periodt.
many of the most serious difficulties of Mathematics rendering in MathML are associated with the need for extra symbols. in addition to various Greek letters and mathematical operators, u need access to the glyphs used to build up, from parts, the large brackets that match the height of built-up fractions. these symbols are almost universally present on systems with graphical browsers β which all have a Symbol font, generally based on the one Adobe made freely available. the problem lies in accessing the font, because of shortcomings in the browsers and the MathML standards that relate to font use π
for more info please read the section "Browser Problems" in the manual.
π AUTHOR π
ttm is copyright (c) 1997-2011 Ian Hutchinson (hutch@psfc.mit.edu).
π Copyright License π
u are hereby freely licensed to use this software under the terms of the GNU General Public License, version 2, published by the Free Software Foundation, a copy of which is enclosed in the file license.txt.
the software comes WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. π«£ so like, no take-backs, bestie.
for details see http://silas.psfc.mit.edu/tth/mml/.
π ACKNOWLEDGEMENTS π
many thanks for useful discussions and input to Robert Curtis, Ken Yap, Paul Gomme, Bruce Lipschultz, Mike Fridberg, Michael Sanders, Michael Patra, Bryan Anderson, Wolfram Gloger, Ray Mines, John Murdie, David Johnson, Jonathan Barron, Michael Hirsch, Jon Nimmo, Alan Flavell, Ron Kumon. y'all ate πβ¨
and that's a wrap on the ttm page, bestie!! this was version 3.10 of TTM(1), dated 1 May 2002 π go forth and convert ur math, u got this π§π
π¦ where this page comes from
- debian trixie: ttm 4.16+ds-2 Β· GPL-2.0-or-later
- ubuntu questing: ttm 4.16+ds-2
- ubuntu resolute: ttm 4.16+ds-2build1 Β· GPL-2.0-or-later
- ubuntu stonking: ttm 4.16+ds-2build1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms