LHS2TEX(1)

πŸ“¦
version 1.24 Β· 2 versions
, in debian bookworm, ubuntu jammy, ubuntu noble

✨ 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) list path of 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 β€” Includes file before 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 β€” Assumes equation while 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 β€” Sets flag to 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 β€” Sets flag to 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 πŸŽ€


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