CTAN Comprehensive TeX Archive Network

New on CTAN: texgit

Datum: 21. Juni 2025 07:38:35 MESZ
Thomas Weise submitted the texgit package. Version: 0.9.6 2025-06-20 License: lppl1.3 Summary description: Download, access, and potentially execute files from git Announcement text:
The “texgit” package is a tool mainly intended for including source codes and files from external “git” repositories in LaTeX code. Imagine that you are teacher in the field of computer science. Maybe you are teaching a programming class. You want to use LaTeX to make a course book or course slides. Naturally, you will want to include example programs and source codes in your book/slides. Maybe you even want to execute your codes and show their outputs. That is, at present, tedious. You could put them as files into your teaching material and manually execute them. But they will always be isolated examples and more often than not, code examples are just written directly in the LaTeX sources in listings environments. With the “texgit” package, you can separate your example codes from your teaching material. You can put them into a separate “git” repository. In your LaTeX code, you can tell “texgit” to download this repository (it will be cached locally) and then get the local paths to the files in the repository. Moreover, you can also execute the downloaded files and let “texgit” store their output into local files (which, again, will be cached). You can then include these files in your teaching material. The “texgit” package allows you to do the following things: - download files from a “git” repository and access them from LaTeX, - apply some post-processor to the downloaded files (e.g., strip comments and type hints from Python code) and access the post-processed files instead, - execute scripts or programs -- either local or downloaded from “git” repositories -- and fetch their output into local files accessible from LaTeX, - create local paths accessible from LaTeX which can be passed as arguments to the scripts or programs that are executed, e.g., as argument to a Python script that creates and stores a “matplotlib” plot under the path that it received as argument, allowing you to programmatically create figures and include them LaTeX documents. The package works a bit like “BibTeX”: Let’s say your document is named “document.tex”. During the first “pdflatex” run, executed as “pdflatex document”, all the requests mentioned above, say, to download files from “git” repositories, are stored in the “aux” file. The paths corresponding to the requests point to an empty file at this stage. Then you would apply the “texgit” post-processor by calling “python3 -m texgit.run document”. This Python program (see https://pypi.org/project/texgit) executes all the requests and caches their results locally. During the second run of “pdflatex document”, the paths corresponding to the requests then point to the actual downloaded or generated files. All downloaded or generated files will be locally cached in a folder named “__git__” in your document’s directory. You can delete this folder to refresh the files.
The package’s Catalogue entry can be viewed at https://ctan.org/pkg/texgit The package’s files themselves can be inspected at https://mirrors.ctan.org/macros/latex/contrib/texgit/
Thanks for the upload. For the CTAN Team Petra Rübe-Pugliese
CTAN is run entirely by volunteers and supported by TeX user groups. Please join a user group or donate to one, see https://ctan.org/lugs

texgit – Download, access, and potentially execute files from git

This package allows you to do the following things:

  • download files from a git repository and access them from ,
  • apply some post-processor to the downloaded files (e.g., strip comments and type hints from Python code) and access the post-processed files instead,
  • execute scripts or programs — either locally or downloaded from git repositories — and fetch their output into local files accessible from ,
  • create local paths accessible from which can be passed as arguments to the scripts or programs that are executed, e.g., as argument to a Python script that creates and stores a “matplotlib” plot under the path that it received as argument, allowing you to programmatically create figures and include them in documents.

The package works a bit like : Let’s say your document is named document.tex. During the first pdflatex run, executed as pdflatex document, all the requests mentioned above, say, to download files from git repositories, are stored in the aux file. The paths corresponding to the requests point to an empty file at this stage. Then you would apply the texgit post-processor by calling python3 -m texgit.run document. This Python program executes all the requests and caches their results locally. During the second run of pdflatex document, the paths corresponding to the requests then point to the actual downloaded or generated files. All downloaded or generated files will be locally cached in a folder named __git__ in your document’s directory. You can delete this folder to refresh the files.

Pakettexgit
Version0.9.6 2025-06-20
Copyright2023–2025 Thomas Weise
BetreuerThomas Weise

Ankündigungen

mehr

Gästebuch Seiten-Struktur Impressum Autor kontaktieren