wortsammler 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,7 @@ require 'wortsammler/version.rb'
9
9
 
10
10
  options = {}
11
11
  config = nil
12
+ $log.progname="#{Wortsammler::PROGNAME} #{Wortsammler::VERSION}"
12
13
 
13
14
  optparse = OptionParser.new do|opts|
14
15
  # Set a banner, displayed at the top
@@ -1,5 +1,5 @@
1
1
  # setup the logger
2
- require 'Logger'
2
+ require 'logger'
3
3
  $log = Logger.new(STDOUT)
4
4
  $log.level = Logger::INFO
5
5
  $log.datetime_format= "%Y-%m-%d %H:%M:%S"
@@ -0,0 +1,174 @@
1
+ require 'tmpdir'
2
+ require 'fileutils'
3
+
4
+ #
5
+ #
6
+
7
+ #
8
+ # This module provides utilites to handle pdf file.s
9
+ #
10
+ # Note that it only works on Mac OS X.
11
+ #
12
+ # @author [Bernhard Weichel]
13
+ #
14
+ module Wortsammler
15
+
16
+ #
17
+ # convert an excel workbook to cropped pdf file.
18
+ # it generates one file per sheet
19
+ #
20
+ # @param infile [String] name of the Excel file
21
+ # @param outfile [String] basis of the generated pdf file. The name of the
22
+ # sheet is mangled into the file accroding to the pattern
23
+ # <body_of_outfile> <name of the sheet>.<extension of outfile>
24
+ # note the space inserted by excel.
25
+ #
26
+ # @return [Array of String] the list of generated files.
27
+ #
28
+ def self.xlsx_to_cropped_pdf(infile, outfile)
29
+ outfiles=self.xlsx_to_pdf(infile, outfile)
30
+ outfiles.each{|f|
31
+ self.crop_pdf(f)
32
+ }
33
+
34
+ outfiles
35
+ end
36
+
37
+
38
+ #
39
+ # convert an excel workbook to *non cropped* pdf file.
40
+ # it generates one file per sheet
41
+ #
42
+ # @param infile [String] name of the Excel file
43
+ # @param outfile [String] basis of the generated pdf file. The name of the
44
+ # sheet is mangled into the file accroding to the pattern
45
+ # <body_of_outfile> <name of the sheet>.<extension of outfile>
46
+ # note the space inserted by excel.
47
+ #
48
+ # @return [Array of String] the list of generated files.
49
+ #
50
+ def self.xlsx_to_pdf(infile, outfile)
51
+
52
+ tmpdir=Dir.mktmpdir
53
+ outext=File.extname(outfile)
54
+ tmpbase=File.basename(outfile, outext)
55
+ tmpfile="#{tmpdir}/#{File.basename(infile)}"
56
+ outdir =File.dirname(File.absolute_path(outfile))
57
+
58
+ FileUtils.cp(infile, tmpfile)
59
+
60
+ cmd=[]
61
+ cmd << "osascript <<-EOF"
62
+ cmd << "set theTmpBase to (POSIX file \"#{tmpdir}/#{tmpbase}.pdf\") as string"
63
+ cmd << "tell application \"Microsoft Excel\""
64
+ #cmd << "activate"
65
+ cmd << ""
66
+ cmd << "open \"#{tmpfile}\""
67
+ cmd << ""
68
+ cmd << "save active workbook in theTmpBase as PDF file format"
69
+ cmd << "delay 1"
70
+ cmd << "close active workbook saving no"
71
+ cmd << "quit"
72
+ cmd << "end tell"
73
+ cmd << "EOF"
74
+ cmd = cmd.join("\n")
75
+ system(cmd)
76
+
77
+ Dir["#{tmpdir}/#{tmpbase}*.pdf"].each do |f|
78
+ outfilename=File.basename(f).gsub(" ", "_")
79
+ FileUtils.cp(f, "#{outdir}/#{outfilename}")
80
+ end
81
+
82
+ Dir["#{outdir}/#{tmpbase}*#{outext}"]
83
+ end
84
+
85
+
86
+ #
87
+ # convert an Powerpoint presentation to cropped pdf file.
88
+ # it generates one file per sheet
89
+ #
90
+ # @param infile [String] name of the Powerpoint file
91
+ # @param outfile [String] basis of the generated pdf file.
92
+ #
93
+ # @return [Array of String] the list of generated files. In fact it
94
+ # it is only one file. But for sake of harmonization with
95
+ # xlsx_to_pdf it is returned as an array.
96
+ #
97
+ def self.pptx_to_cropped_pdf(infile, outfile)
98
+ outfiles=self.pptx_to_pdf(infile, outfile)
99
+ outfiles.each{|f|
100
+ self.crop_pdf(f)
101
+ }
102
+ outfile
103
+ end
104
+
105
+ #
106
+ # convert an Powerpoint presentation to non cropped pdf file.
107
+ # it generates one file per sheet
108
+ #
109
+ # @param infile [String] name of the Powerpoint file
110
+ # @param outfile [String] basis of the generated pdf file.
111
+ #
112
+ # @return [Array of String] the list of generated files. In fact it
113
+ # it is only one file. But for sake of harmonization with
114
+ # xlsx_to_pdf it is returned as an array.
115
+ #
116
+ def self.pptx_to_pdf(infile, outfile)
117
+
118
+ tmpdir=Dir.mktmpdir
119
+ tmpout="#{tmpdir}/#{File.basename(outfile)}"
120
+ tmpin="#{tmpdir}/#{File.basename(infile)}"
121
+ outdir =File.dirname(File.absolute_path(outfile))
122
+
123
+ FileUtils.cp(infile, tmpin)
124
+
125
+ cmd=[]
126
+ cmd << "osascript <<-EOF"
127
+ cmd << "tell application \"Microsoft PowerPoint\""
128
+ #cmd << "activate"
129
+ cmd << ""
130
+ cmd << "open \"#{tmpin}\""
131
+ cmd << "open \"#{tmpin}\"" # todo: I open it twice making sure that it is really open
132
+ cmd << "set theActivePPT to the active presentation"
133
+ cmd << "save theActivePPT in \"#{tmpout}\" as save as PDF"
134
+ cmd << "close theActivePPT"
135
+ cmd << "quit"
136
+ cmd << "end tell"
137
+ cmd = cmd.join("\n")
138
+ system(cmd)
139
+ FileUtils.cp("#{tmpout}", outfile)
140
+ [outfile]
141
+ end
142
+
143
+
144
+ #
145
+ # crop a pdf file
146
+ # @param infile [String] The name of the pdf file
147
+ # @param outfile [String] The name of the output file.
148
+ # if no file is given, then the inputfile is
149
+ # replaced by the cropped file.
150
+ #
151
+ # @return [nil] no return
152
+ #
153
+ def self.crop_pdf(infile, outfile=nil)
154
+
155
+ result=`gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox \"#{infile}\" 2>&1`
156
+ coords=/%BoundingBox:\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/.match(result).captures.join(" ")
157
+
158
+ tmpfile=infile+"_tmp"
159
+
160
+ cmd =[]
161
+ cmd << "gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite"
162
+ cmd << "-o\"#{tmpfile}\""
163
+ cmd << "-c \"[/CropBox [#{coords}] /PAGES pdfmark\""
164
+ cmd << "-f \"#{infile}\""
165
+ cmd = cmd.join(" ")
166
+ result = system(cmd)
167
+
168
+ outfile=infile if outfile.nil?
169
+ FileUtils.cp(tmpfile, outfile)
170
+ FileUtils.rm(tmpfile)
171
+ nil
172
+ end
173
+
174
+ end
@@ -1,3 +1,5 @@
1
+ require 'rake'
2
+
1
3
 
