latex-project-template

Management of latex template files. latex-project-template creates a latex project directory from a template in ~/.latex_project_template. The directory is git repository and includes Rakefile to compile a latex file with latexmk.

Requirements

latex-project-template uses latexmk to compile latex files and the project directory is managed by git.

latex-project-template depends on the following gems.

Installation

We can install by rubygems.

gem install latex-project-template

Usage

If we install latex-project-template, we can use the command 'latex-project-template'. First of all, we create configuration directory ~/.latex_project_template.

latex-project-template --init

Next, we edit template files in ~/.latex_project_template. If we want to create latex project 'new_project' from 'default' template, type

latex-project-template new_project

If we want to create from other template (for example, 'japanese'), we type next command.

latex-project-template new_project japanese

To list templates in ~/.latex_project_template, we type

latex-project-template --list

Structure of template

In ~/.latex_project_template there are the following directories.

'template' directory

'template' directory includes main files of templates. A template is a directory in 'template' directory and all files are fundamentally copied to a project directory. We can write template files with format simple texts or eruby files.

If we want to create dynamically files then we use eruby. Files with the extension '.erb' is an eruby template and latex-project-template evaluates them when copying a template as a specified project.

Special notations of template file names

Some special notations of template file names also are used. The following strings starting __ and ending __ have special meanings.

__IMPORT__ : In __IMPORT__ we write list of files to import from other template.

__PROJECT__ : Replace __PROJECT__ by name of project.

__DOT__ : Replace __DOT__ by '.'.

__IGNORE__ : Files including __IGNORE__ are ignored.

'component' directory

Common parts of template files are placed in 'component' directory. In order to import into eruby templates, we use 'component' method. If there is 'component/rakefile_common.erb', we can use this file in eruby template.

<%= component('rakefile_common.erb') %>

'variable' directory

The 'variable' directory has yaml files, which are used in eruby template. We can get the object of 'filename.yaml', referring to 'filename';

For example, if there is variable/profile.yaml' like

---
:name: Your Name

then we can refer to the above value as in 'template/default/__PROJECT__.tex.erb'

<%= profile[:name] %>

Rake tasks

Tasks to compile latex files with latexmk are defined in 'latex_project_template/task.rb'. To investigate usage of the file, we can see Rakefile in 'default' template.

Contributing to latex-project-template

Copyright © 2011 Takayuki YAMAGUCHI. See LICENSE.txt for further details.