Some scripts for easy .tex creation from a template
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Some scripts for easy .tex creation from a template which must lie inside the scripts' directory. If you'd like to contact me for whatever reason, feel free to email me to I'll be happy to get some feedback!


When creating a new .tex file for whatever reason, it's tedious to open up another .tex file from before, copy all the usepackages, newcommands, title-related-information ect. and copy them over. Sometimes the source .tex is not even up to date and you have another .tex file which would be more recent but, for the love of god, you have to patience to search for that particular file.


  1. download all files
  2. put them all together in one directory
  3. append this directory's path to your PATH system variable (see on how to do that with your OS)
  4. open "_presets.json" and get familiar with what this looks like (pretty easy, it's just a .json)
  5. use the command "texnew -add [arguments]" in order to add presets of your own

Do keep in mind though that the given presets and _template.tex are tailored to my own needs and should be updated for personal preferences... (^.^)v

Any .tex file can be used as template. Everything above "\begin{document}" is considered the head and will be copied/included in the newly created .tex file via "texnew [flags] [arguments]". Just copy your .tex file to the directory and then you have two options:

  1. set the default template to be the newer .tex file in "" (i.e. the second argument in the initialization of CONST_TEMPLATE_PATH)
  2. rename the file to "_template.tex" and delete mine


Now, the scripts handle two basic scenarios:

  1. create a new tex file, either empty or from a preset
  2. update the template which will be used for creating a new tex file (i.e. holds all the \usepackage and \newcommand stuff) with \newcommands from a given source file

Creating a new .tex file from your _template.tex (in the directory of the scripts!) is done via "texnew [flags] [arguments]", updating your template is done via "texupdate path/to/source[.tex]"

Additionally, new presets and templates can be added via the -add flag, refer to the documentation for details.


The detailed description of the flags and the corresponding arguments should be taken from the documentation. However, some concepts are described here: When you download the repository, be sure there will be one "testing" preset and two other presets - "MT" and "NA". The latters are presets I myself need ^.^ after adding a preset either manually or via "texnew -add" you can simply create a new tex file by using e.g "texnew MT 69". The output will be a file named "MT_Exercise69_RomanLamsal.tex" with the \title being "[...]Exercise69". This comes from the fact that, in _presets.json, filename is defined with a "{}". This "{}" will be substituted with the second real argument given to texnew. This has to be manually inserted most of the time. ADVANCED FEATURE: The -add deserves some more explanation. "texnew -add" can actually be used in junction with "-src:SRC". This way, the newly added preset is using SRC.tex as default template.


"texupdate SRC TGT" will just update the TGT file (which must lie in the scripts' folder) with all \newcommand and \usepackage which are in SRC but NOT in TGT. TGT can be omitted, then just the default "_template.tex" gets updated. If TGT is actually a file which currently does not exist, the SRC will instead be trunkated (everything including \begin{document}...\end{document} gets omitted) and saved as template under the name TGT in the scripts' directory. Rad. This is automatically invoked when calling "texnew -add presetID somefile.tex -src:SRC".