Skip to content

jaspwr/LiA

Repository files navigation

LiA logo

A transpiled superset of $\text{TeX}$ for writing $\text{LaTeX}$.

build build

This project is in development (expect bugs). This is a superset of TeX that extends its syntax adding new several new features. These added features are just designed to make LaTeX code less verbose and faster to write but also just catered more towards my personal preference.

For a more detailed explanation of the features see the documentation.

For installation instructions see the installation section.

Example #1

LiA code

eq {
    dy/dx = x*(a - b) + [[1, 2], [3, 4]] + sin(x)
}

Resulting TeX

\begin{document}
    \begin{equation}
        \frac{dy}{dx} = x \times \left(a - b\right) + \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} +\sin \left(x\right)
    \end{equation}
\end{document}

Example #2

LiA code

use graphicx, [utf8]inputenc
@cat = 🐈
@img = (src, desc) => {
    env center {
        \image{@("images/" + src)}{10cm}
        \linebreak
        **@desc**
    }
}
#* Cool Cat Image
## A subsection
@img(cat.png, Meow @cat!)

Resulting TeX

\usepackage{graphicx}
\usepackage[utf8]{inputenc}


\newcommand{\cat}{🐈}
\newcommand{\img}[3]{
    \begin{center}
        \image{#3}{10cm}
        \linebreak
        \textit{#2}
    \end{center}
}


\begin{document}
    \section*{Cool Cat Image}
    \subsection{A subsection}
    \img{cat.png}{Meow \cat!}{images/cat.png}
\end{document}

Example #3

LiA code

@muliplication = (a: Number, b: Number) => { $@a \times @b = @(a * b)$ }
* I'm a **Markdown** style ***list***
* @muliplication(2, 3)
* @muliplication(6, 6)
* @muliplication(2, 9)
  * I'm indented
* {I'm a multiline
   list item}

Resulting TeX

\newcommand{\muliplication}[3]{
    $#1 \times #2 = #3$
}


\begin{document}
    \begin{itemize}
        \item I'm a \textit{Markdown} style \textbf{list}
        \item \muliplication{2}{3}{6}
        \item \muliplication{6}{6}{36}
        \item \muliplication{2}{9}{18}
        \begin{itemize}
            \item I'm indented
        \end{itemize}
        \item {I'm a multiline
        list item}
    \end{itemize}
\end{document}

Installation

OS Instructions
Arch Linux Install from the AUR https://aur.archlinux.org/packages/lia-git.
Other Download the latest release from the releases page. There is currently no installer so you will need to add the directory to your path manually.

Usage

lia file.lia -w --pdflatex
  • Run lia --help for more information on usage.
  • The -w flag will tell the compiler to watch the file for changes and recompile it.
  • The --pdflatex flag runs pdflatex on the outputted TeX file.

Building

Requires Rust to be installed.

git clone https://github.com/jaspwr/LiA
cd LiA
cargo build --release

Your binary will be in target/release.

VSCode extension

For syntax highlighting and other features in VSCode, you can use the extension. To install it, copy tooling/vscode/lia-helper to your VSCode extensions directory (normally ~\.vscode\extensions) then restart VSCode.

Contributing

I am planning to do a full rewrite. Please do not contribute right now.