Verzeichnis macros/generic/tcode
This is the package Tcode, by J. A. Múgica.
-----------------------------------------------
Public domain.
The author can be reached under the name of "javier" at aerotri.es.
First release on 2026 / october / 7
-----------------------------------------------
This is a package for typesetting code (e.g., C, python, Fortran... ). It only needs
etex, though in practice you will need pdftex or its extensions (Luatex, ...).
The inline macro is \ncode{} and the display ones \Code ... \endCode, or
\begin{Code} ... \end{Code}.
Look for examples in the folder "examples".
See Tcode_users.html and Tcode_developers.html for more explanations.
-----------------------------------------------
The package has a kernel supporting no language in particular and comes with
support (syntax highlighting and other support) for C, python and julia,
in decreasing order. You should
\input Tcode_C.tex %For C
\input Tcode_py.tex %For python
\input Tcode_julia.tex %For julia
Contributions to support other languages and to improve the support for
python and julia are welcome.
The package started as a set of macros to replace the listings package in the
sources used for the ISO-C document. The latter package is extremely slow
when hundreds of words are defined. Further, it produced wrong spaces at
the edge of inline snippets here and there, and was difficult to modify, or
at least this author didn't know how (e.g., for correctly parsing numbers in C).
For those in a similar situation, this package may be a good alternative to
"listings". In particular, the support for C is, we hope, better.
----------------------------------------------
Tcode has a modular design, with a kernel, per-language definitions,
per-language list of words and per-language syntax highlighting definitions,
typically in separate files. See example_userlanguage.tex and Tcode_example.tex
for scratch definitions for a language.
The package includes a colour utility that can be used independently of the rest
of the package: pdfcolor-rg.tex. It defines a \color macro, only suitable for
pdf backend, rgb and gray models. \DefColor{name}{0.2, 1, 0.5}, \DefGray{name}{0.34},
for example, for defining colours. Small, easy to understand and debug, and fast.
Herunterladen des vollständigen Inhalts dieses Pakets in einem Zip-Archiv (166.2k).
Tcode – Typesetting verbatim code: C, python,…
This is a package for typesetting code (e.g., C, python, julia,…). pdfTeX is enough for it (you can use it with LaTeX, but it does not need it). The package has a kernel supporting no language in particular and comes with support (syntax highlighting and other) for C, python and julia, in decreasing order.
The inline macro is \ncode{}, and the display ones \Code … \endCode, or \begin{Code} … \end{Code}. This package is much faster than the listings package, though for the time being it only comes with full support for C and to a lesser extent for python and julia. You are welcome to add support for other languages. You may take Tcode_example.tex and Tcode_julia.tex as templates.
| Paket | Tcode |
| Version | 2026-10-07 |
| Lizenzen | Public Domain Software |
| Betreuer | Javier A. Múgica |
| Themen | Verbatim Listings Syntax-Highlighting |