TikZ Favorites is a GitHub repository by Alfonso R. Reyes that collects 257 TikZ graphics and uses R, knitr, and Hugo to automatically generate a gallery README and deployable website from LaTeX source files.
What is TikZ Favorites?
TikZ Favorites is a curated repository of 257 TikZ graphics collected from the web, papers, slides, tutorials, and books, organized by Alfonso R. Reyes. It takes TikZ source files written in LaTeX, compiles them into PNG and PDF outputs stored in an out folder, and uses R packages knitr and rmarkdown to auto-generate a README that pairs each graphic with its code. The repository also includes a Hugo-based website that can be deployed to GitHub Pages from a docs folder. This lets you browse the visual result and click to see the underlying TikZ code.
Key Features
- Large collection — 257 TikZ figures saved as .tex files, sorted by filename, with 257 compiled using pdflatex and 1 using lualatex.
- Automated README generation — template.Rmd and child.Rmd work with knitr chunks to pull graphics and code from the src folder and assemble a README with the code and output side by side.
- Hugo website — A static site generator is included, with a _build_site.R script that customizes the site and supports deployment to GitHub Pages via the docs folder.
- Organized file structure — TikZ sources live under src, generated PDFs and PNGs go to out, and 19 data files used by the scripts are stored in src/data.
- LaTeX support files — 2 class, style, and library files are provided in the src/texmf folder for consistent compilation.
- Optimized build process — A Makefile has been refactored to avoid code repetition when compiling the examples.
- Educational pairing — Each example displays the compiled graphic next to its LaTeX source, making the relationship between code and output explicit.
- Cross-platform LaTeX — TikZ runs under any LaTeX distribution on Windows, Linux, or macOS, and the figures are plain text rather than binary.
Who is it for?
- TikZ beginners — Learn by viewing the rendered graphic and reading the source code of simple examples.
- LaTeX users — Find ready-to-adapt TikZ code for 3D plots, cones, cubes, AI diagrams, seismic focal mechanisms, and more.
- R and knitr users — See how R can dynamically organize LaTeX/TikZ files and generate reproducible documents.
- Technical writers — Use the gallery as a source of portable, reproducible graphics for papers, slides, books, or blog posts.
What can you do with TikZ Favorites?
- Study TikZ techniques — Browse examples like 3D shaded cylinders, torus parametric surfaces, or AI agent diagrams to understand specific libraries such as pgfplots, tikz-3dplot, and fadings.
- Reuse graphics in publications — Copy the .tex source and compile it locally to get vector graphics that fit any LaTeX document.
- Build your own gallery — Fork the repository, add your own .tex files to the src folder, and let the R scripts regenerate the README and website automatically.
- Deploy a static site — Publish the generated gallery to GitHub Pages using the included Hugo setup and docs-folder workflow.
How does it work?
The workflow starts when you place a TikZ source file with a .tex extension into the src folder. The included knitr chunks in template.Rmd read the sources, compile each one with pdflatex or lualatex, and write the resulting PNG or PDF to the out folder. The README.Rmd document then assembles the README with each figure and its code, and the optional _build_site.R script builds the Hugo website for deployment.
FAQ
How many TikZ figures are in the repository?
There are 257 TikZ figures saved as .tex files, plus one additional file that requires lualatex. The collection also includes 19 data files under src/data and 2 LaTeX style/library files under src/texmf.
Which R packages are needed?
The project relies on knitr and rmarkdown to integrate R code with LaTeX and TikZ. Hugo serves as the static site generator for building the web gallery.
Can I add my own TikZ drawings?
Yes. You can add new .tex files to the src folder and the automated scripts will include them in the README as long as they compile successfully. The template.Rmd file includes identifiers that allow custom settings to be applied.
How is the website deployed?
The recommended method is to publish the docs folder to GitHub Pages. The repository includes a _build_site.R script that customizes the Hugo site before deployment.
Who created the original idea?
The repository credits Walmes Zeviani for the original combination of LaTeX, TikZ, R, and Hugo, available at his GitHub repository. Alfonso R. Reyes built TikZ Favorites on top of that concept.








