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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9025e4823886d88868c345453223241c4efdf271
4
- data.tar.gz: 56cfe60c20c149d388370b36999165357e372a01
3
+ metadata.gz: 9be62b7996c31c41165d3e4ac1fa877db9e27077
4
+ data.tar.gz: b10580e3752e659673d865c338320c5c0c3ef7aa
5
5
  SHA512:
6
- metadata.gz: 0f6fa85b6a4ed09dd8be11dce387085855f8fec712a4e18e9553c2ad155c18dcb17a35bb0c9deabaedb74fb0582104ed11905b913c5babd950d87ffd51819459
7
- data.tar.gz: bac35af4bf71ca82fd4fdba12bfdf25ad686ca73ca43031d688968ecea255d459e4d4f5e6cd5b5afd3269857744c6c39e41f247ae753373a5a4685fcd5575670
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
- ## Usage
72
+ ## Roadmap
29
73
 
30
- ## Contributing
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/Authorea/texstyles.
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
@@ -8,7 +8,7 @@ module Texstyles
8
8
  end
9
9
 
10
10
  def list
11
- Dir.glob(File.join(@@root, 'styles', "*.tex.erb")).map{|path| File.basename(path,'.tex.erb')}
11
+ Dir.glob(File.join(@@root, 'styles', "*.tex.erb")).map{|path| File.basename(path,'.tex.erb')}.sort
12
12
  end
13
13
 
14
14
  def categories
@@ -28,7 +28,7 @@ module Texstyles
28
28
  @none_compatible = (@all_rule == false)
29
29
  end
30
30
 
31
- def render_latex(options = {})
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
@@ -4,6 +4,7 @@
4
4
  \usepackage{setspace}
5
5
  \usepackage{titlesec}
6
6
  \usepackage{lineno}
7
+ \usepackage{graphicx}
7
8
  \usepackage{xcolor}
8
9
  \usepackage[colorlinks = true,
9
10
  linkcolor = blue,
@@ -3,6 +3,7 @@
3
3
  \usepackage{parskip}
4
4
  \usepackage{setspace}
5
5
  \usepackage{titlesec}
6
+ \usepackage{graphicx}
6
7
  \usepackage{xcolor}
7
8
  \usepackage[colorlinks = true,
8
9
  linkcolor = blue,
@@ -2,6 +2,7 @@
2
2
  \usepackage{fullpage}
3
3
  \usepackage{parskip}
4
4
  \usepackage{titlesec}
5
+ \usepackage{graphicx}
5
6
  \usepackage{xcolor}
6
7
  \usepackage{lineno}
7
8
  \usepackage[colorlinks = true,
@@ -2,6 +2,7 @@
2
2
  \usepackage{fullpage}
3
3
  \usepackage{parskip}
4
4
  \usepackage{titlesec}
5
+ \usepackage{graphicx}
5
6
  \usepackage{xcolor}
6
7
  \usepackage[colorlinks = true,
7
8
  linkcolor = blue,
@@ -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
- <% if !@coauthor_list.to_a.empty? %><% for i in (0..@coauthor_list.length-1) %>
56
- \and <%=@coauthor_list[i]%>\thanksref{<%=i+2%>}<% end %><% end %>}
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
- <% if !@coauthor_list.to_a.empty? %><% for i in (0..@coauthor_list.length-1) %>
60
- \and <%=@coauthor_affiliations[i]%>\label{<%=i+2%>}
61
- <% end %><% 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
 
@@ -40,8 +40,15 @@
40
40
 
41
41
  \correspondingauthor{Corresponding Author}
42
42
 
43
- <%= @abstract_begin_end %>
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}
@@ -15,3 +15,5 @@
15
15
 
16
16
  \begin{document}
17
17
  \maketitle
18
+
19
+ <%= @abstract_begin_end %>
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  Gem::Specification.new do |spec|
3
3
  spec.name = "texstyles"
4
- spec.version = "0.0.7"
4
+ spec.version = "0.0.8"
5
5
 
6
6
  spec.authors = ["Deyan Ginev"]
7
7
  spec.email = ["deyan@authorea.com"]
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.7
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