Ondřej Hruška 2 years ago
parent
commit
c9093afd84
Signed by: Ondřej Hruška <ondra@ondrovo.com> GPG key ID: 2C5FD5035250423D
21 changed files with 2255 additions and 0 deletions
  1. 3 0
      build.sh
  2. 48 0
      ch.existing_solutions.tex
  3. 20 0
      ch.introduction.tex
  4. 51 0
      ch.requirements.tex
  5. 7 0
      clean.sh
  6. BIN
      ctu_logo_black.pdf
  7. BIN
      ctu_logo_blue.pdf
  8. 384 0
      ctuth-core.tex
  9. 195 0
      ctuth-names.tex
  10. 997 0
      ctuth-pkg.tex
  11. 234 0
      ctuth-templates.tex
  12. 64 0
      ctuthesis.cls
  13. 170 0
      document_config.tex
  14. 20 0
      sec_abstract.tex
  15. 16 0
      sec_declaration.tex
  16. 6 0
      sec_thanks.tex
  17. 7 0
      thesis.bib
  18. BIN
      thesis.pdf
  19. 30 0
      thesis.tex
  20. 3 0
      vlna.sh
  21. BIN
      zadani-zakryto.pdf

+ 3 - 0
build.sh View File

@@ -0,0 +1,3 @@
1
+#!/bin/bash
2
+
3
+pdflatex -shell-escape -synctex=1 -interaction=nonstopmode thesis.tex

+ 48 - 0
ch.existing_solutions.tex View File

