texstyles 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +56 -4
- data/example/example_stylize.rb +37 -0
- data/lib/texstyles.rb +1 -1
- data/lib/texstyles/style.rb +1 -1
- data/styles/authorea-double-numbered.tex.erb +1 -0
- data/styles/authorea-double.tex.erb +1 -0
- data/styles/authorea-numbered.tex.erb +1 -0
- data/styles/authorea.tex.erb +1 -0
- data/styles/epjc.tex.erb +10 -7
- data/styles/g3.tex.erb +8 -1
- data/styles/report.tex.erb +2 -0
- data/texstyles.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be62b7996c31c41165d3e4ac1fa877db9e27077
|
4
|
+
data.tar.gz: b10580e3752e659673d865c338320c5c0c3ef7aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 976a16446b9b3225285af8e6bf424de453846e47bae5caa1ef1607388f9acbdd828c6af20d36a312732fef267cc1fb1387f5b6a6f7f81b499ed2b639aa8e1a37
|
7
|
+
data.tar.gz: b4d5341fe591d4e65a172ec95a2d6be6fc71adf67b4d374d66ae746727eaeca11fdcc4daf58101a8214fe6feaf41540eda6ef4a121bd9e08f06989a0195a538b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# TeX Styles
|
2
2
|
|
3
|
-
A collection of ERB-based TeX/LaTeX preamble styles, for the world of scholarly writing and beyond. Founded and maintained by the [Authorea](www.authorea.com) team.
|
3
|
+
A collection of ERB-based TeX/LaTeX preamble styles, for the world of scholarly writing and beyond. Founded and maintained by the [Authorea](http://www.authorea.com) team.
|
4
4
|
|
5
5
|
**CAUTION: This repository is in a pre-alpha dev sprint, consider it completely unstable until a 0.1.0 release**
|
6
6
|
|
@@ -8,6 +8,50 @@ A collection of ERB-based TeX/LaTeX preamble styles, for the world of scholarly
|
|
8
8
|
[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/authorea/texstyles/master/LICENSE)
|
9
9
|
[![Gem Version](https://badge.fury.io/rb/texstyles.svg)](https://badge.fury.io/rb/texstyles)
|
10
10
|
|
11
|
+
## Common Questions
|
12
|
+
|
13
|
+
**Does this repository compete with [CTAN](http://www.ctan.org)?** 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.
|
14
|
+
|
15
|
+
**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.
|
16
|
+
|
17
|
+
**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](https://github.com/Authorea/texstyles/blob/master/example/example_stylize.rb)). 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.
|
18
|
+
|
19
|
+
**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:
|
20
|
+
* citation styles, and going beyond LaTeX citations (via CSL)
|
21
|
+
* internationalization
|
22
|
+
* conflict-free use of a default set of packages
|
23
|
+
|
24
|
+
To address these issues we have also released the [texstylist](https://github.com/Authorea/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.
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
require 'texstyles'
|
30
|
+
|
31
|
+
header = '% Header goes here'
|
32
|
+
abstract = '% Abstract goes here'
|
33
|
+
|
34
|
+
metadata = {
|
35
|
+
'title' => 'An example scholarly article',
|
36
|
+
# ... full range of scholarly metadata omitted for space
|
37
|
+
'header' => header,
|
38
|
+
'abstract' => abstract
|
39
|
+
}
|
40
|
+
|
41
|
+
# Choose any available Texstyles::Style here
|
42
|
+
# Full list can be fetched via: Texstyles::Style.list
|
43
|
+
authorea_style = Texstyles::Style.new(:authorea)
|
44
|
+
|
45
|
+
# To obtain the correct latex preamble for the given style:
|
46
|
+
stylized_preamble = authorea_style.stylize_metadata(metadata)
|
47
|
+
|
48
|
+
# Then piece together a document by hand (or use the texstylist gem for further automation)
|
49
|
+
stylized_document = stylized_preamble + "a basic example\n" + "\\end{document}"
|
50
|
+
|
51
|
+
# Enjoy!
|
52
|
+
```
|
53
|
+
|
54
|
+
You can see a full example [here](https://github.com/Authorea/texstyles/blob/master/example/example_stylize.rb)
|
11
55
|
|
12
56
|
## Installation
|
13
57
|
|
@@ -25,11 +69,19 @@ Or install it yourself as:
|
|
25
69
|
|
26
70
|
$ gem install texstyles
|
27
71
|
|
28
|
-
##
|
72
|
+
## Roadmap
|
29
73
|
|
30
|
-
|
74
|
+
### Supported
|
75
|
+
* 100+ and growing scholarly export styles
|
76
|
+
* Core metadata items of scholarly articles
|
77
|
+
* White/blacklisting LaTeX style and class conflicts
|
78
|
+
* Independent citation style specifications
|
31
79
|
|
32
|
-
|
80
|
+
### Upcoming
|
81
|
+
* Postamble support: Certain styles use a \begin{env}\end{env} wrapper around the entire article body, see e.g. a0poster
|
82
|
+
* Support for the full range of scholarly metadata. Need: \keywords, thesis metadata, journal metadata
|
83
|
+
* Decide on and use a standardized scholarly metadata language as input, instead of our custom YML dialect. Suggestions welcome!
|
84
|
+
* Gradually improve all export styles to fit the improved metadata scheme.
|
33
85
|
|
34
86
|
## License
|
35
87
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'texstyles'
|
2
|
+
|
3
|
+
header = '% Header goes here'
|
4
|
+
abstract = '% Abstract goes here'
|
5
|
+
|
6
|
+
metadata = {
|
7
|
+
'title' => 'An example scholarly article',
|
8
|
+
'short_title' => 'Example article',
|
9
|
+
'authors' => [
|
10
|
+
{ 'name' => 'First Author',
|
11
|
+
'affiliation' => 1},
|
12
|
+
{ 'name' => 'Second Author',
|
13
|
+
'affiliation' => 2},
|
14
|
+
{ 'name' => 'Third Author',
|
15
|
+
'affiliations' => [1, 2]}
|
16
|
+
],
|
17
|
+
'affiliations' => {
|
18
|
+
1 => 'Example Organization',
|
19
|
+
2 => 'Another Organization'
|
20
|
+
},
|
21
|
+
'header' => header,
|
22
|
+
'abstract' => abstract
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
# Choose any available Texstyles::Style here
|
27
|
+
# Full list can be fetched via: Texstyles::Style.list
|
28
|
+
authorea_style = Texstyles::Style.new(:authorea)
|
29
|
+
|
30
|
+
# To obtain the correct latex preamble for the given style:
|
31
|
+
stylized_preamble = authorea_style.stylize_metadata(metadata)
|
32
|
+
|
33
|
+
# Then piece together a document by hand (or use the texstylist gem for further automation)
|
34
|
+
stylized_document = stylized_preamble + "a basic example\n" + "\\end{document}"
|
35
|
+
|
36
|
+
# Enjoy!
|
37
|
+
puts stylized_document
|
data/lib/texstyles.rb
CHANGED
data/lib/texstyles/style.rb
CHANGED
@@ -28,7 +28,7 @@ module Texstyles
|
|
28
28
|
@none_compatible = (@all_rule == false)
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def stylize_metadata(options = {})
|
32
32
|
@default_packages = options["default_packages"].to_s
|
33
33
|
@header = options["header"].to_s
|
34
34
|
@alternative_author_string = options["alternative_author_string"].to_s
|
data/styles/authorea.tex.erb
CHANGED
data/styles/epjc.tex.erb
CHANGED
@@ -51,18 +51,21 @@
|
|
51
51
|
<% if !@alternative_author_string.to_s.empty? %>
|
52
52
|
<%= @alternative_author_string %>
|
53
53
|
<% else %>
|
54
|
-
\author{<%=@first_author%>\thanksref{1}
|
55
|
-
|
56
|
-
\and
|
54
|
+
\author{<%=@first_author%>\thanksref{1}%
|
55
|
+
%<% @coauthor_list.each_with_index do |item, index| %>
|
56
|
+
\and <%=item%>\thanksref{<%=index+2%>}
|
57
|
+
%<% end %>
|
58
|
+
}
|
57
59
|
|
58
60
|
\institute{<%=@first_affiliation%>\label{1}
|
59
|
-
<%
|
60
|
-
\and
|
61
|
-
<% end
|
61
|
+
<% @coauthor_affiliations.each_with_index do |item, index| %>
|
62
|
+
\and <%=item%>\label{<%=index+2%>}
|
63
|
+
<% end %>
|
64
|
+
}
|
62
65
|
<% end %>
|
63
66
|
|
64
67
|
|
65
|
-
\date{Received: date / Accepted: date}
|
68
|
+
% \date{Received: date / Accepted: date}
|
66
69
|
% The correct dates will be entered by the editor
|
67
70
|
|
68
71
|
|
data/styles/g3.tex.erb
CHANGED
@@ -40,8 +40,15 @@
|
|
40
40
|
|
41
41
|
\correspondingauthor{Corresponding Author}
|
42
42
|
|
43
|
-
|
43
|
+
<% if !@abstract_begin_end.empty? %>
|
44
|
+
<%= @abstract_begin_end %>
|
45
|
+
<% else %>
|
46
|
+
% An abstract is a requirement for the g3 template
|
47
|
+
\begin{abstract}\end{abstract}
|
48
|
+
<% end %>
|
49
|
+
|
44
50
|
|
51
|
+
\keywords{} % keywords are also required
|
45
52
|
\setboolean{displaycopyright}{true}
|
46
53
|
|
47
54
|
\begin{document}
|
data/styles/report.tex.erb
CHANGED
data/texstyles.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: texstyles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deyan Ginev
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- LICENSE.txt
|
109
109
|
- README.md
|
110
110
|
- Rakefile
|
111
|
+
- example/example_stylize.rb
|
111
112
|
- lib/texstyles.rb
|
112
113
|
- lib/texstyles/style.rb
|
113
114
|
- meta/a0poster-landscape.yml
|