A compiler for HLTeX, a higher-level language on top of LaTeX
Project description
# HLTeX (Provisional Name)
HLTeX is a new typesetting language built on top of LaTeX designed for conciseness and ease of use,
while also adding support for additional features like inline Matplotlib figure generation
and SymPy integration
### Example
```TeX
\documentclass{article}
\title{My First Document}
\author{Your Truly}
===
\section{HLTeX is Awesome}
Here are some words that are in this section.
Math is fun, so here's an equation:
\eq:
f(x) = x^2 + 3
We might want to give our equation a label, like this:
\eq[cubic]:
f(x) = x^3 - 4x^2 + 2
We can reference our equation with Equation \ref{eq:cubic}.
This is automatically joined with the non-breaking space \verb{~}.
```
### Syntax
HLTeX supports two kinds of macros: *commands* and *environments*.
Commands are just as they are in plain LaTeX, and they look like this:
```
This text \emph{is emphasized} using the `emph' command.
```
They are preceeded by a backslash, the *escape character*, followed by either any number of letters in the alphabet
(capital or lowercase), or by a single non-alphabetical character, like this:
```
Once upon a time, in a distant galaxy called \"O\"o\c c, there lived a computer named R.~J. Drofnats.
```
The `\"` *control symbol* puts an umlaut over the following character, while the `\c` control symbol
puts a "cedilla" under the next character.
Environments are slightly different in HLTeX than in LaTeX.
Whereas in LaTeX they are enclosed by begin/end commands, in HLTeX environments use indentation-based blocks, like this:
The main syntactic difference between HLTeX and LaTeX is that HLTeX uses indentation-based environments, like this:
```
\eq:
f(x) = x^2 + 3
```
Notice that there isn't a trailing `\end{eq}`!
This makes typing out your documents a breeze.
Commands can take both *required* and *optional* arguments.
Required arguments are enclosed in curly braces `{}`, while optional arguments are enclosed in square brackets `[]`.
For compatibility reasons, only curly braces are required to match;
this means `\command{[}` is valid HLTeX, because it is valid LaTeX.
As in LaTeX, files are broken into two parts: a *preamble*, and a *document*.
Whereas LaTeX encloses the document in an enormous pair of begin/end commands, in the interest of conciseness,
HLTeX separates these two parts by `===` (or optionally more equals signs, but at least three).
In the preamble, only commands and their arguments are allowed--in particular, this means
environments can only be created in the document (i.e. after the `===`).
### Usage
To compile a file into LaTeX, you can use our CLI utility, like this:
```
hltex myfile.hltex
```
By default, this will put the resulting LaTeX code into a file called `myfile.tex`, at which point you can run
```
pdflatex myfile.tex
```
to generate a PDF.
Optionally, you can specify your own output file, like this:
```
hltex myfile.hltex --out myotherfile.tex
```
### Inline-python support
We use (Epicbox)[https://github.com/StepicOrg/epicbox] and (Docker)[https://hub.docker.com/]. After installing Docker, run
```
pip install epicbox
docker pull python:3.6.5-alpine
```
Now you can run python code in HLTeX and have save its output directly to your generated LaTeX file!
[example coming]
HLTeX is a new typesetting language built on top of LaTeX designed for conciseness and ease of use,
while also adding support for additional features like inline Matplotlib figure generation
and SymPy integration
### Example
```TeX
\documentclass{article}
\title{My First Document}
\author{Your Truly}
===
\section{HLTeX is Awesome}
Here are some words that are in this section.
Math is fun, so here's an equation:
\eq:
f(x) = x^2 + 3
We might want to give our equation a label, like this:
\eq[cubic]:
f(x) = x^3 - 4x^2 + 2
We can reference our equation with Equation \ref{eq:cubic}.
This is automatically joined with the non-breaking space \verb{~}.
```
### Syntax
HLTeX supports two kinds of macros: *commands* and *environments*.
Commands are just as they are in plain LaTeX, and they look like this:
```
This text \emph{is emphasized} using the `emph' command.
```
They are preceeded by a backslash, the *escape character*, followed by either any number of letters in the alphabet
(capital or lowercase), or by a single non-alphabetical character, like this:
```
Once upon a time, in a distant galaxy called \"O\"o\c c, there lived a computer named R.~J. Drofnats.
```
The `\"` *control symbol* puts an umlaut over the following character, while the `\c` control symbol
puts a "cedilla" under the next character.
Environments are slightly different in HLTeX than in LaTeX.
Whereas in LaTeX they are enclosed by begin/end commands, in HLTeX environments use indentation-based blocks, like this:
The main syntactic difference between HLTeX and LaTeX is that HLTeX uses indentation-based environments, like this:
```
\eq:
f(x) = x^2 + 3
```
Notice that there isn't a trailing `\end{eq}`!
This makes typing out your documents a breeze.
Commands can take both *required* and *optional* arguments.
Required arguments are enclosed in curly braces `{}`, while optional arguments are enclosed in square brackets `[]`.
For compatibility reasons, only curly braces are required to match;
this means `\command{[}` is valid HLTeX, because it is valid LaTeX.
As in LaTeX, files are broken into two parts: a *preamble*, and a *document*.
Whereas LaTeX encloses the document in an enormous pair of begin/end commands, in the interest of conciseness,
HLTeX separates these two parts by `===` (or optionally more equals signs, but at least three).
In the preamble, only commands and their arguments are allowed--in particular, this means
environments can only be created in the document (i.e. after the `===`).
### Usage
To compile a file into LaTeX, you can use our CLI utility, like this:
```
hltex myfile.hltex
```
By default, this will put the resulting LaTeX code into a file called `myfile.tex`, at which point you can run
```
pdflatex myfile.tex
```
to generate a PDF.
Optionally, you can specify your own output file, like this:
```
hltex myfile.hltex --out myotherfile.tex
```
### Inline-python support
We use (Epicbox)[https://github.com/StepicOrg/epicbox] and (Docker)[https://hub.docker.com/]. After installing Docker, run
```
pip install epicbox
docker pull python:3.6.5-alpine
```
Now you can run python code in HLTeX and have save its output directly to your generated LaTeX file!
[example coming]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hltex-0.0.1.tar.gz
(9.6 kB
view details)
Built Distribution
hltex-0.0.1-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file hltex-0.0.1.tar.gz
.
File metadata
- Download URL: hltex-0.0.1.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de91e15197dae2dd98ffb3431b4ad29d07a10ae3617c1c23d1d4f59686444c6c |
|
MD5 | f6798be34b8c9b4a3f025ad6067d52b7 |
|
BLAKE2b-256 | 0b4147dbd3a760ce528ff539a62404d90dc6686c9b99dfb30a6adc9416e208a9 |
File details
Details for the file hltex-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: hltex-0.0.1-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f4a5beff7f6ca49382a1b661c13eb8768cd8f38a7aff031d1241b2bd1a0b231 |
|
MD5 | 927cc46d1b4629a1017159e5c2cc348d |
|
BLAKE2b-256 | be4327f5f1e312a946c15ef15bd1c4abcfa041b044796a49e107e2da26314b08 |