txt2latex - convert flat ASCII text to LaTeX.
txt2latex [OPTION...] FILE
txt2latex converts the input text into LaTeX. The conversion procedure is strongly inspired by txt2man.
txt2latex is also able to recognize and format sections, paragraphs, lists (standard, numbered, description, nested), literal display blocks.
If input file FILE is omitted, standard input is used. Result is displayed on standard output.
Here is how text
patterns are recognized and processed:
Sections
These headers are defined by a line in upper case, starting column 1. Optionnally, the Section name can be preceded by a blank line. This is useful for a better visualization of the source text to be used to generate the LaTeX source code.
Paragraphs
They must be separated by a blank line, and left aligned. Alternatively two blank spaces can be used to produce the same result. This option will provide a better visualization of the source text to be used to generate the LaTeX source code.
Description list
The item definition is separated from the item description by at least 2 blank spaces, even before a new line, if definition is too long.
Bullet list
Bullet list items are defined by the first word being "-" or "*" or "o".
Enumerated list
The first word must be a number followed by a dot or a round bracket.
Literal display blocks
This paragraph type is used to display unmodified text, for example source code. It must be separated by a blank line and be indented by a TAB. It is primarily used to format unmodified source code. It will be printed using fixed font using verbatim environment.
Mathematics
Inline mathematics must be enclosed with round brackets and equations must be enclosed with squared brackets. Brackets must be escaped with a blackslash.
-v, --version
Display version.
-h, --help
Display help.
-d date
Set date. Defaults to current date.
-t mytitle
Set the title. If the title is set, txt2latex will automatically add the preambule and tags for the document
-a author
Set the author.
-s shift
Shift heading level by 0 (section), 1 (subsection), or 2 (subsection). Defaults to 0.
|
-I txt |
Italicize txt in output. Can be specified more than once. | ||
|
-B txt |
Emphasize (bold) txt in output. Can be specified more than once. |
-P package
Add packages or LateX commands in the preambule. LateX commands must be doubled escaoed e.g. \usepackage{ccfonts}.
|
-X |
Compile output with pdflatex. |
Simple conversion
$ txt2latex FILE > FILE.tex
Conversion with document title
$ txt2latex -t "title" -a "author" -I "word" FILE > FILE.tex
Conversion with custom packages and direct rendering with pdflatex
$ txt2latex -t "title" -a "author" -I "word" -P "\usepackage{ccfonts}" -X FILE
txt2man(1)