Skip to content

Release v1.0

Choose a tag to compare

@MacLotsen MacLotsen released this 08 Jun 10:35
283e464

comment2tex v1.0 (2026/06/08)

First public release.

comment2tex typesets a source file that carries its own documentation in
special comments: doc-comment lines become ordinary LaTeX, everything else
becomes a listing.

Highlights

  • Two public macros. \includebash{file} and \includelua{file} read a
    source file, convert it, and input the result — no manual build step.
  • One Lua converter, two roles. comment2tex.lua runs both as a texlua
    command-line program and as an in-process library loaded by the TeX wrappers.
  • Engine coverage.
    • LuaLaTeX (recommended): converts in process via \directlua — no shell
      escape, no separate run.
    • pdfLaTeX with --shell-escape: converts through \write18.
    • pdfLaTeX without shell escape: pre-build the fragments, then a plain run
      inputs them; a missing fragment raises an error naming the command to run.
    • plain TeX: comment2tex.tex provides the same two macros, with a built-in
      verbatim listing in place of listings.
  • Configurable styles. Presets for Bash (##) and Lua (---), each pairing
    a doc-comment prefix with a listing language; --comment, --language,
    --begin, and --end override individual fields.
  • Continuous listing numbers. Code blocks split by prose keep a single,
    continuous line numbering (firstnumber=last). The runtime comment2tex.lua
    in this release ships with its doc-comments stripped, so its line numbers match
    the listing numbers in the documentation.

Installation

Run tex comment2tex.ins to extract comment2tex.sty and comment2tex.tex,
then place those and comment2tex.lua in a directory searched by TeX. Build the
documentation with lualatex comment2tex.dtx.