website/content/blog/algorithmiclatex.md

27 lines
704 B
Markdown
Raw Permalink Normal View History

2020-05-15 21:56:24 -04:00
---
title: "Algorithms in LaTex"
date: 2020-05-14T21:31:28-04:00
draft: false
2022-01-02 14:24:29 -05:00
tags: ["LaTex"]
2023-01-05 14:04:45 -05:00
medium_enabled: true
2020-05-15 21:56:24 -04:00
---
There's a great package in LaTex called [`algorithm`](https://ctan.org/pkg/algorithms?lang=en) to help format psuedo-code algorithms for scientific papers. Here's a simple example of its usage:
```
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\begin{algorithm}
\caption{Even Numbers}
\begin{algorithmic}[1]
\State Set variable $evens$ to an empty list.
\For {every integer $i$}
\If {$i$ is divisible by $2$}
\State Add $i$ to $events$ list.
\EndIf
\EndFor
\end{algorithmic}
\end{algorithm}
```
2022-06-11 22:54:02 -04:00
![image-20200514225618784](/files/images/blog/20200514225618784.png)