Convert a Newick tree to a complete LaTeX document.
Input:
- A Newick tree file.
- If the file contains multiple trees, only the first tree is processed.
- Use
--forestto pass through a file that already contains Forest code.
Notes:
- Styles are stored in the comments of each node.
- Draws a cladogram by default.
- Use
--blto draw a phylogram with branch lengths. - Underscores (
_) in names, labels, comments, and visualization attributes (dot,bar,rec,tri) are replaced with spaces. - Other LaTeX special characters (
{ } \ # $ % & ~ ^) in names, labels, comments, and visualization attributes (dot,bar,rec,tri) are escaped automatically. - Requires a LaTeX installation with
fontspec,xeCJK(for East Asian characters), and theforestpackage. Compilation can be done withtectonicorlatexmk -xelatex. - Use
--no-default-style(--style) /-sto keep the template’s original font setup instead of injecting the defaultNoto Sansconfiguration.
Examples:
-
Generate a LaTeX file
necom nwk to-tex tree.nwk -o tree.tex -
Compile with Tectonic
tectonic tree.tex -
Compile with Latexmk
latexmk -xelatex tree.tex