texstyles

Hundreds of styles fueling Authorea.com's exporter to PDF. Use with the "exportstylist" gem for a Ruby API.


License
MIT
Install
gem install texstyles -v 0.0.7

Documentation

TeX Styles

A collection of ERB-based TeX/LaTeX preamble styles, for the world of scholarly writing and beyond. Founded and maintained by the Authorea team.

CAUTION: This repository is in a pre-alpha dev sprint, consider it completely unstable until a 0.1.0 release

Build Status license Gem Version

Common Questions

Does this repository compete with CTAN? No, to the contrary. It builds on top of the CTAN wealth of LaTeX packages, and some custom publisher-provided ones, to assemble styling templates that fully conform to specific sets of submission guidelines. The original use case has been submissions of scholarly articles, but we welcome extensions to theses, homeworks, quizzes, exercise sets, etc.

Why the choice of Ruby and ERB? We wanted to optimize for simplicity and reusability, so we avoided more tool-focused templating solutions, such as Pandoc templates, or more elaborate XML-based solutions common to publishers.

What is the Goal? Anyone should be able to grab this repository, write down a tiny metadata file, split out the header and main body of their LaTeX document and then have it typeset in but a few lines of Ruby (example). We developed this component for our Authorea exporter and are happy to contribute it back to the community and develop it jointly from here on out.

Wait, it's not so simple, how about... This repository collects and refines an ever-growing dataset of stylistic templates for LaTeX documents. As such, it currently focuses entirely on document frontmatter/preamble information, and misses out on a long list of additional concerns, for example:

  • citation styles, and going beyond LaTeX citations (via CSL)
  • internationalization
  • conflict-free use of a default set of packages

To address these issues we have also released the texstylist Ruby gem, which is almost always the preferable entry point, as the texstyles library is included in it and a higher-level API is provided.

Usage

require 'texstyles'

header = '% Header goes here'
abstract = '% Abstract goes here'

metadata = {
  'title' => 'An example scholarly article',
  # ... full range of scholarly metadata omitted for space
  'header' => header,
  'abstract' => abstract
}

# Choose any available Texstyles::Style here
# Full list can be fetched via: Texstyles::Style.list
authorea_style = Texstyles::Style.new(:authorea)

# To obtain the correct latex preamble for the given style:
stylized_preamble = authorea_style.stylize_metadata(metadata)

# Then piece together a document by hand (or use the texstylist gem for further automation)
stylized_document = stylized_preamble + "a basic example\n"  + "\\end{document}"

# Enjoy!

You can see a full example here

Installation

Add this line to your application's Gemfile:

gem 'texstyles'

And then execute:

$ bundle

Or install it yourself as:

$ gem install texstyles

Roadmap

Supported

  • 100+ and growing scholarly export styles
  • Core metadata items of scholarly articles
  • White/blacklisting LaTeX style and class conflicts
  • Independent citation style specifications

Upcoming

  • Postamble support: Certain styles use a \begin{env}\end{env} wrapper around the entire article body, see e.g. a0poster
  • Support for the full range of scholarly metadata. Need: \keywords, thesis metadata, journal metadata
  • Decide on and use a standardized scholarly metadata language as input, instead of our custom YML dialect. Suggestions welcome!
  • Gradually improve all export styles to fit the improved metadata scheme.

License

The gem is available as open source under the terms of the MIT License.