Latest news 2024-07-03: Ebook sale (1st – 31st July 2024): short story cybercrime fiction Unsocial Media free; short story cybercrime fiction Smile for the Camera free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

ltxtemplate : A Perl script to create LaTeX templates

Nicola L C Talbot



This script is deprecated and no longer supported. Try TeXplate instead.

The Perl script ltxtemplate can be used to create template LaTeX documents using the specified class file. It is free software distributed under the GNU General Public License, see the file LICENSE for details. You need to have Perl installed before you can use ltxtemplate. The software is available for download as a zip archive from ltxtemplate can be invoked from the command line either by:

ltxtemplate [options] <filename>
perl ltxtemplate [options] <filename>
where <filename> is the name of the LaTeX file to be created (with or without the .tex extension) and the options may be one or more of the following:
-h Include the hyperref package.
-d Include the datetime package.
-c Insert the current date in the \date command.
-n Don't use initialisation file.
-m Also create associated Makefile.
-b When used with -m, add bibtex to Makefile.
-x When used with -m, add makeindex to Makefile.
-g When used with -m, add makeglos1 to Makefile.
-i Prompt before overwriting files.
-t <cls> Use the <cls> document class (article if omitted).
-o <opts> Pass <opts> to the documentclass (a4paper if omitted).
-l <language> Include babel package with specified language.

The -h, -d, -c, -i, -m, -b, -x and -g options can be combined, e.g. ltxtemplate -hdc sample.tex, but not the -n option.


If the -h option is used, the ifpdf package will also be used, and the command \pdfinfo will be inserted. The \pdfinfo command will use \@title in the /Title field, so be careful if your title includes non-PDF information. For example, in this document, the title was specified as

\title{ltxtemplate : A Perl script to create 
\LaTeX\ templates}
So I had to modify the /Title field as:
/Title (ltxtemplate : A Perl script to create LaTeX templates)

If the -d option is used in conjunction with the -h option the \pdfinfo command will also include the /ModDate field with the \pdfdate command defined in the datetime package.

Note that if you use both -c and -d, the current date will be formatted using \formatdate, whereas if you just use -c without -d, then the current date will simply be entered as <day>/<month>/<year>.

The Perl script performs a simple parsing of the class file (as given by the -t option) to determine whether a letter-type of class file is being used. If it determines that the document is a letter, the commands \title, \author, \pdfinfo and \maketitle will be omitted.

If the class options (as specified by the -o switch) contains one of the European letter sizes (e.g. a4paper), the typearea package will be included.


Initialisation File

The ltxtemplate Perl script will check for one of the following files:

It will only load the file it finds first. Note that command line switches override any values set in the initialisation file.

You can use this file to override ltxtemplate's default values. You can change any of the following Perl variables:

Contact Details

Dr Nicola Talbot
Dickimaw Books


... makeglos1
The Perl script is distributed with the glossary package