-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
141 lines (104 loc) · 3.25 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
Dynamic LaTex Generator
==========================
Link: https://github.com/zarch/dynlatex
Description:
------------
Dynlatex is a dynamic latex generator using jinja template and add some more
filters usefull for latex document.
Features:
---------
It generate table from csv files
It generate figure from image file
It generate subfigure from a directory
Dependencies:
-------------
- Python2.X;
- jinja2;
Installation:
-------------
Just extract code into a directory and use it
Usage:
------
Usage is simple, in your LaTex source now you can use jinja template synatax.
Dynlatex add some usefull filters like `table` that allow to insert a table
from a <csvfile>.
{{ 'example/some.csv'|table }}
Now if you run in a shell:
$ python dyn.py /examples/simple.tex
This comand generate a latex file in 'build/examples/simple.tex' that contain:
\begin{table}[htb!]
\scriptsize
\centering
\begin{tabular}{ ccc }
Name & Weight & Heigth \\
Pippo & 58.789 & 1.828 \\
Pluto & 16.983 & 0.608 \\
\end{tabular}
\end{table}
In the latex document you can give more option to the filter,
like in 'examples/parameter.tex'
{{ 'some.csv'|table(add_hline='0,-1',numberformat = '{0:6.1f}', label='tab0', caption='Data from csv.') }}
to add: label, caption and hlines in your tab.
\begin{table}[htb!]
\scriptsize
\centering
\begin{tabular}{ ccc }
\hline
Name & Weight & Heigth \\
Pippo & 58.8 & 1.8 \\
Pluto & 17.0 & 0.6 \\
\hline
\end{tabular}
\caption{ Data from csv. }
\label{ tab0 }
\end{table}
See the configuration file to a complete list of parameters.
Could be usefull to set different "style" to the table.
See all the comand options with:
$ python dyn.py -h
Configuration File:
--------------------
It is possible to read a <cfgfile> to specify general options to apply
to the document, and to add more dictionary callable in the template.
Where <cfgfile> is a file structured like the dyn.cfg reported in the
archive. This is an example of configuration file:
[general]
# set where to find your project files, if multiple files separates with ','
source = examples/
# set where you want to put generate files
dest = build/
# set which file should be consider a latex template, if multiple separates with ','
srcext = .tex
# set which file should be consider an image, if multiple separates with ','
imgext = .png, .pdf, .jpg
# set if you want to compile or not
compile = True
# set which comand use to compile
pdfcomand = pdflatex build/main.tex
# set if you want to make a copy or a link in a build directory
# Note: work only on unix
link = True
verbose = False
[table]
# here it is possible to set all the default value to build table latex code
# set csv delimeter
delimiter = ,
# set if you want to transform number format, using python number format rules
# see: http://docs.python.org/library/string.html#format-specification-mini-language
numberformat = {0:.2f}
# set default position of the table
position = htb!
# set default vertical lines
#add_vline = 1
# set default horizontal lines
add_hline = 0,-1
# specify your column layout, exemple: 0:l,1:c,2:r
col_layout = 0:l
# specify default column layout
col_layout_default = c
# set more table options
more = '\\scriptsize \n \\centering'
[figure]
position = htb!
more = \\centering
width = 1