md2latex Synopsis


md2latex Synopsis


Everything md2latex can do, on one page: what to write, and what it does. md2latex turns a RexxPub article or book into LaTeX for LuaLaTeX, and with --pdf into a PDF, for the article class, a publisher's (llncs, IEEEtran, acmart) or a printed book. Each group ends with a link to the md2latex page, which tells the whole story. Which of these features the other md2 programs share is in the table of features; what the front matter can say, in The Front Matter at a Glance.

This page describes the programs of 2 November 2026.

The Command Line

[rexx] md2latex [options] file.md

md2latex writes file.tex next to file.md; with --pdf it runs LuaLaTeX too, as many times as a book needs (up to five).

Option What it does
--pdf Run LuaLaTeX too, and write the PDF.
--class NAME article (the default), llncs, IEEEtran, acmart or book.
-o, --output FILE The LaTeX file to write.
--style NAME\|FILE The colours of the Rexx code (default light, for paper).
--pandoc-highlighting-style NAME Pandoc's colours for code that is not Rexx (default pygments).
--listings Code that is not Rexx set with listings.
--csl NAME\|PATH The citation style (--csl acm, say).
--header FILE, --filter FILE LaTeX of your own after md2latex's preamble; a Lua filter after md2latex's.
--line-numbers Every line of the text numbered in the margin, page by page, for proofreaders.
--default "options", -xtr, -exp, -u Options for every code block; the Executor, Experimental and Unicode (TUTOR) dialects.
--keep Keep the intermediate files.
--check-deps Check that Pandoc, LuaLaTeX and the fonts are there.

→ Usage, Options, Requirements

The Document