@@ -0,0 +1,48 @@
1
+\chapter{Existing Solutions}
2
+
3
+The idea of making it easier to interact with low level hardware from a PC is not new. Several solutions to this problem have been developed over the past years, each with its own advantages and drawbacks. Some of the existing solutions will be presented in this section.
4
+
5
+\section{Bus Pirate}
6
+
7
+\todo{pictures}
8
+
9
+http://dangerousprototypes.com/blog/about/
10
+
11
+Bus Pirate, developed by \todo{link}Ian Lesnet at Dangerous Prototypes and manufactured by Seeed Studio\todo{link}, is a "tinkering kit" providing access to hardware interfaces like SPI, I$^2$C, USART and 1-Wire (those will be described later  \todo{link to actual place}), as well as frequency measurement and direct pin access.
12
+
13
+The board aims to make it easy for the user to familiarize themself with new chips and modules; it also provides a range of programming interfaces for flashing microcontroller firmwares and memories. It communicates with the PC using a FTDI USB-serial bridge
14
+
15
+Bus Pirate is open source and in scope it is similar to what we want to achieve here. It can be scripted and controlled from languages like Python or Perl, connects to USB and provides a wide selection of hardware interfaces.
16
+
17
+The board is based on a PIC16 microcontroller running at 32\,MHz. Its analog/digital converter (ADC) only has a resolution of 10 bits (1024 levels). There is no digital/analog converter (DAC) available on the chip, making applications that require a varied output voltage more difficult. Another limitation of the board is its low number of GPIO pins which may be insufficient for certain applications, such as multi-channel sampling, parallel interfaces, or connecting multiple different devices at once.
18
+
19
+Those limitations, however, hardly impede on Bus Pirate's primary purpose, which is to provide an easy access to digital buses.
20
+
21
+\section{Raspberry Pi}
22
+
23
+\todo[inline]{link, pictures}
24
+
25
+Another device worth mentioning, albeit of a very different kind, is the Raspberry Pi. It is a belief of the author that the inclusion of a GPIO (\textit{general purpose I/O}) header on the Raspberry Pi mini-computers was a significant factor in their success in the hobbyist circles and school environments. This GPIO header exposes various hardware interfaces to user programs running on the computer.
26
+
27
+The responsibility of controlling the experimental hardware then lies on the user application which also provides the user interface, much simplifying the development process. The control application can be written in almost any programming language the experimenter chooses; the most popular choices appear to be Python and JavaScript. The embedded firmware, should an external microcontroller be used instead, would typically have to be written in C, C++, or assembly.
28
+
29
+A disadvantage of using a Raspberry Pi's GPIO header is that the experiments would have to be conducted directly on the mini-computer instead of using the more powerful computer the researchers already have available\footnote{An exception may be the use of such a device in developing countries, where the Raspberry Pi serves as a low-cost PC on its own.}. This introduces complications with data export or remote control. Further, should the experiment use a software package like MATLAB, installing it on the ARM-based Raspberry Pi may prove problematic.
30
+
31
+\section{The Firmata protocol}
32
+
33
+\todo[inline]{links}
34
+\todo[inline]{Move this elsewhere}
35
+
36
+Firmata is a serial communication protocol based on MIDI (\textit{Musical Instrument Digital Interface}) for passing data to and from embedded microcontrollers. MIDI is primarily used for attaching electronic musical instruments, such as synthesizers, keyboards, mixers etc., to each other or to a PC.
37
+
38
+Firmata was designed for use with the Arduino firmware to allow easy construction of user programs (called \textit{sketches} in the Arduino environment) that communicate with a client application running on the PC without having to worry about technical details.\todo{citation}
39
+
40
+Implementing the Firmata protocol in a universal hardware interfacing module would make it possible to use existing Firmata client libraries. However, it is constricted by the limitations of the encompassing MIDI protocol and offers little flexibility.
41
+
42
+\section{Professional DAQ modules}
43
+
44
+There are several offerings from professional laboratory instrument manufacturers, however their common property is a very high price. This renders them inaccessible for users with a limited budget, such as hobbyists or students who would like to keep such a device for personal use. An example falling into this category is the National Instruments "I²C/SPI Interface Device", which also includes several GPIO lines. 
45
+
46
+\todo[inline]{http://www.ni.com/en-gb/shop/select/i2c-spi-interface-device} 
47
+
48
+The decoding of hardware buses like USART, SPI or I²C is a common feature in digital storage oscilloscopes, as is the sampling of digital channels with "logic analyzer" add-ons. They are valuable debugging tools, but hardly ever provide a way to interact with the bus beyond passively intercepting an ongoing communication.

+ 20 - 0
ch.introduction.tex View File

@@ -0,0 +1,20 @@
1
+\chapter{Introduction}
2
+
3
+Prototyping, design evaluation and the measurement of physical properties in experiments make a daily occurrence in the engineering praxis. This task involves the generation and capture of electrical signals coming to and from specialized sensors, actuators and other circuitry. As the technology advanced, driven by the consumer electronics market in the pursuit of miniaturization and lower cost, a multitude of integrated sensors with digital interfaces became available. Those devices can provide a sufficient accuracy and precision for the task at hand while keeping the circuit complexity down by integrating a large portion of the necessary circuit, often including the sensor itself, on a single chip or in a compact module.
4
+
5
+The drive for miniaturization and the advent of modern hardware buses, in particular USB (Universal Serial Bus), however, simultaneously lead to the disappearance of low level computer ports, such as the once ubiquitous parallel port, that would provide an easy way of connecting those digital devices and low level hardware in general to personal computers.
6
+
7
+With those developments, we on the one hand have an easy access to interesting integrated devices that would make the mentioned experiments and evaluations easier, on the other, our means of interfacing them have become more complicated. When an engineer today wants to perform some measurements using a digital sensor, they are often left having to implement an embedded firmware for a microcontroller that can be connected to the PC through USB, commonly through a USB-USART adapter. This approach lets one optimize the solution for a particular task and possibly achieve higher performance, however it is time-consuming and requires knowledge of the embedded system design that is entirely removed from the desired measurement.
8
+
9
+Clearly it would be advantageous to have a way to easily attach those integrated devices and low level hardware in general to a PC without having to burden ourselves with technicalities of the connection. The design and implementation of such a system is the object of this work.
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+

+ 51 - 0
ch.requirements.tex View File

@@ -0,0 +1,51 @@
1
+\chapter{Goals and Requirements}
2
+
3
+This chapter analyzes the project requirements and presents a vision of the final outcome.
4
+
5
+\section{Project Name}
6
+
7
+Referring to the project only as "the project" or "the device" would be clumsy and lead to confusion. Henceforth, the project should be known as \textbf{GEX}, an acronym originating in the term \textit{GPIO Expander}, which, although not describing its scope perfectly, alludes to the project's primary purpose of providing low level GPIO capabilities to personal computers.
8
+
9
+\section{Expected Use-Cases}
10
+
11
+A first step must necessarily be to consider the situations in which the device is expected to be useful. As was mentioned in the introduction, one of the problems addressed is making it possible to easily attach electronic circuits and components to a PC. This could be in order to familiarize oneself with a new chip or a module, to measure a characteristic curve of a component, to collect experimental data from a test setup, or, for instance, to control a positioning motor.
12
+
13
+The applications can have a temporary character, a simple setup that is used once and then dismantled, or a more permanent one. An example of the latter could be laboratory tasks where the measurement framework and user interface is prepared beforehand and connecting the circuit or simply performing measurements while varying some physical properties is left as an exercise to students. Another example could be the use of GEX as a data acquisition module, replacing more expensive professional devices.
14
+
15
+As such, the device must be easy to configure without having to modify the embedded firmware and should provide the hardware interfaces and functions that are be needed for such applications. The module can be either attached directly to a PC via USB or controlled wirelessly. It would also be possible to design it as a PCI Express card, however that would limit its use to desktop computers and make the installation and software support more complicated. The wireless connection will find use in mobile robotic projects, when installed in less accessible places, or outdoors.
16
+
17
+\section{Hardware Interfaces to Implement}
18
+
19
+Given the project's broad range of potential applications, predicting precisely what hardware interfaces and connections might be needed is hardly possible. A good approach appears to be to implement the most common protocols and interfaces and provide access to selected low level features offered by the used microcontroller, like timers and direct pin access, while keeping the firmware open to future expansions should the need arise.
20
+
21
+\subsection{Direct Digital Input/Output}
22
+
23
+The most basic form of interaction with hardware is by changing the logic levels of output pins and reading input pins. With this feature alone it would be possible to analyze logic circuits, trigger some transient effect we want to observe using an oscilloscope, read a contact state, sense a button push, drive LED displays and more. Almost anything digital that doesn't require precise or fast timing could be achieved by this simple function.
24
+
25
+To make this feature more versatile, it should be possible to receive an asynchronous event on a pin state change, avoiding the need for polling loops in the control application.
26
+
27
+\subsection{Common Digital Buses}
28
+
29
+A popular way to attach peripheral devices to a microcontroller are hardware buses, the most well known of which are SPI (\textit{Serial Peripheral Interface}), I$^2$C (or IIC, \textit{Inter-Integrated-Circuit}) and USART (\textit{Universal Synchronous Asynchronous Receiver Transmitter}), in the asynchronous variant referred to as UART. A large majority of peripheral integrated circuits, digital-interface sensors and modules can be accessed using those buses. They also have hardware support in most microcontrollers, removing the burden of precise timing from the firmware.
30
+
31
+Another hardware interface that might fall into this category is I$^2$S (or IIS, \textit{Inter IC Sound}). I$^2$S is used for streaming sampled audio streams or analog samples and finds far less use than the previously mentioned buses.
32
+
33
+More information about those interfaces (excluding I$^2$S) can be found in later chapters. \todo{link to actual place}
34
+
35
+\subsection{Specialized Buses}
36
+
37
+Some devices exist that do not use any of the common buses, instead requiring their own proprietary protocol. An example of this group is the Dallas Semiconductor\footnote{Acquired by Maxim Integrated in 2001}\todo{source} 1-Wire bus, used by the popular DS18x20 digital thermometers. Another example might be some types of addressable LED strips.
38
+
39
+A common characteristic of those buses is that they require precise timing and have no native hardware support like the above mentioned common buses. This means that we can't depend on the direct GPIO access and have to implement low level driver utilities to achieve reliable communication.
40
+
41
+\subsection{Analog Input/Output}
42
+
43
+Microcontrollers typically include an ADC (\textit{Analog to Digital Converter}) with a 10-12 bits of resolution, sometimes accompanied by a DAC (\textit{Digital to Analog Converter}), its output counterpart. In the lack of a real DAC, the analog output, albeit with worse dynamic parameters, can be realized using a PWM signal (\textit{Pulse Width Modulation}, pulse train) followed by a low-pass filter.
44
+
45
+While we mainly focused on digital interfaces thus far, providing means of generating and capturing analog signals is also valuable. This capability makes it possible to read sensors with voltage output and it can substitute a simple oscilloscope when sampled periodically at a sufficient frequency. Analog input channels, even with lower resolution or sample rate, may in some cases avoid the need for a dedicated acquisition device.
46
+
47
+In conjunction, the analog output and input can be used for automated characterization of electronic components, such as diodes. Should the analog output be modulated, we could further use them to measure frequency-dependent characteristics, such as the frequency response of analog filters.
48
+
49
+
50
+
51
+

+ 7 - 0
clean.sh View File

@@ -0,0 +1,7 @@
1
+#!/bin/bash
2
+
3
+git rm -r --cached .
4
+git add .
5
+
6
+git clean -xf
7
+

BIN
ctu_logo_black.pdf View File


BIN
ctu_logo_blue.pdf View File


+ 384 - 0
ctuth-core.tex View File

@@ -0,0 +1,384 @@
1
+
2
+%!TEX ROOT = ctutest.tex
3
+
4
+\ProvidesExplFile{ctuth-core.tex}%
5
+	{2015/11/15}{0.1 t1511151022}%MY TIMESTAMP HERE {0.1}
6
+	{"Core"\space part\space of\space the\space class\space ctuthesis}
7
+
8
+
9
+
10
+
11
+
12
+
13
+%%% GENERAL LaTeX3 THINGIES
14
+
15
+\cs_generate_variant:Nn \keys_set:nn { nx }
16
+\cs_generate_variant:Nn \tl_if_eq:nnTF { xn }
17
+\cs_generate_variant:Nn \seq_gconcat:NNN { cc }
18
+\cs_generate_variant:Nn \str_if_eq:nnTF { xn }
19
+
20
+\skip_new:N \g_ctuthesis_tempa_skip
21
+
22
+
23
+
24
+
25
+
26
+
27
+%%% CLASS SETUP, FIELDS, TEMPLATES, THEMES
28
+
29
+% Set allowed languages: No other languages can ever be main, title or second
30
+\tl_gset:Nn \g_ctuthesis_alllanguages_tl {{czech}{english}{slovak}}
31
+
32
+% Error message for using \ctuprocess twice
33
+\msg_new:nnn { ctuthesis } { ctuprocess-twice } { The~macro~ \token_to_str:N \ctuprocess\ should~
34
+	be~used~only~once~in~preamble. }
35
+
36
+% Error message for not using \ctuprocess at all
37
+\msg_new:nnn { ctuthesis } { ctuprocess-none } { It~is~necessary~to~use~the~
38
+	macro~ \token_to_str:N \ctuprocess\ once~in~the~preamble. }
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+%%% KEY-VALUE SETUP
48
+
49
+% Two seqs: one for keys that need disabling after \documentclass,
50
+% another one for keys that need disabling after \ctuprocess
51
+\seq_new:N \g_ctuthesis_keys_nop_seq
52
+\seq_new:N \g_ctuthesis_keys_nopost_seq
53
+% Add the clist #2 into seq #1
54
+\cs_new:Nn \ctuthesis_keys_add_no:nn {
55
+	\group_begin:
56
+	\seq_set_from_clist:Nn \l_temp_ctuthesis_a_seq { #2 }
57
+	\seq_gconcat:ccN { g_ctuthesis_keys_#1_seq } { g_ctuthesis_keys_#1_seq } \l_temp_ctuthesis_a_seq
58
+	\group_end:
59
+}
60
+
61
+% Error messages for the keyvalue interface
62
+\msg_new:nnn { ctuthesis } { keys-unknown } { The~key~'#1'~is~not~known~to~the~
63
+	class~'ctuthesis'~and~will~be~ignored. }
64
+
65
+\msg_new:nnn { ctuthesis } { keys-nopost } { The~key~'#1'~is~forbidden~after~
66
+	\token_to_str:N \ctuprocess \space and~will~be~ignored.~You~may~wish~to~
67
+	set~it~up~before. }
68
+
69
+\msg_new:nnn { ctuthesis } { keys-nop } { The~key~'#1'~is~forbidden~in~
70
+	\token_to_str:N \ctusetup \space and~will~be~ignored.~Use~the~optional~argument~
71
+	of~ \token_to_str:N \documentclass \space to~set~it~up. }
72
+
73
+% Very standard unknown key treatment
74
+\keys_define:nn { ctuthesis } {
75
+	unknown .code:n = \msg_error:nnx { ctuthesis } { keys-unknown } { \l_keys_key_tl },
76
+}
77
+
78
+% Disables keys marked '#1' (either 'nop' or 'nopost')
79
+\cs_new:Nn \ctuthesis_disable_keys:n {
80
+	\seq_map_inline:cn { g_ctuthesis_keys_#1_seq } {
81
+		\keys_define:nn { ctuthesis } {
82
+			##1 .code:n = \msg_error:nnx { ctuthesis } { keys-#1 } { ##1 },
83
+		}
84
+	}
85
+}
86
+
87
+% General keys
88
+\tl_gset:Nn \g_ctuthesis_fontsize_tl {11pt}
89
+\seq_new:N \g_ctuthesis_languages_seq
90
+\keys_define:nn { ctuthesis } {
91
+	
92
+	% Only 11pt fontsize is allowed
93
+	fontsize .choices:nn = { 11pt } { \tl_gset_eq:NN \g_ctuthesis_fontsize_tl \l_keys_choice_tl },
94
+	
95
+	% Oneside option
96
+	oneside .bool_gset:c = { g_ctuthesis_switch_oneside_bool },
97
+	oneside .initial:n = { false },
98
+	twoside .meta:n = { oneside = false },
99
+	
100
+	% Draft option
101
+	draft .bool_gset:c = { g_ctuthesis_switch_draft_bool },
102
+	draft .initial:n = { false },
103
+	
104
+	% We use three languages:
105
+	% main for the work itself, ToC and LoFT
106
+	mainlanguage .choice:,
107
+	% title for the titlepage, thanks, declaration and abstract
108
+	titlelanguage .choice:,
109
+	% second is the language of second abstract. First abstract is in title language,
110
+	% second abstract is either in main language, or in English for Czech/Slovak theses
111
+	% or Czech for English theses. It will be set automatically.
112
+	secondlanguage .choice:,
113
+
114
+	% otherlanguages will be simply passed on to babel
115
+	otherlanguages .code:n =
116
+		\seq_set_from_clist:Nn \l_temp_ctuthesis_a_seq { #1 }
117
+		\seq_gconcat:NNN \g_ctuthesis_languages_seq \g_ctuthesis_languages_seq \l_temp_ctuthesis_a_seq
118
+		,
119
+
120
+}
121
+
122
+\ctuthesis_keys_add_no:nn { nop } { draft, fontsize, oneside, twoside }
123
+\ctuthesis_keys_add_no:nn { nopost } { mainlanguage, titlelanguage, secondlanguage }
124
+
125
+% Switches defaulting to false
126
+\tl_map_inline:nn { {front-specification}{monochrome}{savetoner}{pkg-listings}{layout-short} } {
127
+	\keys_define:nn { ctuthesis } {
128
+		#1 .bool_gset:c = { g_ctuthesis_switch_#1_bool },
129
+		#1 .initial:n = { false },
130
+	}
131
+}
132
+\ctuthesis_keys_add_no:nn { nopost } { monochrome, savetoner, pkg-listings }
133
+
134
+% Switches defaulting to true
135
+\tl_map_inline:nn { {front-list-of-tables}{front-list-of-figures}{pkg-hyperref}{pkg-makeidx}{pkg-amsthm} } {
136
+	\keys_define:nn { ctuthesis } {
137
+		#1 .bool_gset:c = { g_ctuthesis_switch_#1_bool },
138
+		#1 .initial:n = { true },
139
+	}
140
+}
141
+\ctuthesis_keys_add_no:nn { nopost } { pkg-hyperref, pkg-makeidx }
142
+
143
+% We allow the key 11pt along with the key fontsize
144
+\tl_map_inline:nn { {11pt} } {
145
+	\keys_define:nn { ctuthesis } {
146
+		#1 .meta:n = { fontsize = #1 },
147
+	}
148
+	\ctuthesis_keys_add_no:nn { nop } { #1 }
149
+}
150
+
151
+% Basic fields that are not language-dependent
152
+\tl_map_inline:nn { {author}{supervisor}{supervisor-specialist}{supervisor-address}{day}{month}{year}
153
+	  {facultynum}{specification-file}{preprint} } {
154
+	\keys_define:nn { ctuthesis } {
155
+		#1 .tl_gset:c = { g_ctuthesis_field_#1_tl },
156
+	}
157
+}
158
+
159
+% Language-dependent keys and environments
160
+\tl_map_inline:Nn \g_ctuthesis_alllanguages_tl {
161
+	% Various fields in various languages
162
+	\tl_map_inline:nn { {title}{subtitle}{university}{university-endl}{faculty}{department}
163
+		  {doctype}{fieldofstudy}{subfieldofstudy}{keywords} } {
164
+		\keys_define:nn { ctuthesis } {
165
+			##1-#1 .tl_gset:c = g_ctuthesis_field_##1_#1_tl,
166
+		}
167
+	}
168
+	% Sets up the choice for each of the languages
169
+	\tl_map_inline:nn { {mainlanguage}{titlelanguage}{secondlanguage} } {
170
+		\keys_define:nn { ctuthesis } {
171
+			##1 / #1 .code:n =
172
+				\tl_gset:cn { g_ctuthesis_field_##1_tl } { #1 }
173
+				\seq_gput_right:Nn \g_ctuthesis_languages_seq { #1 },
174
+		}
175
+	}
176
+	% The abstract is now language-dependent
177
+	\NewEnviron { abstract-#1 } { \tl_gset:cV { g_ctuthesis_field_abstract_#1_tl } \BODY }
178
+	\tl_new:c { g_ctuthesis_field_abstract_#1_tl }
179
+}
180
+
181
+% "abstract" itself is not used, the language of the abstract has to be specified
182
+\msg_new:nnn { ctuthesis } { abstract-forbidden } { The~environment~'abstract'~should~be~replaced~
183
+	by~'abstract-lang'~with~the~proper~language~specified. }
184
+\DeclareDocumentEnvironment{ abstract }{ }{ \msg_error:nn { ctuthesis } { abstract-forbidden } }{ }
185
+
186
+% "thanks" and "declaration" are fields, but set up as environments rather then KVs
187
+\cs_undefine:c { thanks }
188
+\NewEnviron { thanks } { \tl_gset:cV { g_ctuthesis_field_thanks_tl } \BODY }
189
+\tl_new:c { g_ctuthesis_field_thanks_tl }
190
+\NewEnviron { declaration } { \tl_gset:cV { g_ctuthesis_field_declaration_tl } \BODY }
191
+\tl_new:c { g_ctuthesis_field_declaration_tl }
192
+
193
+\tl_gset:Nn \g_ctuthesis_ctulstbg_tl { ctulstbg }
194
+\keys_define:nn { ctuthesis } {
195
+		ctulstbg .tl_gset:N = \g_ctuthesis_ctulstbg_tl
196
+}
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+% A macro called after every \keys_set{ctuthesis}{...}
205
+\cs_new:Nn \ctuthesis_ctusetup_trigger: {
206
+	% Remove duplicates from the language list
207
+	\seq_gremove_duplicates:N \g_ctuthesis_languages_seq
208
+	% Set up titlelanguage as mainlanguage if the latter is defined and the former is not
209
+	\bool_if:nT { \tl_if_exist_p:c { g_ctuthesis_field_mainlanguage_tl }
210
+		&& ! \tl_if_empty_p:c { g_ctuthesis_field_mainlanguage_tl }
211
+		&& ( ! \tl_if_exist_p:c { g_ctuthesis_field_titlelanguage_tl }
212
+			|| \tl_if_empty_p:c { g_ctuthesis_field_titlelanguage_tl } )
213
+	} {
214
+		\keys_set:nx { ctuthesis } { titlelanguage = \tl_use:c { g_ctuthesis_field_mainlanguage_tl } }
215
+	}
216
+	% Set up secondlanguage if it has not been set up before
217
+	\bool_if:nT { \tl_if_exist_p:c { g_ctuthesis_field_mainlanguage_tl }
218
+		&& \tl_if_exist_p:c { g_ctuthesis_field_titlelanguage_tl }
219
+		&& ( ! \tl_if_exist_p:c { g_ctuthesis_field_secondlanguage_tl }
220
+			|| \tl_if_empty_p:c { g_ctuthesis_field_secondlanguage_tl } )
221
+	} {
222
+		\tl_if_eq:ccTF { g_ctuthesis_field_mainlanguage_tl } { g_ctuthesis_field_titlelanguage_tl } {
223
+			\tl_if_eq:xnTF { \tl_use:c { g_ctuthesis_field_mainlanguage_tl } } { english } {
224
+				\keys_set:nn { ctuthesis } { secondlanguage = czech }
225
+			} {
226
+				\keys_set:nn { ctuthesis } { secondlanguage = english }
227
+			}
228
+		} {
229
+			\keys_set:nx { ctuthesis } { secondlanguage = \tl_use:c { g_ctuthesis_field_mainlanguage_tl } }
230
+		}
231
+	}
232
+}
233
+
234
+% Key setup to be used in the preamble
235
+\NewDocumentCommand \ctusetup { m } {
236
+	\keys_set:nn { ctuthesis } { #1 }
237
+	\ctuthesis_ctusetup_trigger:
238
+}
239
+
240
+
241
+
242
+
243
+
244
+
245
+%%% THEMES, TEMPLATES AND FIELDS
246
+
247
+% Theme, template and field hadling - "unknown" error messages
248
+\msg_new:nnn { ctuthesis } { unknown-theme } { Theme~'#1'~has~not~been~defined~
249
+	for~use~with~ \token_to_str:N \ctutheme . }
250
+
251
+\msg_new:nnn { ctuthesis } { unknown-template } { Template~'#1'~has~not~been~defined~
252
+	for~use~with~ \token_to_str:N \ctutemplate . }
253
+
254
+\msg_new:nnn { ctuthesis } { unknown-field } { Field~'#1'~has~not~been~defined~
255
+	for~use~with~ \token_to_str:N \ctufield . }
256
+
257
+% Theme and template hadling - setters
258
+\NewDocumentCommand \ctuthemeset { >{\TrimSpaces}m +m } {
259
+	\cs_set:cn { ctuthesis_theme_#1_var: } { #2 }
260
+}
261
+
262
+\NewDocumentCommand \ctutemplateset { >{\TrimSpaces}m +m } {
263
+	\cs_set:cn { ctuthesis_template_#1_var: } { #2 }
264
+}
265
+
266
+% Theme, template and field hadling - getters
267
+\NewDocumentCommand \ctutheme { >{\TrimSpaces}m } {
268
+	\cs_if_exist_use:cF { ctuthesis_theme_#1_var: } { \msg_error:nnx { ctuthesis } { unknown-theme } { #1 } }
269
+	}
270
+
271
+\NewDocumentCommand \ctutemplate { >{\TrimSpaces}m } {
272
+	\cs_if_exist_use:cF { ctuthesis_template_#1_var: } { \msg_error:nnx { ctuthesis } { unknown-template } { #1 } }
273
+	}
274
+
275
+% `\ctufield` supports the context language specifier as an optional argument
276
+\NewDocumentCommand \ctufield { >{\TrimSpaces}o >{\TrimSpaces}m } {
277
+	\IfValueTF { #1 } {
278
+%			\ctuthesis_field_exists:nF { #1 language } { \msg_error:nnx { ctuthesis } { unknown-field } { #1 } }
279
+%			\ctuthesis_field_use:n { #2_\ctuthesis_field_use:n { #1 language } }
280
+			\ctuthesis_field_use:nn { #1 } { #2 }
281
+	} {
282
+			\ctuthesis_field_use:n { #2 }
283
+	}
284
+}
285
+
286
+\cs_new:Nn \ctuthesis_field_use:n {
287
+	\cs_if_exist_use:cF { g_ctuthesis_field_#1_tl } { \msg_error:nnx { ctuthesis } { unknown-field } { #1 } }
288
+}
289
+
290
+% This one takes two arguments: the language and the field name
291
+\cs_new:Nn \ctuthesis_field_use:nn {
292
+	\cs_if_exist:cF { g_ctuthesis_field_#1language_tl } { \msg_error:nnx { ctuthesis } { unknown-field } { #1 } }
293
+	\ctuthesis_field_use:n { #2_\ctuthesis_field_use:n { #1 language } }
294
+}
295
+
296
+% Theme, template and field hadling - existance conditionals
297
+\prg_new_conditional:Nnn \ctuthesis_theme_exists:n { p, T, F, TF } {
298
+	\cs_if_exist:cTF { ctuthesis_theme_#1_var } { \prg_return_true: } { \prg_return_false: }
299
+}
300
+
301
+\prg_new_conditional:Nnn \ctuthesis_template_exists:n { p, T, F, TF } {
302
+	\cs_if_exist:cTF { ctuthesis_template_#1_var } { \prg_return_true: } { \prg_return_false: }
303
+}
304
+
305
+\prg_new_conditional:Nnn \ctuthesis_field_exists:n { p, T, F, TF } {
306
+	\cs_if_exist:cTF { g_ctuthesis_field_#1_tl } { \prg_return_true: } { \prg_return_false: }
307
+}
308
+
309
+% Theme, template and field hadling - publicly available conditionals with "true" and "false" branches
310
+\DeclareDocumentCommand \ctuiftheme { s~>{\TrimSpaces}m +m +m } {
311
+	\ctuthesis_theme_exists:nTF { #2 } {
312
+		\IfBooleanTF { #1 } {
313
+			\tl_if_empty:cTF { g_ctuthesis_theme_#1_tl } { #4 } { #3 }
314
+		} {
315
+			#3
316
+		}
317
+	} {
318
+		#4
319
+	}
320
+}
321
+
322
+\DeclareDocumentCommand \ctuiftemplate { s~>{\TrimSpaces}m +m +m } {
323
+	\ctuthesis_template_exists:nTF { #2 } {
324
+		\IfBooleanTF { #1 } {
325
+			\tl_if_empty:cTF { g_ctuthesis_template_#1_tl } { #4 } { #3 }
326
+		} {
327
+			#3
328
+		}
329
+	} {
330
+		#4
331
+	}
332
+}
333
+
334
+% The starred variant checks for emptiness rather than for existance
335
+\DeclareDocumentCommand \ctuiffield { s~>{\TrimSpaces}o >{\TrimSpaces}m +m +m } {
336
+	\IfValueTF { #2 } {
337
+		\ctuthesis_field_exists:nF { #2 language } { \msg_error:nnx { ctuthesis } { unknown-field } { #1 } }
338
+		\IfBooleanTF { #1 } {
339
+			\ctuiffield * { #3_\ctuthesis_field_use:n { #2 language } } { #4 } { #5 }
340
+		} {
341
+			\ctuiffield { #3_\ctuthesis_field_use:n { #2 language } } { #4 } { #5 }
342
+		}
343
+	} {
344
+		\ctuthesis_field_exists:nTF { #3 } {
345
+			\IfBooleanTF { #1 } {
346
+				\tl_if_empty:cTF { g_ctuthesis_field_#3_tl } { #5 } { #4 }
347
+			} {
348
+				#4
349
+			}
350
+		} {
351
+			\ctuthesis_field_exists:nTF { #3 } { #5 } { #4 }
352
+		}
353
+	}
354
+}
355
+
356
+% We don't do any check for existance of a switch, so better be careful.
357
+\prg_new_conditional:Nnn \ctuthesis_if_switch:n { p, T, F, TF } {
358
+	\bool_if:cTF { g_ctuthesis_switch_#1_bool } { \prg_return_true: } { \prg_return_false: }
359
+}
360
+
361
+\DeclareDocumentCommand \ctuifswitch { >{\TrimSpaces}m +m +m } {
362
+	\bool_if:cTF { g_ctuthesis_switch_#1_bool } { #2 } { #3 }
363
+}
364
+
365
+
366
+
367
+
368
+
369
+
370
+%%% LOGGING
371
+
372
+% Create \ctuverlog which contains the automatically updated timestamp of the file.
373
+% It can be used for instance in \ctusetup{preprint = \ctuverlog} in order to show
374
+% the timestamp on every page.
375
+\cs_new:Npx \ctuverlog {
376
+	ctuthesis ~ \use_ii:nn
377
+	{2015/11/15}{ t1511151022}%MY TIMESTAMP HERE {}	
378
+}
379
+
380
+
381
+
382
+
383
+
384
+\endinput

+ 195 - 0
ctuth-names.tex View File

@@ -0,0 +1,195 @@
1
+
2
+%!TEX ROOT = ctutest.tex
3
+
4
+\ProvidesExplFile{ctuthesis-names.def}{2014/01/18}{0.1}{"Names" part of the class ctuthesis}
5
+
6
+% This code provides all language-dependent definitions that are needed.
7
+% That is, no "real text" should appear anywhere else.
8
+
9
+% We stick to the LaTeX2e syntax here for what's related directly to package `babel`
10
+% Also, we don't use utf8, because if someone decided to switch encodings, they can,
11
+% and we won't prevent them from doing so if we don't have to.
12
+
13
+% General titles
14
+\def\ctucaptionsenglish{
15
+	\def\appendicesname{Appendices}
16
+	\def\thanksname{Acknowledgements}
17
+	\def\declarationname{Declaration}
18
+	\def\listfigurename{Figures}
19
+	\def\listtablename{Tables}
20
+	\def\supervisorname{Supervisor}
21
+	\def\supervisorspecialistname{Supervisor--specialist}
22
+	\def\fieldofstudyname{Field\ of\ study}
23
+	\def\subfieldofstudyname{Subfield}
24
+	\def\specificationname{Project\ Specification}
25
+	\def\keywordsname{Keywords}
26
+	\def\titletranslationname{Title\ translation}
27
+}
28
+
29
+\def\ctucaptionsczech{
30
+	\def\appendicesname{P\v r\'ilohy}
31
+	\def\thanksname{Pod\v ekov\'an\'i}
32
+	\def\declarationname{Prohl\'a\v sen\'i}
33
+	\def\listfigurename{Obr\'azky}
34
+	\def\listtablename{Tabulky}
35
+	\def\supervisorname{\v Skolitel}
36
+	\def\supervisorspecialistname{\v Skolitel--specialista}
37
+	\def\fieldofstudyname{Obor}
38
+	\def\subfieldofstudyname{Zam\v e\v ren\'i}
39
+	\def\specificationname{Zad\'an\'i\ pr\'ace}
40
+	\def\keywordsname{Kl\'i \v cov\'a\ slova}
41
+	\def\titletranslationname{P\v reklad\ n\'azvu}
42
+}
43
+
44
+\def\ctucaptionsslovak{
45
+	\def\appendicesname{Pr\'i lohy}
46
+	\def\thanksname{Po\v dakovanie}
47
+	\def\declarationname{Prehl\'asenie}
48
+	\def\listfigurename{Obr\'azky}
49
+	\def\listtablename{Tabu\v lky}
50
+	\def\figurename{Obr\'azok}
51
+	\def\supervisorname{\v Skolite\v l}
52
+	\def\supervisorspecialistname{\v Skolite\v l--specialista}
53
+	\def\fieldofstudyname{Odbor}
54
+	\def\subfieldofstudyname{Zameranie}
55
+	\def\specificationname{Zad\'an\'i\ \ pr\'ace}
56
+	\def\keywordsname{K\v l\'u\v cov\'e\ slov\'a}
57
+	\def\titletranslationname{Preklad\ n\'azvu}
58
+}
59
+
60
+% Name of the university
61
+\ctusetup{
62
+	university-endl-czech = {\v Cesk\'e\\ vysok\'e \\ u\v cen\'i  ~ technick\'e \\ v ~ Praze},
63
+	university-endl-slovak = {\v Cesk\'e\\ vysok\'e \\ u\v cen\'i  ~ technick\'e \\ v ~ Praze},
64
+	university-endl-english = {Czech\\ Technical \\ University \\ in ~ Prague},
65
+	university-czech = {\v Cesk\'e ~ vysok\'e ~ u\v cen\'i  ~ technick\'e ~ v ~ Praze},
66
+	university-slovak = {\v Cesk\'e ~ vysok\'e ~ u\v cen\'i  ~ technick\'e ~ v ~ Praze},
67
+	university-english = {Czech ~ Technical ~ University ~ in ~ Prague},
68
+}
69
+
70
+% Month names handling
71
+\seq_gset_from_clist:Nn \g_ctuthesis_months_czech_seq { ledna, \'unora, b\v rezna, dubna, kv\v etna, \v cervna,
72
+	\v cervence, srpna, z\'a\v r\'i , \v r\'i jna, listopadu, prosince }
73
+
74
+\seq_gset_from_clist:Nn \g_ctuthesis_Months_czech_seq { Leden, \'Unor, B\v rezen, Duben, Kv\v eten, \v Cerven,
75
+	\v Cervenec, Srpen, Z\'a\v r\'i , \v R\'i jen, Listopad, Prosinec }
76
+
77
+\seq_gset_from_clist:Nn \g_ctuthesis_months_slovak_seq { janu\'ara, febru\'ara, marca, apr\'i la, m\'aja, j\'una,
78
+	j\'ula, augusta, septembera, okt\v obera, novembera, decembera }
79
+
80
+\seq_gset_from_clist:Nn \g_ctuthesis_Months_slovak_seq { Janu\'ar, Febru\'ar, Marec, Apr\'i l, M\'aj, J\'un,
81
+	J\'ul, August, September, Okt\v ober, November, December }
82
+
83
+\seq_gset_from_clist:Nn \g_ctuthesis_months_english_seq { January, February, March, April, May, June,
84
+	July, August, September, October, November, December }
85
+
86
+\seq_gset_eq:NN \g_ctuthesis_Months_english_seq \g_ctuthesis_months_english_seq
87
+
88
+\DeclareExpandableDocumentCommand \monthinlanguage { s~m } {
89
+	\IfBooleanTF { #1 } {
90
+		\seq_item:cn { g_ctuthesis_Months_\tl_use:c { g_ctuthesis_field_#2language_tl }_seq }
91
+		{ \ctuthesis_field_use:n { month } }
92
+	} {
93
+		\seq_item:cn { g_ctuthesis_months_\tl_use:c { g_ctuthesis_field_#2language_tl }_seq }
94
+		{ \ctuthesis_field_use:n { month } }
95
+	}
96
+}
97
+
98
+
99
+
100
+% Document types and Faculty names in all langauges
101
+\keys_define:nn { ctuthesis } {
102
+
103
+	% Make doctype and faculty aliases for xdoctype and xfaculty
104
+	doctype .meta:n = { xdoctype = {#1} },
105
+	faculty .meta:n = { xfaculty = {#1} },
106
+
107
+	% Setup doctypes
108
+	xdoctype .meta:n = { xdoctype-#1 },
109
+	xdoctype .groups:n = { dc, nopre, nopost },
110
+
111
+	xdoctype-B .meta:n = {
112
+		doctype-english = { Bachelor ~ Project },
113
+		doctype-czech = { Bakalářská ~ práce },
114
+		doctype-slovak = { Bakalárska ~ práca }
115
+	},
116
+	xdoctype-M .meta:n = {
117
+		doctype-english = { Master ~ Thesis },
118
+		doctype-czech = { Diplomová ~ práce },
119
+		doctype-slovak = { Diplomová ~ práca }
120
+	},
121
+	xdoctype-D .meta:n = {
122
+		doctype-english = { Dissertation ~ Thesis },
123
+		doctype-czech = { Disertační ~ práce },
124
+		doctype-slovak = { Dizertačná ~ práca }
125
+	},
126
+
127
+	xfaculty .meta:n = { facultynum={#1}, xfaculty-#1, },
128
+
129
+	xfaculty-F1 .meta:n = {
130
+		faculty-english = { Faculty ~ of ~ Civil ~ Engineering },
131
+		faculty-czech = { Fakulta ~ stavební },
132
+		faculty-slovak = { Fakulta ~ stavební }
133
+	},
134
+	xfaculty-F2 .meta:n = {
135
+		faculty-english = { Faculty ~ of ~ Mechanical ~ Engineering },
136
+		faculty-czech = { Fakulta ~ strojní },
137
+		faculty-slovak = { Fakulta ~ strojní }
138
+	},
139
+	xfaculty-F3 .meta:n = {
140
+		faculty-english = { Faculty ~ of ~ Electrical ~ Engineering },
141
+		faculty-czech = { Fakulta ~ elektrotechnická },
142
+		faculty-slovak = { Fakulta ~ elektrotechnická }
143
+	},
144
+	xfaculty-F4 .meta:n = {
145
+		faculty-english = { Faculty ~ of ~ Nuclear ~ Sciences ~ and ~ Physical ~ Engineering },
146
+		faculty-czech = { Fakulta ~ jaderná ~ a ~ fyzikálně ~ inženýrská },
147
+		faculty-slovak = { Fakulta ~ jaderná ~ a ~ fyzikálně ~ inženýrská }
148
+	},
149
+	xfaculty-F5 .meta:n = {
150
+		faculty-english = { Faculty ~ of ~ Architecture },
151
+		faculty-czech = { Fakulta ~ architektury },
152
+		faculty-slovak = { Fakulta ~ architektury }
153
+	},
154
+	xfaculty-F6 .meta:n = {
155
+		faculty-english = { Faculty ~ of ~ Transportation ~ Sciences },
156
+		faculty-czech = { Fakulta ~ dopravní },
157
+		faculty-slovak = { Fakulta ~ dopravní }
158
+	},
159
+	xfaculty-F7 .meta:n = {
160
+		faculty-english = { Faculty ~ of ~ Biomedical ~ Engineering },
161
+		faculty-czech = { Fakulta ~ biomedicínského ~ inženýrství },
162
+		faculty-slovak = { Fakulta ~ biomedicínského ~ inženýrství }
163
+	},
164
+	xfaculty-F8 .meta:n = {
165
+		faculty-english = { Faculty ~ of ~ Information ~ Technology },
166
+		faculty-czech = { Fakulta ~ informačních ~ technologií },
167
+		faculty-slovak = { Fakulta ~ informačních ~ technologií }
168
+	},
169
+	xfaculty-KU .meta:n = {
170
+		faculty-english = { Klokner ~ Institute },
171
+		faculty-czech = { Kloknerův ~ ústav },
172
+		faculty-slovak = { Kloknerův ~ ústav },
173
+		facultynum = { KÚ },
174
+	},
175
+	xfaculty-CIIRC .meta:n = {
176
+		faculty-english = { Czech ~ Institute ~ of ~ Informatics, ~ Robotics ~ and ~ Cybernetics },
177
+		faculty-czech = { Český ~ institut ~ informatiky, ~ robotiky ~ a ~ kybernetiky },
178
+		faculty-slovak = { Český ~ institut ~ informatiky, ~ robotiky ~ a ~ kybernetiky },
179
+		facultynum = { CIIRC },
180
+	},
181
+	xfaculty-MUVS .meta:n = {
182
+		faculty-english = { Masaryk ~ Institute ~ of ~ Advanced ~ Studies },
183
+		faculty-czech = { Masarykův ~ ústav ~ vyšších ~ studií },
184
+		faculty-slovak = { Masarykův ~ ústav ~ vyšších ~ studií },
185
+		facultynum = { MÚVS },
186
+	},
187
+
188
+}
189
+
190
+
191
+
192
+
193
+
194
+
195
+\endinput

File diff suppressed because it is too large
+ 997 - 0
ctuth-pkg.tex


+ 234 - 0
ctuth-templates.tex View File

@@ -0,0 +1,234 @@
1
+
2
+%!TEX ROOT = ctutest.tex
3
+
4
+\ProvidesExplFile{ctuth-templates.tex}%
5
+	{2015/11/15}{0.1 t1511151022}%MY TIMESTAMP HERE {0.1}
6
+	{"Templates"\space part\space of\space the\space class\space ctuthesis}
7
+
8
+% The titlepage, includes doctype, faculty, department, title, author,
9
+% and some auxiliary information at the bottom
10
+\ctutemplateset{titlepage}{
11
+	\thispagestyle { empty }
12
+	\noindent
13
+	\vbox to \textheight{%
14
+	% The titlepage goes all way up to the header (taking one \baselineskip of the head)
15
+	\vspace*{\dimexpr-\baselineskip-\headsep}
16
+	\vss%
17
+	{\noindent\leavevmode\color{ctubluerule}\vrule width 11pt\hspace*{11pt}}
18
+	% The main vbox of the titlepage is larger by (bls + heasep) up and (footskip) down
19
+	\vbox to \dimexpr\textheight + \baselineskip + \headsep + \footskip{
20
+		% Reduce hsize by the rule width and the sep
21
+		\hsize\dimexpr\linewidth-17pt
22
+		% No justification, sf bf font
23
+		\raggedright \sffamily \bfseries
24
+		\selectctulanguage{title}
25
+		%
26
+		% The document type
27
+		{\ctufield[title]{doctype}\par}
28
+		%
29
+		\vspace*{3ex}
30
+		%
31
+		% A table containing: the CTU logo and name, faculty number, faculty and deparment name
32
+		\begin{tabular}{@{}l@{\hspace*{1em}}l@{}}
33
+			\Large\includegraphics[height=\dimexpr4\normalbaselineskip-1ex]{ctu_logo_black}
34
+		&
35
+			\Large\color{ctubluetext}\begin{tabular}[b]{@{}l@{}}\ctufield[title]{university-endl}\end{tabular}
36
+		\\[3ex]
37
+%			\begin{tabular}[c]{@{}l@{}}
38
+			\raisebox{-8pt}{
39
+			\color{ctubluetext}\fontsize{32.7}{32.7}\selectfont
40
+			\setbox0\hbox{\smash{\ctufield{facultynum}}\vphantom{X}}
41
+			\ifdim\wd0>2em \scalebox{0.9}[1]{\textls[-50]{\smash{\ctufield{facultynum}}\vphantom{X}}}\else\box0\fi
42
+			}
43
+%			\end{tabular}
44
+		&
45
+			\begin{tabular}[c]{@{}l@{}}\rlap{\ctufield[title]{faculty}}\\[2pt]\ctufield[title]{department}\end{tabular}
46
+		\end{tabular}\par
47
+		%
48
+		\vspace{8ex plus 1fill}
49
+		%
50
+		% The title, in two languages
51
+		{\LARGE\color{ctubluetext}
52
+		\ctufield[title]{title}
53
+		\par}
54
+		%
55
+		\vspace{3ex}
56
+		%
57
+		{\Large\color{ctubluetext}
58
+		\ctufield[title]{subtitle}
59
+		\par}
60
+		%
61
+		\vspace*{8ex}
62
+		%
63
+		% The author
64
+		{\Large
65
+		\ctufield{author}
66
+		\par}
67
+		%
68
+		\vspace{0pt plus 3fill}
69
+		{
70
+		% The "metadata": supervisor, field of study, month and year
71
+		\parskip 1pt
72
+		\ctuiffield*{supervisor}{\supervisorname :~{\frenchspacing\ctufield{supervisor}}\par}{}
73
+		\ctuiffield*{supervisor-specialist}{\supervisorspecialistname :~{\frenchspacing\ctufield{supervisor-specialist}}\par}{}
74
+		\ctuiffield*[title]{fieldofstudy}{\fieldofstudyname :~\ctufield[title]{fieldofstudy}\par}{}
75
+		\ctuiffield*[title]{subfieldofstudy}{\subfieldofstudyname :~\ctufield[title]{subfieldofstudy}\par}{}
76
+		\monthinlanguage*{title}~\ctufield{year}\par
77
+		}
78
+	}
79
+	\vss
80
+	% The titlepage goes all way down to the foot
81
+	\vspace*{-\footskip}
82
+	}
83
+	\par
84
+}
85
+
86
+% This include the specification file, and does nothing more
87
+\ctutemplateset{include.specification}{
88
+	\includepdf[pages=-]{\tl_use:c{ g_ctuthesis_field_specification-file_tl }}
89
+}
90
+
91
+% Includes the specification as a chapter
92
+\ctutemplateset{specification.as.chapter}{
93
+	\cleardoublepage
94
+	% If it is an appendix, it gets a number, if not, it does not
95
+	\ifctu@app
96
+		\refstepcounter{chapter}
97
+		\phantomsection
98
+		\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}\specificationname}
99
+	\else
100
+		\phantomsection
101
+		\addcontentsline{toc}{chapter}{\specificationname}
102
+	\fi
103
+	\ctutemplate{include.specification}
104
+}
105
+
106
+\ctutemplateset{twocolumn.abstract.in.titlelanguage}{
107
+		\selectctulanguage{title}
108
+		\chapter{\abstractname}\noindent
109
+		\ctufield[title]{abstract}\par
110
+		{ \raggedright
111
+		\paragraph{\keywordsname :}
112
+		\ctufield[title]{keywords}
113
+		\paragraph{\supervisorname :}
114
+		\ctuiffield*{supervisor}{
115
+			\ctufield{supervisor}
116
+			\ctuiffield*{supervisor-address}{
117
+				\\
118
+				\ctufield{supervisor-address}
119
+			}{}
120
+		}{}
121
+		\par }
122
+}
123
+
124
+\ctutemplateset{twocolumn.abstract.in.secondlanguage}{
125
+		\selectctulanguage{second}
126
+		\chapter{\abstractname}\noindent
127
+		\ctufield[second]{abstract}\par
128
+		{ \raggedright
129
+		\paragraph{\keywordsname :}
130
+		\ctufield[second]{keywords}
131
+		\paragraph{\titletranslationname :}
132
+		\ctufield[second]{title}
133
+		\ctuiffield*[second]{subtitle}{
134
+			\ --- \ \ctufield[second]{subtitle}
135
+		} { }
136
+		\par }
137
+}
138
+
139
+\ctutemplateset{twocolumn.tableofcontents}{
140
+		\selectctulanguage{main}
141
+		\tableofcontents
142
+}
143
+
144
+\ctutemplateset{twocolumn.thanks}{
145
+		\selectctulanguage{title}
146
+		\chapter{\thanksname}\noindent
147
+		\ctufield{thanks}
148
+}
149
+
150
+\ctutemplateset{twocolumn.declaration}{
151
+		\selectctulanguage{title}
152
+		\chapter{\declarationname}\noindent
153
+		\ctufield{declaration}
154
+}
155
+
156
+\ctutemplateset{twocolumn.listoffigures}{
157
+		\selectctulanguage{main}
158
+		\listoffigures
159
+}
160
+
161
+\ctutemplateset{twocolumn.listoftables}{
162
+		\selectctulanguage{main}
163
+		\listoftables
164
+}
165
+
166
+% Abstract template includes the Acknowledgements, Declaration and two Abstracts
167
+% the abstracts are accompanied by the keywords and possibly other information
168
+\ctutemplateset{maketitle.twocolumn.default}{
169
+	\begin{twocolumnfrontmatterpage}
170
+		\ctutemplate{twocolumn.declaration}
171
+	\newpage
172
+		\ctutemplate{twocolumn.thanks}
173
+	\clearpage
174
+		\ctutemplate{twocolumn.abstract.in.titlelanguage}
175
+	%\newpage %CHANGED!!
176
+	
177
+	\vspace{3cm} % ADDED!
178
+	
179
+		\ctutemplate{twocolumn.abstract.in.secondlanguage}
180
+	\clearpage
181
+		\ctutemplate{twocolumn.tableofcontents}
182
+	% The "loft" template is included only if at least one of the lists is enabled
183
+	\bool_if:nTF {
184
+		\ctuthesis_if_switch_p:n { front-list-of-figures }
185
+		|| \ctuthesis_if_switch_p:n { front-list-of-tables }
186
+	} {
187
+		\clearpage
188
+		\ctutemplate{twocolumn.loft}
189
+	} { }
190
+	\end{twocolumnfrontmatterpage}
191
+}
192
+
193
+% Lists of Figures and Tables
194
+\ctutemplateset{twocolumn.loft}{
195
+		\ctuifswitch { front-list-of-figures } { \ctutemplate{twocolumn.listoffigures} } { }
196
+		%CHANGED removed the LoT
197
+	\newpage
198
+		\ctuifswitch { front-list-of-tables } { \ctutemplate{twocolumn.listoftables} } { }
199
+}
200
+
201
+% The maketitle command (moreorless): roman page numbering
202
+\ctutemplateset{maketitle}{
203
+	\frontmatter
204
+	% Start with the titlepage
205
+	\ctutemplate{titlepage}
206
+	% title verso is empty (the star makes it completely empty in our template)
207
+	\cleardoublepage*
208
+	% If the specification has to be in front, include it. It it's one page only,
209
+	% the verso is left empty
210
+	\ctuifswitch{front-specification}{
211
+		\ctutemplate{include.specification}
212
+		\cleardoublepage*
213
+	} { }
214
+	% The abstract and alike
215
+	\ctutemplate{maketitle.twocolumn.default}
216
+	\def\thepage{}
217
+	% Start the mainmatter
218
+	\mainmatter
219
+}
220
+
221
+% Minor change to \mainmatter: we add the star to \cleardoublepage
222
+\DeclareDocumentCommand \mainmatter { } {
223
+	\cleardoublepage*
224
+	\@mainmattertrue
225
+	\pagenumbering{arabic}
226
+	\pagestyle{headings}
227
+}
228
+
229
+% \maketitle command itself just calls the maketitle template
230
+\DeclareDocumentCommand \maketitle { } {
231
+	\ctutemplate{maketitle}
232
+}
233
+
234
+\endinput

+ 64 - 0
ctuthesis.cls View File

@@ -0,0 +1,64 @@
1
+%!TEX ROOT = ctutest.tex
2
+
3
+\RequirePackage{expl3,l3keys2e}
4
+\RequirePackage{environ}
5
+\RequirePackage{xparse}
6
+\RequirePackage[utf8]{inputenc}
7
+
8
+\ProvidesExplClass{ctuthesis}%
9
+	{2015/11/15}{0.1 t1511151022}%MY TIMESTAMP HERE {0.1}
10
+	{Class for typesetting CTU theses and alike}
11
+
12
+% Some general remarks: the module name for this class is `ctuthesis`. Yes, it is quite long,
13
+% but at the very same time, it's descriptive.
14
+
15
+% The core of the class.
16
+\input{ctuth-core.tex}
17
+
18
+% Process class keys (and call the trigger)
19
+\ProcessKeysOptions { ctuthesis }
20
+\ctuthesis_ctusetup_trigger:
21
+
22
+% Load the report class
23
+\LoadClass [
24
+	a4paper, % pagesize option
25
+	\bool_if:cT { g_ctuthesis_switch_draft_bool } { draft } , % draft option
26
+	\bool_if:cTF { g_ctuthesis_switch_oneside_bool } { oneside } { twoside }, % one/twoside option
27
+	\tl_use:N \g_ctuthesis_fontsize_tl % fontsize option
28
+	] { book }
29
+
30
+% Once the class is loaded, we disable keys marked 'nop'
31
+\ctuthesis_disable_keys:n { nop }
32
+
33
+% This is the macro that actually loads all the stuff. It ought to be used exactly in the preamble.
34
+% The reason for this setup is that it allows \ctusetup parameters to influence things that need
35
+% to be influenced.
36
+\DeclareDocumentCommand \ctuprocess { } {
37
+	% Get to both LaTeX2e and LaTeX3 context
38
+	\makeatletter
39
+	\ExplSyntaxOn
40
+	% Load the two files
41
+	\input{ctuth-pkg.tex}
42
+	\input{ctuth-templates.tex}
43
+	\ExplSyntaxOff
44
+	\makeatother
45
+	% Once \ctuprocess is called, we disable keys marked 'nop'
46
+	\ctuthesis_disable_keys:n { nopost }
47
+	% Make more calls to \ctuprocess lead to an error
48
+	\let\ctuprocess\ctuprocess@postprocess
49
+	% Disable check for missing \ctuprocess
50
+	\let\ctuprocess@check\relax
51
+}
52
+
53
+% The two macros that only invoke an error -- used in checks whether \ctuprocess was called exactly once
54
+\DeclareDocumentCommand \ctuprocess@postprocess { } { \msg_error:nn { ctuthesis } { ctuprocess-twice } }
55
+\DeclareDocumentCommand \ctuprocess@check { } { \msg_error:nn { ctuthesis } { ctuprocess-none } }
56
+\AtBeginDocument{\ctuprocess@check}
57
+
58
+\input{ctuth-names.tex}
59
+
60
+
61
+
62
+
63
+
64
+\endinput

+ 170 - 0
document_config.tex View File

@@ -0,0 +1,170 @@
1
+% extra balíky a jejich nastavení
2
+
3
+\usepackage{todonotes} % todos
4
+\usepackage{minted}    % code listings 
5
+\usepackage{blindtext} % lorem
6
+\usepackage{csquotes}  % quotes
7
+\usepackage{wrapfig}
8
+\usepackage{svg}
9
+\usepackage[all]{nowidow} % fix for orphaned lines of text
10
+\usepackage{fancyvrb}
11
+\usepackage{siunitx}
12
+\usepackage{sectsty}
13
+\usepackage{titlecaps}
14
+
15
+\newcommand{\uF}{\micro\farad}
16
+\newcommand{\nF}{\nano\farad}
17
+\newcommand{\cm}{\centi\metre}
18
+\newcommand{\VperA}{\V/\A}
19
+
20
+%nobreak dash
21
+
22
+
23
+\usepackage[style=numeric,backend=biber,sorting=none]{biblatex}
24
+
25
+\usepackage{xpatch,letltxmacro}
26
+\LetLtxMacro{\cminted}{\minted}
27
+\let\endcminted\endminted
28
+\xpretocmd{\cminted}{\RecustomVerbatimEnvironment{Verbatim}{BVerbatim}{}}{}{}
29
+
30
+% More space in table cells
31
+\renewcommand{\arraystretch}{1.4}
32
+
33
+% Fix overful hbox
34
+\setlength{\emergencystretch}{.5em}
35
+
36
+\setsvg{svgpath=img/}
37
+
38
+% Nastavení ctuthesis
39
+
40
+\ctusetup{
41
+	xdoctype = M,
42
+	front-list-of-tables = false,
43
+	mainlanguage = english,
44
+	%
45
+	author = {Ondřej Hruška},
46
+	supervisor = {doc. Ing. Radislav Šmíd, Ph.D.},
47
+	%
48
+	title-english = {Learning and automation GPIO platform},
49
+	title-czech = {Výuková a automatizační GPIO platforma},
50
+	%
51
+	xfaculty = F3,
52
+	department-czech = {Katedra měření},  
53
+	fieldofstudy-czech = {Kybernetika a~robotika},
54
+	subfieldofstudy-czech = {Senzory a~přístrojová technika},
55
+	%
56
+	department-english = {Department of Measurement},
57
+	fieldofstudy-english = {Cybernetics and Robotics},
58
+	subfieldofstudy-english = {Sensors and Instrumentation},
59
+	front-specification = true,
60
+	specification-file = {zadani-zakryto.pdf},
61
+	%specification-file = {zadani-doc.pdf},
62
+	%specification-file = {zadani-doc.pdf},
63
+	%
64
+	keywords-czech = {},
65
+	keywords-english = {},
66
+	%
67
+	day = 0,     % ???
68
+	month = 0,  % ???
69
+	year = 2018, % ???
70
+}
71
+
72
+
73
+\ctuprocess
74
+
75
+
76
+\hypersetup{
77
+	pdftitle = {Learning and automation GPIO platform},
78
+	pdfauthor = {Ondřej Hruška}
79
+}
80
+
81
+
82
+% Extra info na titulní stránce
83
+\addto\ctucaptionsczech{%
84
+	\def\supervisorname{Vedoucí}%
85
+	\def\subfieldofstudyname{Studijní program}%
86
+}
87
+
88
+% Abstrakt, poděkování atd
89
+\ctutemplateset{maketitle twocolumn default}{
90
+	\begin{twocolumnfrontmatterpage}
91
+		\ctutemplate{twocolumn.thanks}
92
+		\ctutemplate{twocolumn.declaration}
93
+		\ctutemplate{twocolumn.abstract.in.titlelanguage}
94
+		\ctutemplate{twocolumn.abstract.in.secondlanguage}
95
+		\ctutemplate{twocolumn.tableofcontents}
96
+		\ctutemplate{twocolumn.listoffigures}
97
+	\end{twocolumnfrontmatterpage}
98
+}
99
+
100
+
101
+% Uvozovky v češtině
102
+% \DeclareQuoteStyle{czech}
103
+% 	{\quotedblbase}
104
+% 	{\textquotedblleft}
105
+% 	{\textquoteleft}
106
+% 	{\textquoteright}
107
+
108
+% ??? what does this do
109
+\makeatletter
110
+\newcommand*{\centerfloat}{%
111
+	\parindent \z@
112
+	\leftskip \z@ \@plus 1fil \@minus \textwidth
113
+	\rightskip\leftskip
114
+	\parfillskip \z@skip}
115
+\makeatother
116
+
117
+% makro pro uvozovky
118
+% \renewcommand\uv[1]{\enquote{#1}}
119
+
120
+% monospace
121
+\newcommand\mono[1]{\texttt{#1}}
122
+
123
+% library name
124
+\newcommand\lib[1]{\textit{#1}}
125
+
126
+% add blank page unless current is left
127
+%\newcommand*\cleartoleftpage{%
128
+%	\clearpage
129
+%	\ifodd\value{page}\hbox{}\newpage\fi
130
+%}
131
+
132
+% \newcommand\zdroj[1]{\textit{Zdroj: #1}}
133
+
134
+% -- odstavce --
135
+\setlength\parskip{1.5ex plus 1pt minus 1 pt}
136
+%\setlength{\parskip}{1.5ex plus 0.2ex minus 0.1ex} % po změně je potřeba doladit nadpisy
137
+%\renewcommand{\baselinestretch}{1.1}
138
+\setlength\parindent{.5cm}
139
+
140
+
141
+% -- set link colors ---
142
+\usepackage{xcolor}
143
+\hypersetup{
144
+	colorlinks,
145
+	linkcolor={red!50!black},
146
+	citecolor={blue!50!black},
147
+	urlcolor={blue!80!black}
148
+}
149
+
150
+
151
+% název listing figure
152
+% \renewcommand\listingscaption{Program}
153
+
154
+% don't clear page before chapter
155
+%\renewcommand{\cleardoublepage}{\clearpage}
156
+
157
+
158
+% -- section on new page, except first --
159
+%\pretocmd{\section}{%
160
+%	\ifnum\value{section}=0 \else\clearpage\fi
161
+%}{}{}
162
+\usepackage{wasysym} % some symbols
163
+
164
+% Pretty mono font
165
+%\usepackage[scaled=.9]{beramono}
166
+%\usepackage{cm}
167
+
168
+\newcommand\nobr[1]{\mbox{#1}}
169
+
170
+\usepackage{pmboxdraw}

+ 20 - 0
sec_abstract.tex View File

@@ -0,0 +1,20 @@
1
+% Abstrakt
2
+
3
+\begin{abstract-english}
4
+	
5
+\begin{otherlanguage}{english}
6
+This work focuses on the design of an AC appliance degradation detector. The goal is to implement a~device in the form of a~power-plug adapter that could be used to monitor and study the characteristics of the AC current.
7
+
8
+A~prototype with a~STM32\,F3 processor and an ESP8266 programmable WiFi module has been realised, together with a~custom firmware for both processors, which allows easy access to the measurements and charts using a~web browser. The device also supports regular reporting to a~Xively or ThingSpeak monitoring server.
9
+\end{otherlanguage}
10
+
11
+\end{abstract-english}
12
+
13
+
14
+\begin{abstract-czech}
15
+	
16
+Tato práce se zabývá implementací detektoru poruch a~degradací síťového spotřebiče pomocí analýzy časového průběhu odebíraného proudu. Cílem je navrhnout a~realizovat přístroj ve formě zásuvkového adaptéru, který by bylo možné použít k~monitorování připojeného zařízení.
17
+
18
+V~rámci práce byl realizován prototyp přístroje s~procesorem řady STM32\,F3 a~programovatelným WiFi modulem ESP8266. Zařízení umožňuje pohodlné ovládání a~zobrazení grafů spektra a~průběhu proudu pomocí webového rozhraní. Dále je podporováno pravidelné hlášení stavu na servery Xively a~ThingSpeak.
19
+
20
+\end{abstract-czech}

+ 16 - 0
sec_declaration.tex View File

@@ -0,0 +1,16 @@
1
+% Declaration / Prohlaseni
2
+\begin{declaration}
3
+
4
+Prohlašuji, že jsem předloženou práci vypracoval samostatně a~že jsem uvedl veškeré použité informační zdroje v~souladu s~Metodickým pokynem o~dodržování etických principů při přípravě vysokoškolských závěrečných prací.
5
+
6
+\medskip
7
+
8
+V~Praze, 27. května 2018
9
+
10
+\vspace*{.5cm}
11
+
12
+...........................................
13
+
14
+
15
+
16
+\end{declaration}

+ 6 - 0
sec_thanks.tex View File

@@ -0,0 +1,6 @@
1
+% Acknowledgements
2
+\begin{thanks}
3
+
4
+blabla
5
+
6
+\end{thanks}

+ 7 - 0
thesis.bib View File

@@ -0,0 +1,7 @@
1
+@online{foo,
2
+	title = {Foo Bar},
3
+	url = {https://foo.bar},
4
+	urldate = {2016-05-08},
5
+	language = {english}
6
+}
7
+

BIN
thesis.pdf View File


+ 30 - 0
thesis.tex View File

@@ -0,0 +1,30 @@
1
+\documentclass[twoside]{ctuthesis}
2
+
3
+\input{document_config} % import balíků a nastavení ctuthesis
4
+
5
+% --- obsah zvláštních oddílů ---
6
+
7
+\input{sec_abstract}
8
+\input{sec_thanks}
9
+\input{sec_declaration}
10
+
11
+\addbibresource{thesis.bib}
12
+
13
+% --- vlastní dokument ---
14
+
15
+\begin{document}
16
+
17
+\maketitle % titulní strana a automatické oddíly
18
+
19
+\input{ch.introduction}
20
+\input{ch.requirements}
21
+\input{ch.existing_solutions}
22
+
23
+\appendix % začátek příloh
24
+
25
+% seznam bibliografie
26
+\printbibliography
27
+
28
+% ... appendices
29
+
30
+\end{document}

+ 3 - 0
vlna.sh View File

@@ -0,0 +1,3 @@
1
+#!/bin/bash
2
+
3
+vlna -m -n -r -v KkSsVvZzOoUuAaIi *.tex

BIN
zadani-zakryto.pdf View File