latex_document 0.1.1 → 0.1.2

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: 577207d3a8f66433011b2aede9588f40de8869cd
4
- data.tar.gz: ef7a9cb8fa7e38e06489e1242e826d7bcee92e0e
3
+ metadata.gz: b2cbd5af2651301865ba4263c2e5be549530eada
4
+ data.tar.gz: 7b75c03d661c5f63c2f4b73d541cf6524c8964d5
5
5
  SHA512:
6
- metadata.gz: 9a3728ac990fab7484a0872590223708bbe583e6f3573b3b18121161b6d332cd00c814e8b4544cb0ec9fa323436d0467e7889f653172da5a52523c7973d40073
7
- data.tar.gz: 4f24f58ff9c191cf0543645736533db84f40fd9073356bc2976cb7201e3a51cfe11ffb284b9a4df566b196cd9dcb112db7f3a81295231a6b2dee670e91fa7d56
6
+ metadata.gz: 1cfbb718f79373b17760aca31b615c6f638afb059f2c764d56d5215b7600f608376c91035a934ec7375d8be28382a8c9c7f302f2500a695e0b4a832cd8b64862
7
+ data.tar.gz: 0733d903cd920c031655c7e95c2034004421b136c3debe8c740a5aa9ba7d97c75728816e14e66337675a378d94263ae58547eb96c02655715c92ffa18dcf34dd
@@ -2,6 +2,7 @@
2
2
  require "rubygems"
3
3
  require 'thor'
4
4
  require 'date'
5
+ require 'latex_document/version'
5
6
 
6
7
  module LatexDocument
7
8
  class NewDocument < Thor::Group
@@ -83,9 +84,11 @@ module LatexDocument
83
84
  class Md < NewDocument
84
85
  def fill_root
85
86
  super
86
- template("templates/md/document.tex.md.tt", file_path("#{name}.tex.md"))
87
+ template("templates/md/document.md.tt", file_path("#{name}.md"))
87
88
  create_file_from_shared_template 'references.bib'
88
- create_file_from_template 'template.pandoc'
89
+ ['pdf', 'tex', 'html'].each do |format|
90
+ create_file_from_template "#{format}.template.pandoc"
91
+ end
89
92
  end
90
93
 
91
94
  protected
@@ -99,6 +102,16 @@ module LatexDocument
99
102
  end
100
103
 
101
104
  class LatexDocument < Thor
105
+
106
+ # Thanks to Adam Prescott
107
+ # (http://stackoverflow.com/questions/22809972/adding-a-version-option-to-a-ruby-thor-cli)
108
+ # for this.
109
+ map %w[--version -v] => :__print_version
110
+ desc "--version, -v", "Show version information"
111
+ def __print_version
112
+ puts VERSION
113
+ end
114
+
102
115
  map 't' => :tex
103
116
 
