Skip to content

babaissarkar/math2pic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

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.

Usage

ss_tex2jpg input.tex
ss_math2pic.pl input.txt

Dependencies

  1. Bash shell
  2. Perl
  3. A LaTeX installation with the xelatex command and the standalone package, preferably the latest version.
  4. Understanding of Markdown and LaTeX (and probably HTML).

Installation and configuration

  1. Put ss_tex2jpg and ss_math2pic.pl inside a directory that's included in your PATH variable. (For Linux systems, it is usually /usr/local/bin).
  2. Put eqn_sample.tex in ~/Templates.
  3. Now you are done!

Try it out!

ss_tex2jpg

  1. First install everything and put the the examples directory somewhere in your system.

  2. Open a terminal and cd inside the examples folder.

  3. Look at the contents of example1.tex and read the next section. It contains a equation inside

    \begin{math} ... \end{math}

  4. Run ss_tex2jpg example1.tex.

  5. You'll get a nice jpg file called example1.jpg of the equation written in LaTeX math mode macro inside example1.tex.

ss_math2pic.pl

  1. Now run ss_math2pic on example2.txt. It will extract the mathematical formulae written inside $$, parse it using xelatex and will use the standalone package to generate a picture of the equation (inside a file called out0.jpg). It will also generate a new file named example2-gen.txt which has $...$ part replaced by a html <img> tag pointing to the generated image.
  2. You can then parse example2-gen.txt with markdown to generate a html page, with all equation macros replaced by beautiful images generated by LaTeX!
  3. A copy of all generated outputs from the examples are given in the examples/out directory.

Very important...

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.

About

A simple tool to include LaTeX mathematical equations in Markdown.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published