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.
- http://rubygems.org/gems/latex-project-template
- https://github.com/ytaka/latex-project-template
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.
We can install by rubygems.
gem install latex-project-template
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
In ~/.latex_project_template there are the following directories.
- template
- component
- variable
- .git
'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.
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.
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') %>
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] %>
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.
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
- Fork the project
- Start a feature/bugfix branch
- Commit and push until you are happy with your contribution
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
Copyright (c) 2011 Takayuki YAMAGUCHI. See LICENSE.txt for further details.