ss_tex2jpg -- A shell script to convert an input .tex file to a .jpg picture, using the method described here.
ss_math2pic.pl -- A Perl script that scans an input plain-text document for TeX mathmode equations inside $$, extracts and converts them to jpg picture files and creates a copy of the original file with all equations replaced by links to corresponding image files. Requires ss_tex2jpg to be present on the system.
ss_tex2jpg input.tex
ss_math2pic.pl input.txt
- Bash shell
- Perl
- A LaTeX installation with the
xelatexcommand and thestandalonepackage, preferably the latest version. - Understanding of Markdown and LaTeX (and probably HTML).
- Put
ss_tex2jpgandss_math2pic.plinside a directory that's included in yourPATHvariable. (For Linux systems, it is usually/usr/local/bin). - Put
eqn_sample.texin~/Templates. - Now you are done!
-
First install everything and put the the
examplesdirectory somewhere in your system. -
Open a terminal and
cdinside the examples folder. -
Look at the contents of
example1.texand read the next section. It contains a equation inside\begin{math} ... \end{math}
-
Run
ss_tex2jpg example1.tex. -
You'll get a nice jpg file called
example1.jpgof the equation written in LaTeX math mode macro insideexample1.tex.
- Now run
ss_math2piconexample2.txt. It will extract the mathematical formulae written inside $$, parse it usingxelatexand will use thestandalonepackage to generate a picture of the equation (inside a file calledout0.jpg). It will also generate a new file namedexample2-gen.txtwhich has$...$ part replaced by a html<img>tag pointing to the generated image. - You can then parse
example2-gen.txtwith markdown to generate a html page, with all equation macros replaced by beautiful images generated by LaTeX! - A copy of all generated outputs from the examples are given in the
examples/outdirectory.
If you are already familer with LaTeX, you might notice the absence of the following in example1.tex :
\documentclass{article}
...
\begin{document}
...
\end{document}
To simplify things for you, I have already written this inside eqn_sample.tex. You just need to write your equation in input.tex
\begin{math}
$x^2 - 3x + 2 = 0$
\end{math}
input.tex file will be included inside the eqn_sample.tex file using the LaTeX macro \input{}, so don't bother with it. Don't believe me, go ahead and open up eqn_sample.tex. You will understand.