ttmathmlとはToward tiny Mathmlの略でtiny MathMLを目指す第一歩として作成した、TeXファイルを MathML(プレゼンテーション・マークアップ)へ自動変換するプログラムです。
本プログラムはRubyで書かれています。Rubyを選んだ理由は、script言語である事、及び日本語の取り扱いに優れていると考えたからです。
tthmathmlはメインプログラムとdatafileからなり、基本的なTeXコマンドの処理はdatafileの情報から処理されます。
実際にttmathmlを使ってTeXファイルを変換してみます。
\documentclass{a4j,12pt}{jarticle} %--------------------------------- \title{ttmathmlのtest} \author{前田裕介} %--------------------------------- \begin{document} \tableofcontents \maketitle %--------------------------------- \section{初めの節}\label{check1} A+B=Cは normal mode。 $2^3=8$は math modo であり。 $$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$ は display math mode である。 \[ \left( \begin{array}{cc} a & b \\ c & d \] %--------------------------------- \section{次の節}\label{check2} % (この上の行に\%が書いてある)は消えるが、 \% は消えない。 第\ref{check1}節では、xxx第\ref{check2}節では、xxx \end{document}