8000 GitHub - codeocean/statax: JavaScript and LaTeX Syntax Highlighter for Stata
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

codeocean/statax

 
 

Repository files navigation

Statax : JavaScript and LaTeX syntax highlighter engine for Stata

statax is a syntax highlighter for Stata. The packages includes two separate engines (JavaScript and LaTeX) to highlight Stata commands in HTML- and LaTeX-based documents. A plenty of Stata package produce documents or presentation slides in HTML and LaTeX and the engines can simply be wired to these packages to highlight the syntax of Stata commands. For example, weaver and MarkDoc packages require statax for syntax highlighting. Long story short, syntax highlighters might improve code comprehension and encourage learners to pay more attention to the code.

Installation

You can directly download Statax from GitHub. Check the release page for the curent version and new features.

net install statax, from("https://raw.githubusercontent.com/haghish/statax/master/")

The complete guide for installing them is provided in the MarkDoc help file and also, Statax Homepage

Description

statax can acurately distinguish several different elements in Stata syntax such as:

  1. commands
  2. functions
  3. local and global macros
  4. strings
  5. numbers
  6. operators
  7. comments
  8. curly brackets

The JavaScript engine is hosted on my website and can be easily added to any webpage. See Statax Homepage for details. in brief, all you have to do to load the javaScript in your HTML document is adding the following code:

<script type="text/javascript" src='http://haghish.com/statax/Statax.js'></script>

And writing your Stata code in:

<pre class="sh_stata">
	. Stata code
	. Stata code
	...
</pre>

The LaTeX syntax highlighter is even easier to implement. All you need to do is loading the Statax.tex in the header of your latex document, before you \begin{document} as shown below:

\input{Statax}

Once the Statax file is loaded in the header, You can call the statax environment to highlight the Stata syntax. For example:

\begin{statax}
	
	// JavaScript Syntax Highlighter for Stata
	
	quietly erase "`This' $Example"
	noisily do `Something'
	forvalues num = 5/13 {
	count if vari`num' > 10 //this is a comment
	scalar 5 = 2 * 10 
	generate x = runiform()
	}
	
	/*
	E. F. Haghish
	Center for Medical Biometry and Medical Informatics
	Unersity of Freiburg, Germany
	*/

\end{statax}

Author

E. F. Haghish
Center for Medical Biometry and Medical Informatics University of Freiburg, Germany
haghish@imbi.uni-freiburg.de
http://www.haghish.com/weaver
@Haghish

About

JavaScript and LaTeX Syntax Highlighter for Stata

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 48.7%
  • Stata 28.1%
  • TeX 16.6%
  • CSS 3.8%
  • HTML 2.8%
0