Directory macros/latex/contrib/algorithmlite
algorithmlite Package
LaTeX: A lightweight algorithm float without the float package
The algorithm package defines the algorithm float with \newfloat of the float package, and the float package redefines \caption as a whole, for every float of the document.
The algorithmlite package defines the environments algorithm and algorithm* in the same way as the standard classes define figure and table, with \@float and \@dblfloat of the LaTeX kernel: the captions of algorithms are set by the \@makecaption of the class, as those of figures and tables. The float package is not loaded. If no other package gives the placement [H], algorithmlite gives a minimal one.
The content of an algorithm is up to you: load algorithmic, algpseudocode (algorithmicx) or any other package for it.
- Supported formats/engines: pdfLaTeX, XeLaTeX, LuaLaTeX (with or without LuaTeX-ja), pLaTeX, upLaTeX (+ dvipdfmx)
Files
| File | Description |
|---|---|
algorithmlite.sty |
The package |
algorithmlite.tex / .pdf |
Documentation |
test-*.tex |
Test suite (see below) |
Requirements
- LaTeX2ε 2020-10-01 or later (package hooks)
- Tested with TeX Live 2026 (LaTeX2ε 2026-06-01)
Installation
Copy algorithmlite.sty to your local TeX tree: $TEXMF/tex/latex/algorithmlite/
Usage
\usepackage{algorithmlite} \usepackage{algorithmic} % or algpseudocode, ... \begin{algorithm}[tbp] % or [H] \caption{Euclid's algorithm}\label{alg:euclid} \begin{algorithmic}[1] \WHILE{$b \neq 0$} \STATE $(a, b) \leftarrow (b, a \bmod b)$ \ENDWHILE \RETURN $a$ \end{algorithmic} \end{algorithm} \listofalgorithms
The package has no options.
What is defined
algorithm,algorithm*: the float and its two-column variant, asfigureandfigure*. The default placement istbp; the list file is.loa.- The counter
algorithm: with\chapter, it is reset at every chapter and\thealgorithmis<chapter>.<n>(<n>before the first chapter), as\thefigureof the book classes; otherwise<n>. \algorithmname:Algorithm;アルゴリズムwith pTeX/upTeX and LuaTeX-ja (also when LuaTeX-ja is loaded after algorithmlite), unless the class optionenglishof jsclasses or the LuaTeX-ja classes is given.\listalgorithmname:List of Algorithms;アルゴリズム目次in Japanese.\fnum@algorithm:\algorithmname<sep>\thealgorithm, where<sep>is taken from\fnum@figureof the class (\nobreakspacein the standard classes,\nobreakin jsclasses and the LuaTeX-ja classes,~in jarticle/ujarticle, nothing in jlreq).\listofalgorithms:\listoffiguresof the class with\listalgorithmnameand the.loafile, so that it looks like the list of figures. The entries are set with\l@algorithm=\l@figureof the class.- The float type
\ftype@algorithm: a bit, as\ftype@figure= 1 and\ftype@table= 2. It is the next free bit, 4 in most documents. The counter of the float package (also used by floatrow and newfloat) and that of memoir are shared, so that the float types stay distinct: if the float package is loaded later (e.g. by minted), its counter is moved past 4. - Tagged PDF: with
\DocumentMetadata{tagging=on}, the structure names ofalgorithmare set up with\tagpdfsetup{float/new=algorithm}(unless the document has done it), and the[H]of algorithmlite is tagged as that of the float package. [H]: at\begin{document}, if neither the float package nor the floatrow package is loaded, a minimal[H]is defined (the float is put in a box "here", with\intextsepabove and below it). As with the float package, it works for every float type. In the box,\@captypeis the float type and\@fpsisH, so that code in the float can tell an[H]float from the others (the[H]of the float package does not set\@fps). If the float package is loaded, its[H]is used.
Errors and limitations
- The algorithm and algorithm2e packages cannot be used with algorithmlite, before or after it (error).
- algorithmlite does not redefine an existing
algorithmenvironment or counter (error). algorithm*[H]in two-column mode is not supported (as with the float package).- Vertical writing (tate) is outside the scope of this version.
Testing
make test compiles every test twice (test-tagging: three times) with pdfLaTeX, XeLaTeX, LuaLaTeX, pLaTeX and upLaTeX (+ dvipdfmx), and checks the log:
ALGL-RESULT OK: the numbers, names,\fnum@algorithm, float types,\@fpsand\refare as expected, an[H]float stays in the text flow, a[p]float goes to a later page, and\listofalgorithmshas every entry (seetest-common.tex).- No LaTeX or package warning other than "Label(s) may have changed" (and the warning of tagpdf on unicode-math with lualatex).
test-hyperref(andtest-taggingwith hyperref): no warning on a duplicate or missing destination in the log or in the output of the engine and (x)dvipdfmx.test-errors: the expected error message.
| Test | Engines | What it covers |
|---|---|---|
test-basic.tex |
pdflatex, xelatex, lualatex (article, book, article + luatexja, ltjsarticle, ltjsbook, ltjsarticleenglish, jlreqbook), platex (jarticle, jsbook, jsbookenglish), uplatex (ujarticle, ujbook, jlreq) | numbering with and without chapters, names, \fnum@algorithm, [H], [p], figure[H], algorithm*, \ref, \listofalgorithms |
test-hyperref.tex |
pdflatex, xelatex (book), lualatex (ltjsbook), platex (jsbook), uplatex (ujbook) | test-basic.tex with hyperref |
test-twocolumn.tex |
pdflatex (article), uplatex (ujarticle) | algorithm* and [H] in two-column mode |
test-compat.tex |
pdflatex | float before/after, newfloat, caption, memoir |
test-tagging.tex |
pdflatex (article, book, book + hyperref, twocolumn, float/new in the preamble), lualatex (article, ltjsbook) |
test-basic.tex and test-twocolumn.tex with \DocumentMetadata{tagging=on} |
test-errors.tex |
pdflatex | the error messages |
test-common.tex holds the helpers shared by the tests.
Repository
License
This package is licensed under the conditions of the LaTeX Project Public License, either version 1.3c of this license or any later version.
Copyright (c) 2026 Munehiro Yamamoto
Download the contents of this package in one zip archive (196.5k).
Algorithmlite – A lightweight algorithm float without the float package
The algorithms package defines its float with the float package, which redefines \caption for every float of the document. This package defines the environments algorithm and algorithm* in the same way as the standard classes define figure and table, with the float mechanism of the LaTeX kernel, without loading the float package.
It provides the counter (reset at every chapter if there are chapters), \algorithmname, \listofalgorithms (Japanese names with pTeX/upTeX and LuaTeX-ja), a float type that does not clash with those of float, floatrow, newfloat and memoir, and a minimal placement [H] when the float package is not loaded. The content of an algorithm is set with algorithmic, algpseudocode, or any other package.
Supported formats/engines: pdflatex, xelatex, lualatex, platex, uplatex (with dvipdfmx).
| Package | Algorithmlite |
| Bug tracker | |
| Repository | |
| Version | 1.1 2026-10-28 |
| Licenses | The LaTeX Project Public License 1.3c |
| Copyright | 2026 Munehiro Yamamoto |
| Maintainer | Munehiro Yamamoto |
| Contained in | TeX Live as algorithmlite |
| Topics | Pseudo-code Float |
| See also | algorithms |