Package: texproject
TexProject: An automatic LaTeX project manager.TexPRoject is a command-line LaTeX template and project manager written in Python.IntroductionInstallationOn UNIX-like systems, typically one can install the command-line tool with the following commands:pipinstalltexproject
gitclonehttps://github.com/alexrutar/texproject-templates~/.local/share/texprojectTexproject complies with theXDG Base Directory Specification; replace~/.local/shareor~/.configwith your configured directories.
Currently, there is no installation script or package manager support, but I hope to implement this eventually.To configure Texproject, you can generate a global configuration file in the directory~/.config/texproject/by runningmkdir-p~/.config/texproject
tprutilshow-config>~/.config/texproject/config.tomlBasic UsageTexproject is installed under the command line tooltpr.
To create a new project, create an empty directory, change into it, and runtprinit<template>This command will create a new project using the template with name<template>in the current directory.
To specify a different directory, use the-C <path>flag.
This creates the filesmain.tex(for primary document contents) andproject-macros.sty(for project-specific macros).
To get a list of available templates, runtprlisttemplateIf you are currently in a project file, runtprarchive<output.zip>to create compressed source files for your project in the same directory.If you want to edit parameters of your document (such as citation files, additional macro sets, or other features), runtprtemplateeditto open the project template file in your$EDITOR.
When the file is closed, the project is automatically updated.
Note that this will not overwrite existing linked files.If you want to overwrite existing files, thetpr importfunction may be useful.
For instance, to update thetikzmacro file, you would runtprimport--macrotikzThis subcommand can also be used to import files not in the template repository.
If you have a citation file/path/to/citation.bib, runtprimport--citation-pathpath/to/new/file.bibYou can then include this file by addingfileto thecitationssection of the project configuration file.
You can also programmatically add new imports as well: in the above example, runtprtemplateadd--macrotikzRead about more features by runningtpr--help
tpr<subcommand>--helpOther Major FeaturesAutomatic CompilationA number of subcommands used by Texproject use thelatexmkprogram for automatic compilation.
This is useful in order to programmatically verify compilation, as well as automatic creation of.pdfor.bblfiles from source files when exporting.
For example, to create a compressed export with includes a.pdfof the current build, runtprarchiveoutput.zip--modebuildRuntpr validate --helportpr archive --helpfor more information on some subcommands which use automatic compilation.GitHub Repository ManagementTexproject also has an automated tool that is useful for setting up a remote a repository onGitHubwith convenient continuous integration features.
In order to use these features,git, along with theGitHub CLI, must be installed and properly authenticated.WARNING:The commands in this section will create and modify repositories and continuous integration on your GitHub account.In a new project without an initialized.gitrepo, run the commandtprgitinitto begin an interactive session to set up a new git repo with a remote on GitHub.
This command does the following:Initializes a new git repository in the working directory.Adds the relevant files, and creates a first commit.Creates a new GitHub remote, with parameters as specified during the interactive prompt.Sets a repository secretAPI_TOKEN_GITHUB, which is used by some of the CI features.In order to see the commands which will be run without executing them, usetpr -n git init.Automatic releasesThis GitHub repository is initialized with a custom action (see.github/workflows/build.yaml) which automatically creates GitHub releases for tagged versions on your project.
For example, suppose you make some changes to your.texfile and commit them to your repository:echo"% a comment">>main.tex
gitcommit--am"A nice commit message"Then, create a tag and push the commit along with the tag:gittagv1.0-m"First release!"gitpush--follow-tagsNow, after the action has finished running, the compiled files will be visible at the URLhttps://github.com/username/reponame/releases.Usage ExamplesBasic project initializationHere, we demonstrate the construction of a basic project.
First, create a project with the nameexampleusing theemptytemplate, and change into the directory.mkdirexample&&cdexample
tprinitemptyThe relevant project files in this directory aremain.texandproject-macros.sty.
The filemain.texfile is the main document file which you can edit to produce your document.
Theproject-macros.styfile is an empty package in which you can input custom project-dependent preamble.
These packages are always loaded after any specified project files.Suppose we want to include the macro setgeneralwith our project: to do this, runtprtemplateadd--macrogeneralIf you want to share this project with someone else, simply runtprarchiveoutput.zipwhich will generate the fileoutput.zipwithin the project directory.
This zipfile contains all the source files required to compile the document.