10 releases

0.2.8 Apr 19, 2022
0.2.7 Apr 18, 2022
0.2.3 Mar 24, 2022
0.2.1 Feb 16, 2022
0.1.0 Feb 11, 2022

#349 in Text processing

Download history 26/week @ 2023-05-27 33/week @ 2023-06-03 1/week @ 2023-06-10 55/week @ 2023-06-17 26/week @ 2023-06-24 48/week @ 2023-07-01 56/week @ 2023-07-08 50/week @ 2023-07-15 57/week @ 2023-07-22 15/week @ 2023-07-29 30/week @ 2023-08-05 23/week @ 2023-08-12 22/week @ 2023-08-19 20/week @ 2023-08-26 16/week @ 2023-09-02 33/week @ 2023-09-09

95 downloads per month
Used in 4 crates (3 directly)

MIT license

35KB
839 lines

TexCreate by Mustafif Khan

Crates.io Lines of code Crates.io GitHub top language

"Buy Me A Coffee"

This project is under the MIT License

TexCreate is a LaTeX Project creator that allows users to easily create projects using a configuration file that will define a template, project name, and metadata. Compared to version 2 which last saw an update 10 months ago, version 3 comes with a focus on template modularity and stability.

Template Modularity?

In previous versions the templates are in someway embedded in the programs code, such as in version 2 we saw that being done using texc_latex crate. However, this limited the amount of templates that could be available to users as they would have to wait for a minor update to see a template addition. So...how was this fixed? This was solved in 2 parts, first was by creating an opensource template generator texcgen (note: TexCreate templates are built with a fork mkproj_texcgen), and the second part is done in a web service texcweb. The ability to put a template into a JSON file using the handy texcore library I developed allows it to be easily downloaded in the latest releases and TexCreate is able to know about these updates because of texcweb.

If you are updating from an earlier beta (before Beta 9) to stable, please make sure to update to the latest template repo (currently v2). Due to the update of TexCore 0.6.0 from 0.4.17, earlier templates are broken. To update to the latest template use the command texcreate update.

How to get started?

Installing

Cargo Method

# make sure to have rust installed 
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# install via Cargo 
$ cargo install texcreate

Debian Method

# this method is only for Debian amd64 Linux systems
# will automatically install autocomplete 
$ curl --proto '=https' https://texcreate.mkproj.com/sh | sudo sh

Setting up Autocomplete

This example will show how to do auto complete for the bash shell:

$ apt-get install bash-completion -y
$ texcreate gen-complete --shell bash
$ mv texcreate.bash /usr/share/bash-completion/completions/

The new thing with TexCreate is that templates are locally stored in the directory $HOME/.texcreate where the structure looks like the following:

$HOME/.texcreate/
                # where MKProj first party templates are saved
                mkproj/
                # where custom generated templates are saved
                custom/

To setup this directory structure you will need to run the following command:

$ texcreate init 

To create a new config file, you will need to use the new command. The difference between v2 and v3 is the default use of texcreate.toml instead of config.toml and the ability to use different file names. Let's create a new project:

$ texcreate new 
Use default project settings? (yes/no)
no
Enter Project Name: 
name
Enter Template Repo: 
mkproj
Enter Template Name: 
basic
Enter config file name (default: texcreate.toml): 
myfirst.toml
Successfully created `myfirst.toml`

If we look at myfirst.toml we can see the following:

packages = []

[project]
proj_name = "name"
template = "basic"
repo = "mkproj"

[metadata]
author = "author"
date = "date"
title = "title"
fontsize = 11
doc_class = "article"
maketitle = true

Lastly to build the project use the build command:

# when using build, if name isn't `texcreate.toml`, use flag -f 
$ texcreate build -f myfirst.toml
Successfully created `name`

If we use ls in the project, we can see the following structure:

$ ls 
include  name.tex compiler.toml out

To compile we can use the compile command, do note you may change the LaTeX compiler used in the compiler.toml file. The default is pdflatex when a project is created.

# make sure to be in project root
$ texcreate compile 
$ ls out 
name.pdf 

Make sure to not change the proj_name field in compiler.toml or the command will not be able to compile.

Dependencies

~2–12MB
~143K SLoC