Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuki-koyama/latexie

Utilities for writing papers with LaTeX
https://github.com/yuki-koyama/latexie

commands latex package

Last synced: 3 months ago
JSON representation

Utilities for writing papers with LaTeX

Awesome Lists containing this project

README

        

# latexie

Utilities for writing papers with LaTeX

- `latexie.sty`: The main style file with many custom commands
- `latexie-article.cls`: A plain article class with nice format settings

## Goals

- Faster paper writing (especially in the computer science domain)
- Shorter commands while preserving readability (e.g., `\bfx` rather than `\mathbf{x}`)
- Better maintainability by providing semantic commands (e.g., `\T` rather than `\top` for the matrix transposition)

## Usage

```latex
\usepackage{/path/to/this/repository/latexie}
```

## Policies

### Overall

- Prefer `\newcommand` and `\renewcommand` (LaTeX) to `\def` (TeX)
- [macros - What is the difference between \def and \newcommand? - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/655/what-is-the-difference-between-def-and-newcommand)
- Prefer `\newcommand*` to `\newcommand` if it is the intention
- [macros - What's the difference between \newcommand and \newcommand*? - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/1050/whats-the-difference-between-newcommand-and-newcommand)

### Math

- Prefer `\DeclareMathOperator` (from `amsmath` package) to `\newcommand`
- [best practices - What is the difference of \mathop, \operatorname and \DeclareMathOperator? - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/84302/what-is-the-difference-of-mathop-operatorname-and-declaremathoperator)
- Use `\top` for the matrix and vector transpose operator
- [List of mathematical symbols - Wikipedia](https://en.wikipedia.org/wiki/List_of_mathematical_symbols) (Retrieved: 2022/04/03)

## Documentation

### Options

- `noannotation`: If this option is passed, the annotation commands do not display annotaions. More specifically, `\note` and `\todo` do not rendered, and `\spot` displays its content without colored.

## Dependencies

- amsmath
- amsfonts
- ifthen
- xcolor

## Math Examples

Before:
```latex
p(\mathcal{D} \:\vert\: \boldsymbol{\theta})
```

After:
```latex
\cprob{ \calD }{ \bftheta }
```

Result:

----

Before:
```latex
\mathcal{N}(\mathbf{x}; \boldsymbol{\mu}, \boldsymbol{\Sigma})
=
\frac{1}{(2 \pi)^{\frac{n}{2}} \det(\boldsymbol{\Sigma})^{\frac{1}{2}}}
\exp \left\{
- \frac{1}{2} (\mathbf{x} - \boldsymbol{\mu})^{\top} \boldsymbol{\Sigma}^{-1} (\mathbf{x} - \boldsymbol{\mu})
\right\}
```

After:
```latex
\calN(\bfx; \bfmu, \bfSigma)
=
\frac{1}{(2 \pi)^{\frac{n}{2}} \det(\bfSigma)^{\frac{1}{2}}}
\exp \left\{
- \frac{1}{2} (\bfx - \bfmu)^\T \bfSigma^\inv (\bfx - \bfmu)
\right\}
```

Result:

----

Before:
```latex
\begin{bmatrix}
\mathbf{A} & \mathbf{B} \\
\mathbf{C} & \mathbf{D}
\end{bmatrix}^{-1}
=
\begin{bmatrix}
\mathbf{A}^{-1} ( \mathbf{I} + \mathbf{B} ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \mathbf{C} \mathbf{A}^{-1} ) &
- \mathbf{A}^{-1} \mathbf{B} ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \\
- ( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1} \mathbf{C} \mathbf{A}^{-1} &
( \mathbf{D} - \mathbf{C} \mathbf{A}^{-1} \mathbf{B} )^{-1}
\end{bmatrix}
```

After:
```latex
\bmat{
\bfA & \bfB \\
\bfC & \bfD
}^\inv
=
\bmat{
\bfA^\inv ( \bfI + \bfB ( \bfD - \bfC \bfA^\inv \bfB )^\inv \bfC \bfA^\inv ) &
- \bfA^\inv \bfB ( \bfD - \bfC \bfA^\inv \bfB )^\inv \\
- ( \bfD - \bfC \bfA^\inv \bfB )^\inv \bfC \bfA^\inv &
( \bfD - \bfC \bfA^\inv \bfB )^\inv
}
```

Result:

## Limitations

Some commands are probably not very effective with
- code highlighting
- code completion
- code snippets

## Example

See `example.tex` for a working example. It can be compiled by using `pdflatex`. If you use `latexmk`, then run this command:
```sh
latexmk -pdf example
```