Skip to main content

An automatic LaTeX project manager.

Project description

TexProject: An automatic LaTeX project manager.

TexPRoject is a command-line LaTeX template and project manager written in Python.

Introduction

Installation

On UNIX-like systems, typically one can install the command-line tool with the following commands:

pip install texproject
git clone https://github.com/alexrutar/texproject-templates ~/.local/share/texproject

Texproject complies with the XDG Base Directory Specification; replace ~/.local/share or ~/.config with 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 running

mkdir -p ~/.config/texproject
tpr util show-config > ~/.config/texproject/config.toml

Basic Usage

Texproject is installed under the command line tool tpr. To create a new project, create an empty directory, change into it, and run

tpr init <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 files main.tex (for primary document contents) and project-macros.sty (for project-specific macros). To get a list of available templates, run

tpr list template

If you are currently in a project file, run

tpr archive <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), run

tpr template edit

to 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, the tpr import function may be useful. For instance, to update the tikz macro file, you would run

tpr import --macro tikz

This subcommand can also be used to import files not in the template repository. If you have a citation file /path/to/citation.bib, run

tpr import --citation-path path/to/new/file.bib

You can then include this file by adding file to the citations section of the project configuration file. You can also programmatically add new imports as well: in the above example, run

tpr template add --macro tikz

Read about more features by running

tpr --help
tpr <subcommand> --help

Other Major Features

Automatic Compilation

A number of subcommands used by Texproject use the latexmk program for automatic compilation. This is useful in order to programmatically verify compilation, as well as automatic creation of .pdf or .bbl files from source files when exporting. For example, to create a compressed export with includes a .pdf of the current build, run

tpr archive output.zip --mode build

Run tpr validate --help or tpr archive --help for more information on some subcommands which use automatic compilation.

GitHub Repository Management

Texproject also has an automated tool that is useful for setting up a remote a repository on GitHub with convenient continuous integration features. In order to use these features, git, along with the GitHub 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 .git repo, run the command

tpr git init

to begin an interactive session to set up a new git repo with a remote on GitHub. This command does the following:

  1. Initializes a new git repository in the working directory.
  2. Adds the relevant files, and creates a first commit.
  3. Creates a new GitHub remote, with parameters as specified during the interactive prompt.
  4. Sets a repository secret API_TOKEN_GITHUB, which is used by some of the CI features.

In order to see the commands which will be run without executing them, use tpr -n git init.

Automatic releases

This 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 .tex file and commit them to your repository:

echo "% a comment" >> main.tex
git commit --a m "A nice commit message"

Then, create a tag and push the commit along with the tag:

git tag v1.0 -m "First release!"
git push --follow-tags

Now, after the action has finished running, the compiled files will be visible at the URL https://github.com/username/reponame/releases.

Usage Examples

Basic project initialization

Here, we demonstrate the construction of a basic project. First, create a project with the name example using the empty template, and change into the directory.

mkdir example && cd example
tpr init empty

The relevant project files in this directory are main.tex and project-macros.sty. The file main.tex file is the main document file which you can edit to produce your document. The project-macros.sty file 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 set general with our project: to do this, run

tpr template add --macro general

If you want to share this project with someone else, simply run

tpr archive output.zip

which will generate the file output.zip within the project directory. This zipfile contains all the source files required to compile the document.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

texproject-0.8.8.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

texproject-0.8.8-py3-none-any.whl (30.9 kB view details)

Uploaded Python 3

File details

Details for the file texproject-0.8.8.tar.gz.

File metadata

  • Download URL: texproject-0.8.8.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for texproject-0.8.8.tar.gz
Algorithm Hash digest
SHA256 b04a300430ee3f4eed2aaf98b40722c7afab7c31aed2d66c81fdd1b6110c9f5a
MD5 cac7f9f639e086379b6dd87831d358df
BLAKE2b-256 d7ac357fe13be47b6121343f2529c46a0f1f8d31ffb5bbdf9fd11ee9e467e629

See more details on using hashes here.

File details

Details for the file texproject-0.8.8-py3-none-any.whl.

File metadata

  • Download URL: texproject-0.8.8-py3-none-any.whl
  • Upload date:
  • Size: 30.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0

File hashes

Hashes for texproject-0.8.8-py3-none-any.whl
Algorithm Hash digest
SHA256 18c922818b52629d14e34e3f7262154855daca7e8e362cedc3d5cdc8dfcec19f
MD5 385734f05f0c96e5a15d191181995469
BLAKE2b-256 5248e2954fe771dd6a423b13042acda2fddf78660185ac330c591885fa003899

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page