NOTE
As you may have noticed, asciiTeX is not maintained. There are two
alternatives you may use. I saw somebody forked and updated asciiTeX
here:
https://github.com/larseggert/asciiTeX
I myself have built a completely new code for monospace TeX-like math
formatting. It supports unicode/utf-8 and has supports much more TeX
syntax. The new system provides a little asciiTeX-like utility called
utftex. It is built on top of a library, libtexprintf, which provides
printf-like routines to pretty-print math. Check it out here:
https://github.com/bartp5/libtexprintf
asciiTeX
asciiTeX is an ASCII equation renderer released under the terms of the GNU
General Public License. The program can generate ASCII-art representations of
mathematical equations. You can use asciiTeX to quickly insert
equations in e.g. e-mails or comments in your source-code. The syntax is
similar to LaTex. The asciiTeX project is a fork of eqascii, providing new features
and many bug fixes to the original program.
Features
- A graphical user interface written in GTK
- Renders mathematical equations in plain ASCII, simply copy/paste the result to where you need it
- Syntax similar to LaTeX
- A command line version is available, which accepts input from files or directly from
the command line
- Runs on Linux and Windows and presumably on anything with a decent gcc
compiler
Showcase
Before going into the gory details of where to obtain
asciiTeX
and asciiTeX operation, here are some examples of asciiTeX output.
asciiTeX does matrices,
_ _
| x x |
| 11 12 |
| |
| x x |
|_ 21 22_|
and things like this,
/ 1
| ----- + 12 -120
, and
_ _
/ W np / W n0
| -----dx = | -------------------------------------------dx =
_/ 0 n + p _/ 0 / E0(x - x0) \ / E0(x - x0)\
exp | ---------- | + exp | - ----------|
\ kT / \ kT /
_ _
| / _ _ \ |
n0kT | | | E0(x - x0) | | |x = W n0kT
---- | arctan | exp | ---------- | | | ~ ---- pi
E0 |_ \ |_ kT _| / _|x = 0 E0
, etc.
Download
Install
Compile from source (all systems)
To compile and install the program run
./configure
make
make install
This installs both the commandline utility aswell as the graphical user interface.
If you do not wish to install the graphical user interface you can configure with
the option --disable-gtk
Windows
An installer is available which installs the graphical version of the program.
Usage
asciiTeX_gui
Here are some screens:
To run the GTK version of asciiTeX run asciiTeX_gui. A window apears with an
- Equation Input Field
-
This is where you can edit your equation. See the description of the syntax below.
- Equation Output Field
-
This is where the result is displayed (and can be copied from).
- Generate button
-
Press this button to render your equation in ASCII.
- Line-width check button
-
Turn on or off automatic line-breaking for long equations. This will cause
asciiTeX to attempts to format the equation within the specified line width,
i.e., asciiTeX will insert line breaks in order to format long equations over
several lines. Note that this is not guaranteed to work, some equations cannot
easily be formatted over several lines. See the Line-width Input Field.
- Line-width Input Field
-
Here you can set the line-width in characters, see the Line-width check button.
asciiTeX
The command-line version of asciiTeX is simply called asciiTeX. To run use:
asciiTeX [-v] [-h] [-f file] [-ll line-length] [equation]
Options
- -v
-
Print out the version of the asciiTeX executable and exit.
- -h
-
Print out the version of the asciiTeX executable and exit.
- -f file
-
This option specifies the equation should be read from a file (per
default asciiTeX expects the equation on the command line).
- -ll line-length
-
With this option asciiTeX attempts to format the equation within the
specified line width, i.e., asciiTeX will insert line breaks in order
to format long equations over several lines. The default is line-length
80 characters. With a specified line width of 0 asciiTeX will not
insert line breaks.
- equation
-
If the -f option is not specified the equation is read from the command line.
Syntax
asciiTeX implements a LaTeX style syntax to format equations.
Accepted syntax:
\frac{a}{b}
-
A fraction of a and b.
a^{b}
-
A superscript. One can also omit the braces. In this case the first
character following ^ will be superscripted.
a_{b}
-
A subscript. Works just like the superscript (well, not exactly of course).
\sqrt[n]{a}
-
A n-th root of a, the argument [n] is optional. Without it it produces
the square root of a.
\sum
-
Expands to a sigma.
\prod
-
Expands to the product mark (pi).
\int
-
Expands to the integral mark.
\oint
-
A closed path integral.
\left( , \right)
-
Expands to braces which adept to the height of their content. Available left
braces are: ([{| The corresponding right braces are: )]}| All
brace types can be opened by \left. or closed by \right. , producing
a single right or left brace, receptively.
\leadsto
-
Expands to an arrow (~>) (may look ugly in some fonts).
\to
-
Expands to an arrow (->).
\limit{x}
-
Expands to a limit, i.e. \limit{x \to 0}.
\overline{X}
-
Draws a line above expression X
\underline{X}
-
Draws a line under expression X
\lceil
-
Left ceiling symbol
\rceil
-
Right ceiling symbol
\lfloor
-
Left floor symbol
\rfloor
-
Right floor symbol
\\
-
Insert a line break.
\begin{array}[pos]{column alignments}
a00 & a01 & ... a0n \\
a10 & a11 & ... a1n \\
... & ... & ... ... \\
am0 & am1 & ... amn
\end{array}
-
Makes an array. The optional argument pos sets the alignment of the
array to t(op), b(ottom) or c(enter). The column alignments consist of
one character per column, l(eft), c(enter), or r(ight). Currently asciiTeX
does not support vertical or horizontal lines, e.g. the column alignment
specification "{|c|}" will lead to errors. Note, that the
string \begin{array} must not contain spaces. The cells inside an
array may contain mathematical formulas and sub-arrays.
\a
-
Escapes the character a. Useful for inserting characters like ^, and _
in your equation.
Examples
A simple fraction:
- asciiTeX "\frac{1}{1+x}"
-
1
-----
1 + x
An arbitrary equation:
-
asciiTeX "\lfloorx\rfloor = x -\frac{1}{2} + \sum_{k=1}^{\infty}\frac{sin(2 Pi k x)}{pi k}"
-
1 __ oo sin(2 Pi k x)
|_x_| = x - - + \ -------------
2 /__ k=1 pi k
More examples can be found in the file "EXAMPLES" included in the download
asciiTeX -f EXAMPLES
Authors
The maintainer of asciiTeX is Bart Pieters (contact via
this link)
The program is a fork of eqascii which was written by Przemek Borys.