2
4
  ##
3
5
  #
@@ -9,7 +11,10 @@
9
11
  ##
10
12
  # generate a task for each manifest file
11
13
  #
12
- Dir["../ZSUPP_Manifests/*.yaml"].each{|file|
14
+ #
15
+ manifestfiles=Dir["../ZSUPP_Manifests/*.yaml"]
16
+
17
+ manifestfiles.each{|file|
13
18
  taskdesc=File.basename(file, ".yaml")
14
19
  taskname=taskdesc.split("_")[0]
15
20
  desc "generate #{taskdesc}"
@@ -19,10 +24,15 @@ Dir["../ZSUPP_Manifests/*.yaml"].each{|file|
19
24
  end
20
25
  }
21
26
 
22
- ##
27
+ tasknames=manifestfiles.map{|f|File.basename(f, "yaml").split("_")}
28
+ desc "generate all documents"
29
+ task :all => tasknames
30
+
31
+ #
23
32
  # the default task
24
33
 
25
34
  desc "print this help"
35
+
26
36
  task :default do
27
37
  system "rake -T"
28
38
  end
@@ -1,3 +1,4 @@
1
1
  module Wortsammler
2
- VERSION = "0.0.3"
2
+ PROGNAME="wortsammler"
3
+ VERSION = "0.0.5"
3
4
  end
@@ -1,224 +1,317 @@
1
- \documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
2
- {\catcode`\@=11\relax%
3
- \gdef\itemize{%
4
- \ifnum \@itemdepth >\thr@@\@toodeep\else
5
- \advance\@itemdepth\@ne
6
- \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
7
- \expandafter
8
- \list
9
- \csname\@itemitem\endcsname
10
- {\def\makelabel##1{\hss\llap{##1}}%
11
- \addtolength{\leftmargin}{-10pt}% 29.37pt
12
- \addtolength{\rightmargin}{0.0pt}% 0.0pt
13
- \addtolength{\labelsep}{0pt}% 23.50pt
14
- \addtolength{\itemsep}{-3.0pt}% 5.0pt
15
- \addtolength{\parsep}{0pt}% 5.0pt
16
- \addtolength{\topsep}{-5pt}% 10.0pt
17
- \addtolength{\partopsep}{0pt}% 3.0pt
18
- }%
19
- \fi}
20
- }%
21
- %end list environment by Reinhard Jahraus
22
- \usepackage[T1]{fontenc}
23
- \usepackage{lmodern}
24
- \usepackage{amssymb,amsmath}
25
- \usepackage{ifxetex,ifluatex}
26
- \usepackage{fixltx2e} % provides \textsubscript
27
- % use microtype if available
28
- \IfFileExists{microtype.sty}{\usepackage{microtype}}{}
29
- \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
30
- \usepackage[utf8]{inputenc}
31
- $if(euro)$
32
- \usepackage{eurosym}
33
- $endif$
34
- \else % if luatex or xelatex
35
- \usepackage{fontspec}
36
- \ifxetex
37
- \usepackage{xltxtra,xunicode}
38
- \fi
39
- \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
40
- \newcommand{\euro}{€}
41
- $if(mainfont)$
42
- \setmainfont{$mainfont$}
43
- $endif$
44
- $if(sansfont)$
45
- \setsansfont{$sansfont$}
46
- $endif$
47
- $if(monofont)$
48
- \setmonofont{$monofont$}
49
- $endif$
50
- $if(mathfont)$
51
- \setmathfont{$mathfont$}
52
- $endif$
53
- \fi
54
- $if(geometry)$
55
- \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
56
- $endif$
57
- $if(natbib)$
58
- \usepackage{natbib}
59
- \bibliographystyle{plainnat}
60
- $endif$
61
- $if(biblatex)$
62
- \usepackage{biblatex}
63
- $if(biblio-files)$
64
- \bibliography{$biblio-files$}
65
- $endif$
66
- $endif$
67
- $if(listings)$
68
- \usepackage{listings}
69
- $endif$
70
- $if(lhs)$
71
- \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
72
- $endif$
73
- $if(highlighting-macros)$
74
- $highlighting-macros$
75
- $endif$
76
- $if(verbatim-in-note)$
77
- \usepackage{fancyvrb}
78
- $endif$
79
- $if(fancy-enums)$
80
- % Redefine labelwidth for lists; otherwise, the enumerate package will cause
81
- % markers to extend beyond the left margin.
82
- \makeatletter\AtBeginDocument{%
83
- \renewcommand{\@listi}
84
- {\setlength{\labelwidth}{4em}}
85
- }\makeatother
86
- \usepackage{enumerate}
87
- $endif$
88
- $if(tables)$
89
- \usepackage{ctable}
90
- \usepackage{float} % provides the H option for float placement
91
- $endif$
92
-
93
- \usepackage{graphicx}
94
- % We will generate all images so they have a width \maxwidth. This means
95
- % that they will get their normal width if they fit onto the page, but
96
- % are scaled down if they would overflow the margins.
97
- \makeatletter
98
- \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
99
- \else\Gin@nat@width\fi}
100
- \makeatother
101
- \let\Oldincludegraphics\includegraphics
102
- \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
103
-
104
- \ifxetex
105
- \usepackage[setpagesize=false, % page size defined by xetex
106
- unicode=false, % unicode breaks when used with xetex
107
- xetex]{hyperref}
108
- \else
109
- \usepackage[unicode=true]{hyperref}
110
- \fi
111
- \hypersetup{breaklinks=true,
112
- bookmarks=true,
113
- pdfauthor={$author-meta$},
114
- pdftitle={$title-meta$},
115
- colorlinks=true,
116
- urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
117
- linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
118
- pdfborder={0 0 0}}
119
- $if(links-as-notes)$
120
- % Make links footnotes instead of hotlinks:
121
- \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
122
- $endif$
123
- $if(strikeout)$
124
- \usepackage[normalem]{ulem}
125
- % avoid problems with \sout in headers with hyperref:
126
- \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
127
- $endif$
128
- \setlength{\parindent}{0pt}
129
- \setlength{\parskip}{6pt plus 2pt minus 1pt}
130
- \setlength{\emergencystretch}{3em} % prevent overfull lines
131
- $if(numbersections)$
132
- $else$
133
- \setcounter{secnumdepth}{0}
134
- $endif$
135
- $if(verbatim-in-note)$
136
- \VerbatimFootnotes % allows verbatim text in footnotes
137
- $endif$
138
- $if(lang)$
139
- \ifxetex
140
- \usepackage{polyglossia}
141
- \setmainlanguage{$mainlang$}
142
- \else
143
- \usepackage[$lang$]{babel}
144
- \fi
145
- $endif$
146
- $for(header-includes)$
147
- $header-includes$
148
- $endfor$
149
-
150
- $if(title)$
151
- \title{$title$}
152
- $endif$
153
- \author{$for(author)$$author$$sep$ \and $endfor$}
154
- \date{$date$}
155
-
156
- \setlength{\oddsidemargin}{0cm}
157
- \setlength{\evensidemargin}{0cm}
158
- \setlength{\textwidth}{16cm}
159
- \setlength{\topmargin}{-2cm}
160
- \setlength{\headheight}{1cm}
161
- \setlength{\headsep}{1cm}
162
- \setlength{\textheight}{23cm}
163
- \setlength{\footskip}{1cm}
164
-
165
- % adjust the toc layout
166
- \makeatletter
167
- % \renewcommand*\l@section{\@dottedtocline{2}{1.8em}{4em}}
168
- \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{4em}}
169
- \renewcommand*\l@subsubsection{\@dottedtocline{2}{5.5em}{4em}}
170
- \makeatother
171
-
172
- \usepackage{fancyhdr}
173
- \pagestyle{fancy}
174
- \chead{\begin{center}\textbf{$title$}\end{center}}
175
- %\lhead{\includegraphics{logo.jpg}}
176
- \rhead{\leftmark}
177
- \lfoot{"generated by Wortsammler"}
178
- \rfoot{\today}
179
- \renewcommand{\footrulewidth}{0.4pt}
180
- %
181
- \renewcommand{\familydefault}{\sfdefault}
182
- %
183
- %
184
- \begin{document}
185
- $if(title)$
186
- \maketitle
187
- \clearpage
188
- $endif$
189
-
190
- $for(include-before)$
191
- $include-before$
192
-
193
- $endfor$
194
- $if(toc)$
195
- {
196
- \hypersetup{linkcolor=black}
197
- \tableofcontents
198
- \newpage
199
- }
200
- $endif$
201
- $body$
202
-
203
- $if(natbib)$
204
- $if(biblio-files)$
205
- $if(biblio-title)$
206
- $if(book-class)$
207
- \renewcommand\bibname{$biblio-title$}
208
- $else$
209
- \renewcommand\refname{$biblio-title$}
210
- $endif$
211
- $endif$
212
- \bibliography{$biblio-files$}
213
-
214
- $endif$
215
- $endif$
216
- $if(biblatex)$
217
- \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
218
-
219
- $endif$
220
- $for(include-after)$
221
- $include-after$
222
-
223
- $endfor$
224
- \end{document}
1
+ \documentclass[twoside,a4paper,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
2
+ \usepackage[T1]{fontenc}
3
+ \usepackage{lmodern}
4
+ \usepackage{amssymb,amsmath}
5
+ \usepackage{ifxetex,ifluatex}
6
+ \usepackage{fixltx2e} % provides \textsubscript
7
+ % use microtype if available
8
+ \IfFileExists{microtype.sty}{\usepackage{microtype}}{}
9
+ \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
10
+ \usepackage[utf8]{inputenc}
11
+ $if(euro)$
12
+ \usepackage{eurosym}
13
+ $endif$
14
+ \else % if luatex or xelatex
15
+ \usepackage{fontspec}
16
+ \ifxetex
17
+ \usepackage{xltxtra,xunicode}
18
+ \fi
19
+ \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
20
+ \newcommand{\euro}{€}
21
+ $if(mainfont)$
22
+ \setmainfont{$mainfont$}
23
+ $endif$
24
+ $if(sansfont)$
25
+ \setsansfont{$sansfont$}
26
+ $endif$
27
+ $if(monofont)$
28
+ \setmonofont{$monofont$}
29
+ $endif$
30
+ $if(mathfont)$
31
+ \setmathfont{$mathfont$}
32
+ $endif$
33
+ \fi
34
+ $if(geometry)$
35
+ \usepackage[$for(geometry)$$geometry$$sep$,$endfor$]{geometry}
36
+ $endif$
37
+ $if(natbib)$
38
+ \usepackage{natbib}
39
+ \bibliographystyle{plainnat}
40
+ $endif$
41
+ $if(biblatex)$
42
+ \usepackage{biblatex}
43
+ $if(biblio-files)$
44
+ \bibliography{$biblio-files$}
45
+ $endif$
46
+ $endif$
47
+ $if(listings)$
48
+ \usepackage{listings}
49
+ $endif$
50
+ $if(lhs)$
51
+ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
52
+ $endif$
53
+ $if(highlighting-macros)$
54
+ $highlighting-macros$
55
+ $endif$
56
+ $if(verbatim-in-note)$
57
+ \usepackage{fancyvrb}
58
+ $endif$
59
+ $if(fancy-enums)$
60
+ % Redefine labelwidth for lists; otherwise, the enumerate package will cause
61
+ % markers to extend beyond the left margin.
62
+ \makeatletter\AtBeginDocument{%
63
+ \renewcommand{\@listi}
64
+ {\setlength{\labelwidth}{4em}}
65
+ }\makeatother
66
+ \usepackage{enumerate}
67
+ $endif$
68
+ \usepackage{longtable}
69
+ \usepackage{float} % provides the H option for float placement
70
+ \usepackage{graphicx}
71
+ % We will generate all images so they have a width \maxwidth. This means
72
+ % that they will get their normal width if they fit onto the page, but
73
+ % are scaled down if they would overflow the margins.
74
+ \makeatletter
75
+ \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
76
+ \else\Gin@nat@width\fi}
77
+ \makeatother
78
+ \let\Oldincludegraphics\includegraphics
79
+ \makeatletter
80
+ \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
81
+ \else\Gin@nat@width\fi}
82
+ \makeatother
83
+ \let\Oldincludegraphics\includegraphics
84
+ %\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth]{#1}}
85
+ % Determine if the image is too wide for the page.
86
+ %
87
+ {%
88
+ \catcode`\@=11\relax%
89
+ \gdef\includegraphics{\@ifnextchar[{\Oldincludegraphics}{\Oldincludegraphics[width=\maxwidth]}}%
90
+ }%
91
+ %
92
+
93
+ \ifxetex
94
+ \usepackage[setpagesize=false, % page size defined by xetex
95
+ unicode=false, % unicode breaks when used with xetex
96
+ bookmarksdepth=3, %
97
+ xetex]{hyperref}
98
+ \else
99
+ \usepackage[unicode=true]{hyperref}
100
+ \fi
101
+ \hypersetup{breaklinks=true,
102
+ bookmarks=true,
103
+ pdfauthor={$author-meta$},
104
+ pdftitle={$title-meta$},
105
+ colorlinks=true,
106
+ urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
107
+ linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
108
+ pdfborder={0 0 0}}
109
+ \urlstyle{same} % don't use monospace font for urls
110
+ $if(links-as-notes)$
111
+ % Make links footnotes instead of hotlinks:
112
+ \renewcommand{\href}[2]{#2\footnote{\url{#1}}}
113
+ $endif$
114
+ $if(strikeout)$
115
+ \usepackage[normalem]{ulem}
116
+ % avoid problems with \sout in headers with hyperref:
117
+ \pdfstringdefDisableCommands{\renewcommand{\sout}{}}
118
+ $endif$
119
+ \setlength{\parindent}{0pt}
120
+ \setlength{\parskip}{6pt plus 2pt minus 1pt}
121
+ \setlength{\emergencystretch}{3em} % prevent overfull lines
122
+ $if(numbersections)$
123
+ \setcounter{secnumdepth}{5}
124
+ $else$
125
+ \setcounter{secnumdepth}{0}
126
+ $endif$
127
+ $if(verbatim-in-note)$
128
+ \VerbatimFootnotes % allows verbatim text in footnotes
129
+ $endif$
130
+ $if(lang)$
131
+ \ifxetex
132
+ \usepackage{polyglossia}
133
+ \setmainlanguage{$mainlang$}
134
+ \else
135
+ \usepackage[$lang$]{babel}
136
+ \fi
137
+ $endif$
138
+ $for(header-includes)$
139
+ $header-includes$
140
+ $endfor$
141
+
142
+ $if(title)$
143
+ \title{$title$}
144
+ $endif$
145
+ \author{$for(author)$$author$$sep$ \and $endfor$}
146
+ \date{$date$}
147
+
148
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149
+ %
150
+ % Wortsammler specific settings
151
+ %
152
+ %list environment by reinhard Jahraus
153
+ {\catcode`\@=11\relax%
154
+ \gdef\itemize{%
155
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
156
+ \advance\@itemdepth\@ne
157
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
158
+ \expandafter
159
+ \list
160
+ \csname\@itemitem\endcsname
161
+ {\def\makelabel##1{\hss\llap{##1}}%
162
+ \addtolength{\leftmargin}{-10pt}% 29.37pt
163
+ \addtolength{\rightmargin}{0.0pt}% 0.0pt
164
+ \addtolength{\labelsep}{0pt}% 23.50pt
165
+ \addtolength{\itemsep}{-3.0pt}% 5.0pt
166
+ \addtolength{\parsep}{-1pt}% 5.0pt
167
+ \addtolength{\topsep}{-5pt}% 10.0pt
168
+ \addtolength{\partopsep}{0pt}% 3.0pt
169
+ }%
170
+ \fi}
171
+ }%
172
+
173
+ %
174
+ % improve nesting of lists
175
+ % %http://stackoverflow.com/questions/1935952/maximum-nesting-level-of-lists-in-latex
176
+ %
177
+ \usepackage{enumitem}
178
+ \setlistdepth{9}
179
+ \setlist[itemize,1]{label=$$\bullet$$}
180
+ \setlist[itemize,2]{label=$$\bullet$$}
181
+ \setlist[itemize,3]{label=$$\bullet$$}
182
+ \setlist[itemize,4]{label=$$\bullet$$}
183
+ \setlist[itemize,5]{label=$$\bullet$$}
184
+ \setlist[itemize,6]{label=$$\bullet$$}
185
+ \setlist[itemize,7]{label=$$\bullet$$}
186
+ \setlist[itemize,8]{label=$$\bullet$$}
187
+ \setlist[itemize,9]{label=$$\bullet$$}
188
+ \renewlist{itemize}{itemize}{9}
189
+ %
190
+ % multicol
191
+ %
192
+ \usepackage{multicol}
193
+ $if(linenumbers)$
194
+ \newcommand{\wsbegintwocol}{}
195
+ \newcommand{\wsendtwocol}{}
196
+ $else$
197
+ \newcommand{\wsbegintwocol}{\begin{multicols}{2}}
198
+ \newcommand{\wsendtwocol}{\end{multicols}}
199
+ $endif$
200
+
201
+ %
202
+ % embed an image in the text
203
+ %
204
+ % usage: \wsembedimage{file}{r|l}{width}{height}
205
+ \usepackage{wrapfig}
206
+ \usepackage{needspace}
207
+ \newcommand{\wsembedimage}[4]{\needspace{#4}\begin{wrapfigure}{#2}{#3}\centering%
208
+ \vspace{-5mm}\includegraphics{#1}\vspace{-1cm}\end{wrapfigure}}
209
+ %
210
+ % adjust page layout
211
+ %
212
+ \setlength{\oddsidemargin}{-0.5cm}
213
+ \setlength{\evensidemargin}{-0.5cm}
214
+ \setlength{\textwidth}{17cm}
215
+ \setlength{\topmargin}{-2.0cm}
216
+ \setlength{\headheight}{1cm}
217
+ \setlength{\headsep}{1.5cm}
218
+ \setlength{\textheight}{25cm}
219
+ \setlength{\footskip}{1cm}
220
+
221
+ % adjust the toc layout
222
+ \makeatletter
223
+ % \renewcommand*\l@section{\@dottedtocline{2}{1.8em}{4em}}
224
+ \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{4em}}
225
+ \renewcommand*\l@subsubsection{\@dottedtocline{2}{5.5em}{4em}}
226
+ \makeatother
227
+
228
+ \usepackage{pdfpages}
229
+ \usepackage{bookmark}
230
+ \usepackage{fancyhdr}
231
+ \pagestyle{fancy}
232
+ \chead{\begin{center}\textbf{$title$} $edition$\end{center}}
233
+ $if(logofile)$
234
+ \lhead{\includegraphics{$logofile$}}
235
+ $endif$
236
+ \rhead{\leftmark}
237
+ \lfoot{$author$}
238
+ \rfoot{\today~$date$}
239
+ \renewcommand{\footrulewidth}{0.4pt}
240
+ %
241
+ \renewcommand{\familydefault}{\sfdefault}
242
+ %
243
+ % Marginpars shall always be right
244
+ \makeatletter
245
+ \def\marginparright{\@mparswitchfalse}
246
+ \def\marginparoutside{\@mparswitchtrue}
247
+ \makeatother
248
+ \marginparright
249
+ %
250
+ %
251
+ \raggedbottom
252
+ %
253
+
254
+ $if(linenumbers)$
255
+ \usepackage[pagewise]{lineno}
256
+ \setlength\linenumbersep{1mm}
257
+ \modulolinenumbers[5]
258
+ $endif$
259
+ %
260
+ %\renewcommand{Befehl der Gliederungsebene z.B. \chapter}{\@startsection{Name z.B. chapter}{Ebene z.B. 0}{Einrückung z.B. 0pt}{Abstand zum vorigen Text z.B. 3.5ex plus 1ex minus 0pt\relax}{Abstand zum nachfolgenden Text z.B. 2.5ex plus 0.5ex minus 0pt\relax}{Schrift z.B. \normalfont\Large\bfseries}}
261
+ %
262
+ % \makeatletter%
263
+ % \renewcommand{\chapter}{\@startsection{chapter}{0}{0pt}{3.5ex plus 1ex minus 0pt\relax}{2.5ex plus 0.5ex minus 0pt\relax}{\normalfont\Large\bfseries}}%
264
+ % \makeatother%
265
+ %
266
+ %
267
+ % Wortsammler extensions end here
268
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
269
+ \begin{document}
270
+ $if(title)$
271
+ \maketitle
272
+ $endif$
273
+
274
+ $for(include-before)$
275
+ $include-before$
276
+
277
+ $endfor$
278
+ $if(title)$
279
+ \clearpage
280
+ $endif$
281
+
282
+ $if(toc)$
283
+ {
284
+ \hypersetup{linkcolor=black}
285
+ \setcounter{tocdepth}{1}
286
+ \tableofcontents
287
+ \newpage
288
+ }
289
+ $endif$
290
+ $if(linenumbers)$
291
+ \linenumbers
292
+ $endif$
293
+
294
+ $body$
295
+
296
+ $if(natbib)$
297
+ $if(biblio-files)$
298
+ $if(biblio-title)$
299
+ $if(book-class)$
300
+ \renewcommand\bibname{$biblio-title$}
301
+ $else$
302
+ \renewcommand\refname{$biblio-title$}
303
+ $endif$
304
+ $endif$
305
+ \bibliography{$biblio-files$}
306
+
307
+ $endif$
308
+ $endif$
309
+ $if(biblatex)$
310
+ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
311
+
312
+ $endif$
313
+ $for(include-after)$
314
+ $include-after$
315
+
316
+ $endfor$
317
+ \end{document}