*! version 1.0 01Oct2015

*! version 1.1 03Oct2015
Version 1.2 : April, 2016

Title

statax -- JavaScript and LaTeX syntax highlighter for Stata

Author

E. F. Haghish

Center for Medical Biometry and Medical Informatics

University of Freiburg, Germany

and

Department of Mathematics and Computer Science

University of Southern Denmark

haghish@imada.sdu.dk

http://haghish.com/statax

Syntax

convert do-file to HTML and highlight the syntax

statax convert using filename.do, replace style(name) css(filename)

create a new HTML file or append Statax JavaScript to an existing HTML file

statax using filename.html, replace append style(name) css(filename)

replace replace the HTML file if already exists

append append the Statax JavaScript engine to an existing HTML file

style(name) change the style of the syntax hilghlighter. The available
styles are
stata, daring, sunset, and wrangler. stata is the
default syntax highlighter style

css(filename) link an external CSS file to allow
users to change the appearence of the HTML file. All the styles
relating to the document, syntax highlighter, and the dynamic table can be
overruled using this option

Description

Statax includes 2 engines for highlighting Stata code in HTML and LaTeX documents.

Based on SHJS engine,
a new JavaScript was written to highlight Stata syntax. In addition, a new JQuery
program was written to highlight global macro syntax. The JavaScript
file developed SHJS is called sh_main.js and the file developed by the
author for Stata is named stata.js. The author also developed a CSS style
sheet to create a syntax highlighter identical to Stata do-file editor, which is
included in Stata.css file. The JavaScript engine
can be used in HTML files, online forums, or any website or blog for highlighting
Stata syntax. The program acurately highlights Stata commands, functions, string,
local and global macros, digits, comments, and braces. The engine can also
highlight the operator signs, but since Stata does not highlight operators, the
default CSS shows them in black color.

The LaTeX syntax highlighter was developed based on the
listings package which is used for typesetting
source code in the document. In order to highlight Stata syntax in LaTeX document, you should
append the content of Statax.tex
to the heading of your LaTeX document. Alternatively, you can \include{path/to/statax.tex} the
Statax.tex file in the heading of
your LaTeX document. Next, you can highlight Stata syntax by placing Stata commands between
\begin{statax} and \end{statax}

Installation

For adding statax.js JavaScript to your website or HTML files or the statax.tex to your
LaTeX document, visit http://haghish.com/statax
to see the full instalation guide.

Example of interactive use

You would like to get a taste of the Statax syntax highlighter? run an exanple
by specifying a name HTML filename

. statax using example.html, replace

You have a do-file and you would like to convert it to HTML and highlight the
syntax. It will create an HTML file with the same name as the do-file

. statax convert using filename.do, replace‚