More readable LaTeX language extension and transcompiler to LaTeX
Project description
SugarTeX
SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Designed to be used instead of $formula$
insertions to markdown.
See SugarTeX documentation. Examples of input to output conversion see in this PDF.
I use Markdown with Python code blocks for document programming via Pandoctools (like R-Markdown).
Both Python and Markdown are very readable languages. Unfortunately LaTeX is not like this. So I wrote SugaTeX extension+transpiler that is highly readable. In order to achieve this it heavily uses Unicode so that SugarTeX install instructions even have recommended monospace font fallback chains. And more: SugarTeX Completions Atom package helps write all that Unicode in a moment.
I am trying to incorporate LaTeX into .md using the Markdown Philosophy of “you should write something that's readable as plain text, without compilation, also”.
Install
Install as part of Pandoctools - convenient interface and works out of the box.
Via conda:
conda install -c defaults -c conda-forge sugartex
Via pip:
pip install sugartex
Atom editor with full Unicode support
Highly recommended to install Atom editor as it's the best for markdown.
Atom is perfect for Unicode rich texts. But you need to install some fonts first. Recommended font fallback chains:
- For Consolas:
Consolas, 'STI0 Two Mat0 monospacified for Consola0', 'DejaVu Sans Mono monospacified for Consolas', 'Symbola monospacified for Consolas', 'Noto Sans CJK TC', monospace
. Download:- Consolas can be installed together with Microsoft PowerPoint Viewer till April, 2018. SHA256: 249473568EBA7A1E4F95498ACBA594E0F42E6581ADD4DEAD70C1DFB908A09423. But note that it's license says that "You may use the software only to view and print files created with Microsoft Office software. You may not use the software for any other purpose." so you might not be even allowed to print Consolas font text via Chrome browser,
- STI0 Two Mat0 monospacified for Consola0 (STIX Two Math for Consolas),
- DejaVu Sans Mono monospacified for Consolas
- Symbola monospacified for Consolas,
- For Roboto Mono:
'Open Mono', 'Noto Sans Mono', 'IBM Plex Mono', 'STI0 Two Mat0 monospacified for Robot0 Mono', 'DejaVu Sans Mono', 'Symbola monospacified for DejaVu Sans Mono', 'Noto Sans CJK TC', monospace
. Download:- Open Mono that is simply a renamed monospacified version of Roboto Mono (italic in Roboto Mono has different width than regular),
- Noto Sans Mono,
- IBM Plex Mono. Download, Download,
- STI0 Two Mat0 monospacified for Robot0 Mono (STIX Two Math for Roboto Mono),
- DejaVu Sans Mono,
- Symbola monospacified for DejaVu Sans Mono,
Noto fonts can also be freely downloaded (if you need CJK support). TC is Traditional Chinese but it can also be SC, JP, KR. I used monospacified fonts with the help of monospacifier.py. If you do not like Consolas/Roboto Mono you can pick there monospacified versions for other monospace fonts.
SugarTeX Completions for Atom
Install SugarTeX Completions package for easy typing SugarTeX and lots of other Unicode characters. (it's incompatible with latex-completions package).
In the SugarTeX documentation appropriate shortcuts for SugarTeX Completions for Atom are given.
Usage examples
Example of input to output conversion is at the end of [this PDF].
Windows:
chcp 65001 > NUL
set PYTHONIOENCODING=utf-8
type doc.md | ^
pre-sugartex | ^
pandoc -f markdown --filter sugartex -o doc.md.md
Unix:
export PYTHONIOENCODING=utf-8
cat doc.md | \
pre-sugartex | \
pandoc -f markdown --filter sugartex -o doc.md.md
Or splitting Pandoc reader-writer:
export PYTHONIOENCODING=utf-8
cat doc.md | \
pre-sugartex | \
pandoc -f markdown -t json | \
sugartex --kiwi | \
pandoc -f json -o doc.md.md
Panflute scripts are also installed so you can use it in default Panflute automation interface in metadata or in recommend panfl CLI:
panfl sugartex --to markdown
,panfl sugartex.kiwi -t markdown
.
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
File details
Details for the file sugartex-0.1.16.tar.gz
.
File metadata
- Download URL: sugartex-0.1.16.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e14ffbef643b34d6d4cb0de5b57d55e58f16a9afbe7e18e99ab4e33a4f92dd30 |
|
MD5 | aef92aab6d63d345159c60d5a7f0868b |
|
BLAKE2b-256 | e1bb694292d858157bea53fc46cc85c9b5df8c00031999239c6a92bc6ba5485c |