LHS2TEX(1)
β¨ NAME β¨
okay so bestie, welcome to the lhs2TeX(1) page β this is the User Commands manual, and it's all about lhs2TeX: a literate Haskell to (La)TeX code translator. she's giving translator, she's giving typesetting, she's giving your .lhs file but make it fashion π
πΈ SYNOPSIS πΈ
lhs2TeX [options] file
π¦ DESCRIPTION π¦
so basically π this tool takes as its input a literate Haskell source file β and when we say literate we mean Bird-style or LaTeX-style or honestly even a combination of the two, she's flexible like that β and it produces output. what output? depends on the STYLE you picked, bestie:
- either a LaTeX document
- or a stripped version of the code
The output goes to stdout, no cap. And plot twist: several directives get interpreted by lhs2TeX itself, so you can customize the output even further. iconic behavior fr fr β¨
π OPTIONS π
okay so there are two whole sorts of options for lhs2TeX and you need to know the difference because it matters:
Sort one: selects a STYLE, which governs the overall mode of operation for lhs2TeX. And the rules? Only one style may be selected. one. single. style. periodt π
π The Styles π
--polyβ the poly style is an improvement of the older math style. She produces a LaTeX document, with the code blocks formatted using a proportional font. The output is highly customizable using formatting directives. Plus, the resulting code respects some of the alignments you made in the source file. lowkey obsessed π--mathβ the math style is like poly style, but with less alignment capabilities. Tokens appearing in the source file at a special column are all aligned in the output. Also, indentation is respected. still cute, just a lil different π--newcodeβ in the new code style, everything but code blocks is stripped from the file. On top of that, certain syntactic transformations can be performed on the code using formatting directives. For example: if your source code is annotated in certain positions to produce even nicer results in poly style, you can use newcode style to remove those annotations. it's giving cleanup crew π§Ή--codeβ in code style, all comments and specification code is stripped from the file, so that only the code remains. Use this if you want to produce a smaller version of your source file. diet version, slay π--ttβ typewriter style prints code almost verbatim, using a monospaced font, but formats certain symbols (lambda abstraction, arrows ...) using an extended character set. This style is the default if no style is explicitly selected β but bestie, do NOT rely on that behaviour. The default style may be changed in future versions. it's giving "she's the default for now" π--verbβ verbatim style prints code as-is, using a monospaced font. No formatting whatsoever is applied to the code. However β and this is the fun part β lhs2TeX does not make use of a LaTeX verbatim environment; instead it escapes special TeX constructs in the translation. Which means it's easier to pass the resulting TeX code to macros or use it inside certain environments than it would be with a native verbatim-environment. sneaky smart π§
π The Info-Only Styles π
The following options are also considered as styles, but they return only information about the program:
-h,-?,--helpβ Returns a short usage message listing all the available options. your little map πΊοΈ-V,--versionβ Returns version information. who dis π--copyingβ Displays the complete GNU General Public License. the whole thing. all of it. π--warrantyβ Displays the parts of the GPL that concern warranty. the fine print, but make it official π
π The Remaining Options π
The remaining options modify the behaviour of the program:
-Ppath,--path=pathβ Takes a (colon-separated) listpathof paths that are used as search path for files to be included. And the colon placement rules are very specific, bestie, so listen up:- If the list starts with a colon, then the list is appended to the current search path.
- If the list ends with a colon, then the list is prepended to the current search path.
- If there is neither a colon at the beginning nor at the end of the list, then the list replaces the current search path.
Environment variables can be used in the list of paths if enclosed in curly braces, i.e., {VAR} expands to the current value of the environment variable VAR. And if a path ends with a double slash //, then all subdirectories of that path are included in the search path. Note that this can significantly slow down lhs2TeX when looking for files. so use it with intention, not chaos π
The built-in default search path of lhs2TeX is:
{HOME}/lhs2TeX//
{HOME}/.lhs2TeX//
{LHS2TEX}//
/usr/local/share/lhs2tex//
/usr/local/share/lhs2TeX//
/usr/local/lib/lhs2tex//
/usr/local/lib/lhs2TeX//
/usr/share/lhs2tex//
/usr/share/lhs2TeX//
/usr/lib/lhs2tex//
/usr/lib/lhs2TeX//
look at all those paths. she's thorough π
-ifile,--include=fileβ Includesfilebefore anything else. This option has the same effect as a
%include file
directive at the beginning of the source file. same energy, different delivery π«Ά
-lequation,--let=equationβ Assumesequationwhile processing the source file. This option has the same effect as a
%let equation
directive at the beginning of the source file. assuming things but in a productive way β¨
-sflag,--set=flagβ Setsflagto True at the beginning of the source file. This option has the same effect as a
%let flag=True
at the beginning of the source file. turning it ON π
-uflag,--unset=flagβ Setsflagto False at the beginning of the source file. This option has the same effect as a
%let flag=False
at the beginning of the source file. turning it OFF π
β VERSION β
1.24
π AUTHORS π
- Andres Loeh
<polytable at andres-loeh dot de>wrote poly and newcode styles and is the current maintainer of the package. main character maintainer energy π₯ - Ralf Hinze
<ralf at informatik dot uni-bonn dot de>wrote the original lhs2TeX. the OG. the blueprint. the founding mother of the whole vibe πΈ
π SEE ALSO π
https://github.com/kosmikus/lhs2tex, the lhs2TeX development repository and issue trackerhttps://hackage.haskell.org/package/lhs2tex, the lhs2TeX Hackage pageGuide2.pdf, the manual
and that's the whole page bestie!! this was lhs2TeX β version 1.24, from the User Commands manual, dated April 2015, written by Andres Loeh and Ralf Hinze, and maintained by the lhs2TeX crew π«Ά go format something gorgeous, you've got this πβ¨π
π¦ where this page comes from
- debian bookworm: lhs2tex 1.24-1+b2 Β· GPL-2.0-or-later
- ubuntu jammy: lhs2tex 1.24-1build2.1 Β· GPL-2.0-or-later
- ubuntu noble: lhs2tex 1.24-1build2.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms