Release v1.0
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.luaruns both as atexlua
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.texprovides the same two macros, with a built-in
verbatim listing in place oflistings.
- LuaLaTeX (recommended): converts in process via
- Configurable styles. Presets for Bash (
##) and Lua (---), each pairing
a doc-comment prefix with a listing language;--comment,--language,
--begin, and--endoverride individual fields. - Continuous listing numbers. Code blocks split by prose keep a single,
continuous line numbering (firstnumber=last). The runtimecomment2tex.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.