104
117
  register(
@@ -1,3 +1,3 @@
1
1
  module LatexDocument
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -1,43 +1,39 @@
1
+ default: pdf
2
+ .PHONY: default
3
+
1
4
  #THIS_DIR := $(CURDIR)/$(dir $(lastword $(MAKEFILE_LIST)))
2
5
  THIS_DIR := ./
3
6
 
4
- default: pdf
7
+ TARGET_BASE :=<%= name %>
8
+ SRC_DIR :=$(THIS_DIR)
9
+ TARGET_SRC :=$(SRC_DIR)/$(TARGET_BASE).md
5
10
 
6
- TARGET_BASE = <%= name %>
7
- TARGET := $(TARGET_BASE).pdf
8
- SRC_DIR = $(THIS_DIR)
9
- TARGET_SRC := $(SRC_DIR)/$(TARGET_BASE).tex.md
11
+ BIB :=$(SRC_DIR)/references.bib
10
12
 
11
- BIB := $(SRC_DIR)/references.bib
12
-
13
- TEMPLATE_DIR = $(THIS_DIR)
14
- TEMPLATE = template.pandoc
15
- TEMPLATE_SRC := $(TEMPLATE_DIR)/$(TEMPLATE)
13
+ TEMPLATE_DIR :=$(THIS_DIR)
14
+ TEMPLATE :=template.pandoc
16
15
 
17
16
  # Default geometry
18
- geometry = margin=1cm,landscape
19
-
20
- $(TARGET): $(TEMPLATE_SRC) $(TARGET_SRC) | $(TEMPLATE_DIR)
21
- pandoc $(TARGET_SRC) -o $(THIS_DIR)/$(TARGET) --template=$(TEMPLATE_SRC) --biblio $(BIB) --variable geometry:$(geometry)
17
+ geometry =margin=1cm
22
18
 
23
- pdf: $(TARGET)
19
+ $(TARGET_BASE).%:: $(TARGET_SRC) $(TEMPLATE_DIR)/%.$(TEMPLATE) | $(TEMPLATE_DIR)
20
+ pandoc $(TARGET_SRC) -o $(THIS_DIR)/$@ --template=$(TEMPLATE_DIR)/$*.$(TEMPLATE) --biblio $(BIB) --variable geometry:$(geometry)
24
21
 
25
- # Constant definition
26
- NIL = __NIL__
22
+ # Add rules for different file types like this:
23
+ pdf: $(TARGET_BASE).pdf
24
+ .PHONY: pdf
25
+ tex: $(TARGET_BASE).tex
26
+ .PHONY: tex
27
+ html: $(TARGET_BASE).html
28
+ .PHONY: html
27
29
 
28
- # Arguments to the `link` command
29
- template := $(NIL)
30
- biblio := $(NIL)
31
30
 
32
- link:
33
- if [ $(template) != $(NIL) ] && [ -e $(template) ]; then \
34
- rm $(TEMPLATE_SRC) > /dev/null; \
35
- ln -s $(template) $(TEMPLATE_SRC); \
36
- fi; \
37
- if [ $(biblio) != $(NIL) ] && [ -e $(biblio) ]; then \
38
- rm $(BIB) > /dev/null; \
39
- ln -s $(biblio) $(BIB); \
40
- fi;
31
+ # Meta-rules
32
+ #===========
33
+ print-%:
34
+ @echo $* = $($*)
35
+ .PHONY: print-%
41
36
 
42
- clean:
43
- -rm $(TARGET)
37
+ clean%:
38
+ -rm $(TARGET_BASE).$*
39
+ .PHONY: clean%
@@ -5,7 +5,7 @@
5
5
  Section 1
6
6
  =========
7
7
 
8
- Test reference: [@Lanctot09mccfr]
8
+ Test reference: [@rcfr]
9
9
 
10
10
 
11
11
  References
@@ -0,0 +1,61 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta http-equiv="Content-Style-Type" content="text/css" />
6
+ <meta name="generator" content="pandoc" />
7
+ $for(author-meta)$
8
+ <meta name="author" content="$author-meta$" />
9
+ $endfor$
10
+ $if(date-meta)$
11
+ <meta name="date" content="$date-meta$" />
12
+ $endif$
13
+ <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title>
14
+ <style type="text/css">code{white-space: pre;}</style>
15
+ $if(quotes)$
16
+ <style type="text/css">q { quotes: "“" "”" "‘" "’"; }</style>
17
+ $endif$
18
+ $if(highlighting-css)$
19
+ <style type="text/css">
20
+ $highlighting-css$
21
+ </style>
22
+ $endif$
23
+ $for(css)$
24
+ <link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/>
25
+ $endfor$
26
+ $if(math)$
27
+ $math$
28
+ $endif$
29
+ $for(header-includes)$
30
+ $header-includes$
31
+ $endfor$
32
+ </head>
33
+ <body>
34
+ $for(include-before)$
35
+ $include-before$
36
+ $endfor$
37
+ $if(title)$
38
+ <div id="$idprefix$header">
39
+ <h1 class="title">$title$</h1>
40
+ $if(subtitle)$
41
+ <h1 class="subtitle">$subtitle$</h1>
42
+ $endif$
43
+ $for(author)$
44
+ <h2 class="author">$author$</h2>
45
+ $endfor$
46
+ $if(date)$
47
+ <h3 class="date">$date$</h3>
48
+ $endif$
49
+ </div>
50
+ $endif$
51
+ $if(toc)$
52
+ <div id="$idprefix$TOC">
53
+ $toc$
54
+ </div>
55
+ $endif$
56
+ $body$
57
+ $for(include-after)$
58
+ $include-after$
59
+ $endfor$
60
+ </body>
61
+ </html>
@@ -0,0 +1,213 @@
1
+ \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
2
+ $if(fontfamily)$
3
+ \usepackage{$fontfamily$}
4
+ $else$
5
+ \usepackage{lmodern}
6
+ $endif$
7
+ $if(linestretch)$
8
+ \usepackage{setspace}
9
+ \setstretch{$linestretch$}
10
+ $endif$
11
+ \usepackage{amssymb,amsmath}
12
+ \usepackage{mathtools} % Better boxes around math
13
+ \usepackage{ifxetex,ifluatex}
14
+ \usepackage{fixltx2e} % provides \textsubscript
15
+ \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
16
+ \usepackage[T1]{fontenc}
17
+ \usepackage[utf8]{inputenc}
18
+ $if(euro)$
19
+ \usepackage{eurosym}
20
+ $endif$
21
+ \else % if luatex or xelatex
22
+ \ifxetex
23
+ \usepackage{mathspec}
24
+ \usepackage{xltxtra,xunicode}
25
+ \else
26
+ \usepackage{fontspec}
27
+ \fi
28
+ \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
29
+ \newcommand{\euro}{€}
30
+ $if(mainfont)$
31
+ \setmainfont{$mainfont$}
32
+ $endif$
33
+ $if(sansfont)$
34
+ \setsansfont{$sansfont$}
35
+ $endif$
36
+ $if(monofont)$
37
+ \setmonofont[Mapping=tex-ansi]{$monofont$}
38
+ $endif$
39
+ $if(mathfont)$
40
+ \setmathfont(Digits,Latin,Greek){$mathfont$}
41
+ $endif$
42
+ \fi
43
+ % use upquote if available, for straight quotes in verbatim environments
44
+ \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
45
+ % use microtype if available
46
+ \IfFileExists{microtype.sty}{\usepackage{microtype}}{}
47
+ $if(geometry)$
48
+ \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
49
+ $endif$
50
+ $if(natbib)$
51
+ \usepackage{natbib}
52
+ \bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
53
+ $endif$
54
+ $if(biblatex)$
55
+ \usepackage{biblatex}
56
+ $if(biblio-files)$
57
+ \bibliography{$biblio-files$}
58
+ $endif$
59
+ $endif$
60
+ $if(listings)$
61
+ \usepackage{listings}
62
+ $endif$
63
+ $if(lhs)$
64
+ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
65
+ $endif$
66
+ $if(highlighting-macros)$
67
+ $highlighting-macros$
68
+ $endif$
69
+ $if(verbatim-in-note)$
70
+ \usepackage{fancyvrb}
71
+ $endif$
72
+ $if(tables)$
73
+ \usepackage{longtable,booktabs}
74
+ $endif$
75
+ $if(graphics)$
76
+ \usepackage{graphicx}
77
+ \makeatletter
78
+ \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
79
+ \def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
80
+ \makeatother
81
+ % Scale images if necessary, so that they will not overflow the page
82
+ % margins by default, and it is still possible to overwrite the defaults
83
+ % using explicit options in \includegraphics[width, height, ...]{}
84
+ \setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
85
+ $endif$
86
+ \ifxetex
87
+ \usepackage[setpagesize=false, % page size defined by xetex
88
+ unicode=false, % unicode breaks when used with xetex
89
+ xetex]{hyperref}
90
+ \else
91
+ \usepackage[unicode=true]{hyperref}
92
+ \fi
93
+ \hypersetup{breaklinks=true,
94
+ bookmarks=true,
95
+ pdfauthor={$author-meta$},
96
+ pdftitle={$title-meta$},
97
+ colorlinks=true,
98
+ citecolor=$if(citecolor)$$citecolor$$else$blue$endif$,
99
+ urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
100
+ linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
101
+ pdfborder={0 0 0}}
102
+ \urlstyle{same} % don't use monospace font for urls
103
+ $if(links-as-notes)$
104
+ % Make links footnotes instead of hotlinks:
105
+ \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
106
+ $endif$
107
+ $if(strikeout)$
108
+ \usepackage[normalem]{ulem}
109
+ % avoid problems with \sout in headers with hyperref:
110
+ \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
111
+ $endif$
112
+ \setlength{\parindent}{0pt}
113
+ \setlength{\parskip}{6pt plus 2pt minus 1pt}
114
+ \setlength{\emergencystretch}{3em} % prevent overfull lines
115
+ $if(numbersections)$
116
+ \setcounter{secnumdepth}{5}
117
+ $else$
118
+ \setcounter{secnumdepth}{0}
119
+ $endif$
120
+ $if(verbatim-in-note)$
121
+ \VerbatimFootnotes % allows verbatim text in footnotes
122
+ $endif$
123
+ $if(lang)$
124
+ \ifxetex
125
+ \usepackage{polyglossia}
126
+ \setmainlanguage{$mainlang$}
127
+ \else
128
+ \usepackage[$lang$]{babel}
129
+ \fi
130
+ $endif$
131
+
132
+ %%% macros
133
+ \newcommand{\final}{\fbox}
134
+ \newcommand{\bs}{\boldsymbol}
135
+ \newcommand{\tr}{\operatorname{tr}}
136
+ \newcommand{\norm}[1]{\left\lVert#1\right\rVert}
137
+ \newcommand{\set}[1]{\left\{ {#1} \right\}}
138
+
139
+ \newcommand{\diag}[1]{\mathop{\bigtriangleup\subex{#1}}\nolimits}
140
+ \newcommand{\stack}[1]{\operatorname{stack}\subex{#1}}
141
+ \newcommand{\deriv}[2]{\frac{d #1}{ d #2 }}
142
+
143
+ \newcommand{\subex}[1]{\left(#1\right)}
144
+ %%%%
145
+
146
+ \usepackage[table]{xcolor}
147
+ %\usepackage{colortbl}
148
+
149
+ \usepackage{floatrow}
150
+ \DeclareFloatFont{tiny}{\tiny}% "scriptsize" is defined by floatrow, "tiny" not
151
+ \floatsetup[table]{font=tiny}
152
+
153
+ $if(title)$
154
+ \title{$title$}
155
+ $endif$
156
+ $if(subtitle)$
157
+ \subtitle{$subtitle$}
158
+ $endif$
159
+ $if(author)$
160
+ \author{$for(author)$$author$$sep$ \and $endfor$}
161
+ $endif$
162
+ $if(date)$
163
+ \date{$date$}
164
+ $endif$
165
+ $for(header-includes)$
166
+ $header-includes$
167
+ $endfor$
168
+
169
+ \begin{document}
170
+ $if(title)$
171
+ \maketitle
172
+ $endif$
173
+ $if(abstract)$
174
+ \begin{abstract}
175
+ $abstract$
176
+ \end{abstract}
177
+ $endif$
178
+
179
+ $for(include-before)$
180
+ $include-before$
181
+
182
+ $endfor$
183
+ $if(toc)$
184
+ {
185
+ \hypersetup{linkcolor=black}
186
+ \setcounter{tocdepth}{$toc-depth$}
187
+ \tableofcontents
188
+ }
189
+ $endif$
190
+ $body$
191
+
192
+ $if(natbib)$
193
+ $if(biblio-files)$
194
+ $if(biblio-title)$
195
+ $if(book-class)$
196
+ \renewcommand\bibname{$biblio-title$}
197
+ $else$
198
+ \renewcommand\refname{$biblio-title$}
199
+ $endif$
200
+ $endif$
201
+ \bibliography{$biblio-files$}
202
+
203
+ $endif$
204
+ $endif$
205
+ $if(biblatex)$
206
+ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
207
+
208
+ $endif$
209
+ $for(include-after)$
210
+ $include-after$
211
+
212
+ $endfor$
213
+ \end{document}
@@ -1,10 +1,9 @@
1
- @inproceedings{Lanctot09mccfr,
2
- title = {Monte Carlo Sampling for Regret Minimization in Extensive Games},
3
- author = {Marc Lanctot and Kevin Waugh and Martin Zinkevich and Michael Bowling},
4
- booktitle = {Advances in Neural Information Processing Systems 22},
5
- editor = {Y. Bengio and D. Schuurmans and J. Lafferty and C. K. I. Williams and A. Culotta},
6
- pages = {1078--1086},
7
- year = {2009},
8
- AcceptRate = {24\%},
9
- AcceptNumbers = {263 of 1105}
1
+ @inproceedings{rcfr,
2
+ title = {Solving Games with Functional Regret Estimation},
3
+ author = {Kevin Waugh and Dustin Morrill and J. Andrew Bagnell and Michael Bowling},
4
+ booktitle = {{Twenty-Ninth AAAI Conference on Artificial Intelligence, January 25-29, 2015, Austin Texas, USA}},
5
+ year = {2015},
6
+ month = {January},
7
+ location = {Austin Texas, USA},
8
+ pages="2138--2145"
10
9
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: latex_document
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-06 00:00:00.000000000 Z
11
+ date: 2015-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -69,8 +69,10 @@ files:
69
69
  - lib/latex_document.rb
70
70
  - lib/latex_document/version.rb
71
71
  - templates/md/Makefile.tt
72
- - templates/md/document.tex.md.tt
73
- - templates/md/template.pandoc.tt
72
+ - templates/md/document.md.tt
73
+ - templates/md/html.template.pandoc.tt
74
+ - templates/md/pdf.template.pandoc.tt
75
+ - templates/md/tex.template.pandoc.tt
74
76
  - templates/references.bib.tt
75
77
  - templates/tex/Makefile.tt
76
78
  - templates/tex/include/mydefault.sty.tt