GithubHelp home page GithubHelp logo

kiwi0fruit / sugartex Goto Github PK

View Code? Open in Web Editor NEW
75.0 4.0 0.0 2.08 MB

SugarTeX is a more readable LaTeX language extension and transcompiler to LaTeX. Fast Unicode autocomplete in Atom editor via https://github.com/kiwi0fruit/atom-sugartex-completions

License: MIT License

Python 99.71% Shell 0.29%
latex transcompiler pandoc markdown python unicode transpiler

sugartex's Introduction

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. See this instruction how to install recommended font fallback chains for Unicode support.

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:

@echo off
chcp 65001 > NUL
set PYTHONIOENCODING=utf-8
set PYTHONUTF8=1

type doc.md | ^
pre-sugartex | ^
pandoc -f markdown --filter sugartex -o doc.md.md

Unix (convert bash script to use like ./convert doc.md):

#!/bin/bash
export PYTHONIOENCODING=utf-8
export PYTHONUTF8=1

cat "$@" | \
pre-sugartex | \
pandoc -f markdown --filter sugartex -o "$@.md"

(or pandoc -f markdown --filter sugartex --to docx+styles -o "[email protected]")

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.