md2latex reads the same Markdown as md2pdf. The general rules: braces after something are its attributes ({#name}, {.class}, {key=value}); [text]{...} is a span; ::: class … ::: is a block, and an outer block has more colons (:::::).

Write What it does
docclass: article / book in the front matter An article (the default), or a printed book. --class names a publisher's class.
::::: title-page, with ::: author, affiliation, address, city, country, email, phone, date The title block of the class; each author starts a new author. A subtitle in <small>. Or title:, author:, date: in the front matter.
::: abstract, ::: keywords The abstract and the keywords, as the class writes them. Or abstract:, keywords: in the front matter.
::::: epigraph with ::: cite and ::: attribution; ::: quote, ::: quotation, ::: noindent Epigraphs, quotations, a paragraph with no indent.
{.newpage} on a heading or on any ::: A new page.
<small>HTML</small> Small capitals for an acronym; small print for anything else. <sup>, <sub>, <br>, <kbd>, <s>… are translated; other tags are left out, and md2latex says so. A <span style="color:…"> keeps its text and loses its colour, and md2latex says so: there is no colour in the text.
[text]{.smallcaps}, 2^nd^, \ at the end of a line Small capitals, a superscript, a line break.
A list nested five levels deep or more Up to nine levels, numbered 1. from the fifth on.
<pre> … </pre> A terminal session: plain text in the box of the code.
[@key], bibliography: and ::: {#refs} Citations, through Pandoc's citeproc, in the style of csl: in the front matter, or else of --csl.
section-numbers:, size: (10, 11, 12), lang: How deep sections are numbered; the text size, in article and book; the language (babel: "Figure", "Table", "Contents"; and "Listing"). An article is A4 with 3 cm margins; a book takes latex: paper:; a publisher's class sets its own page and its own size.
::: center Centred.
latex: class-options: review, anonymous Options for the document class.
latex: line-numbers: yes As --line-numbers. Listings, output and tables are not numbered.

→ What Is Translated

Books

With docclass: book: chapters at the top, facing pages, a wider inner margin, running heads.

Write What it does
# Title {.part} A part (Part I, II…). Any other level-1 heading is a chapter.
{.unnumbered} A heading with no number.
{.toc-exclude} on a heading or on a ::: Kept out of the contents; the heading keeps its number.
The unnumbered chapters before the first part or numbered chapter The front matter, with Roman page numbers.
{.back} on a heading The back matter starts here (the index, say).
::::: title-page with # Title {.book-title}, ## Subtitle {.book-subtitle}, ::: author, ::: title-line, ::: title-verso The title page, and the back of it (edition, copyright, address). The class goes on the heading, or on a span in it: # [Title]{.book-title}, as md2pdf writes it.
::: {#toc}, #list-of-figures, #list-of-tables, #list-of-listings (empty, with the list's title as their heading) Where the contents and the lists go. latex: toc-depth: 3: how deep the contents go.
# Index {#index .unnumbered .back} and ::: {#index-body} Where the index goes.
latex: list-gaps: no The lists of figures and tables in one run, not grouped by chapter.
::: {#id .listing}, {#id .figure}, {#id .table}, the caption as the last paragraph A numbered code, figure or table, in its list. The number comes from where it stands, not from its name.
listings: label: Code, listings: numbering: section "Code 1.1-1": the label of the .listing blocks, and numbers within each section (or chapter). A fence's own caption= says it too ("Code 1."), or "Listing" in the document's lang:.
latex: header:, latex: filter:, latex: paper: The book's own LaTeX and its own classes (a definition box, say, in a Lua filter); the paper.

→ Books

Cross-References, Footnotes and the Index

In a book, everything below is worked out at each run, from where things are. The text in the brackets is what a reader of the HTML version sees, and what LaTeX prints when the target does not exist (md2latex warns).

Write What it prints
[Code 1.1-1](#code-1.1-1){.ref} The thing with its number: "Code 1.1-1", "Figure 2"; for a section, its number.
{.ref-num} The number only. To an anchor []{#name}, the number of its section.
{.ref-chapter} The number of the chapter the target is in ("2" for section 2.3.6, a listing or a note in chapter 2).
{.ref-text} The title of a section.
{.ref-page} The page.
{.ref-dir} "above" or "below", by where the target is.
[^n9] and [^n9]: text A footnote. n9 is only a name; the number is LaTeX's.
[12]{.ref-num note=n12}, .ref-page, .ref-dir with note= The number, the page, "above"/"below" of a footnote.
[12]{.ref-note note=n12} The note's mark again, raised.
[]{ix="Keyword!PARSE!ARG"}, {.main} An index entry, up to three levels; .main makes its page bold.

In an article, .ref and the others are plain links.

→ Books

Rexx Code

Write What it does
```rexx A Rexx listing, highlighted as in HTML and written as LaTeX macros made from the same style sheet: it looks the same. A box that breaks across pages.
style: in the front matter The colours (light by default), or a style file of your own next to the document.
```rexx {.numberLines startFrom=10} Line numbers, from 10.
```rexx {caption="Text"} A caption.
```rexx {source=code/a.rex} with nothing inside The program read from that file.
```rexx {blanks=data}, blanks=all The blanks a program sees, or all of them, drawn as ␣.
```rexx {program=p1} Pieces of one program, highlighted as one.
```executor, {experimental}, {unicode} A dialect.
A listing too wide Set smaller, down to 60%; only a line still too long goes on in the next line.
A listing that does not parse Shown as the error; md2latex says so and goes on.
`say "hi"`{.rexx}, [USE]{.kw} Rexx in the text, anywhere (headings and footnotes too); a keyword.
mentions: background: none The mentions keep their colours, on no ground.

→ Rexx Code

Other Code and Output

Write What it does
```java, ```vb, ```sh Highlighted by Pandoc, in the colours of highlight-style:, also in a table. Pandoc's names: vb, not vba.
``` with no language The code font, as it is; long lines go on in the next line.
latex: code: listings Code that is not Rexx set with listings.
``` {.output} What a program printed: a look of its own (italic) in a book; in an article, a plain code block.
`x`{.out} A piece of output in the text (italic in a book; in an article, plain code).
`a b`{.out .blanks}, `c d`{.blanks} Code in the text with its blanks drawn as ␣.
source=, .numberLines, startFrom=, blanks=, caption= As on Rexx (any blanks= shows every blank).

→ Code That Is Not Rexx

Tables

Write What it does
Any Pandoc table Balanced: each column as wide as what it holds asks for.
::: {#id .table cols=1:4} around it The proportions of its columns.
rules=solid\|dashed\|dotted, .grid, .stripes, stripes=#E8F0FF on the same ::: Lines under the rows; a line round every cell; every second row on a colour (not in the two-column classes, where a table is a float). .nogrid, .nostripes undo the front matter's.
tables: grid: yes, tables: stripes: yes in the front matter For every table, articles too.
scale=0.85 on a ::: or a [span] Its text and code smaller, so that code in a cell is not broken. Scales multiply when they nest.
A grid table with a \| left out A cell across several columns.
Fences in the cells of a grid table Code in a cell (a "Rosetta Stone"), highlighted; the table is drawn again as wide as the code needs.
In IEEEtran and the two-column acmart formats Tables are floats.

→ Books

Marks, Grounds and Frames

Write What it does
spot="err:3 msg:[NOVALUE] ink" on a fence Marks lines and texts, every beat at once. name:3, name:3-5, name:[text], name:3[text]; caseless, part.
wash, ink, box, bold, pen=1…4, pen=#C00000 How the marks look (ring is drawn as a box); without pen=, a beat takes the pen of its place in the document, and keeps it in every block.
background=, border=, border-width=, border-color= on a fence The block's ground and frame; a frame is open where the block breaks across pages.
blocks: in the front matter For every block, for code:, output:, other: or one language (bash:).

→ Marks, Grounds and Frames

ACM, Springer, IEEE

Write What it does
--class acmart ACM's class, sigconf unless latex: class-options: names another; review and anonymous too. City and country of every affiliation on their own (::: city, ::: country).
latex: header: acm.tex What only ACM knows: rights, conference, DOI, CCS concepts.
--csl acm The ACM reference format.
--class llncs, --class IEEEtran Springer's LNCS (authors who share an institution share it); IEEE in conference mode (a block per author). An unknown class is reported and written as an article.

→ ACM

Characters

Text in any script, symbols, CJK and emoji: every font has a chain of fallback fonts, right-to-left scripts are set in their direction, and scripts that need shaping are shaped. A character that no font has is an error, listed with its code point: nothing is lost in silence.

→ Unicode