aboutsummaryrefslogtreecommitdiffstats
path: root/structure.tex
diff options
context:
space:
mode:
Diffstat (limited to 'structure.tex')
-rw-r--r--structure.tex227
1 files changed, 227 insertions, 0 deletions
diff --git a/structure.tex b/structure.tex
new file mode 100644
index 0000000..62deff6
--- /dev/null
+++ b/structure.tex
@@ -0,0 +1,227 @@
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2% Lachaise Assignment
3% Structure Specification File
4% Version 1.0 (26/6/2018)
5%
6% This template originates from:
7% http://www.LaTeXTemplates.com
8%
9% Authors:
10% Marion Lachaise & François Févotte
11% Vel ([email protected])
12%
13% License:
14% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
15%
16%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17
18%----------------------------------------------------------------------------------------
19% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
20%----------------------------------------------------------------------------------------
21
22\usepackage{amsmath,amsfonts} % Math packages
23\usepackage{enumerate} % Custom item numbers for enumerations
24\usepackage[ruled]{algorithm2e} % Algorithms
25\usepackage[framemethod=tikz]{mdframed} % Allows defining custom boxed/framed environments
26\usepackage{listings} % File listings, with syntax highlighting
27\usepackage[super]{nth}
28\usepackage{csquotes}
29
30\lstset{
31 basicstyle=\ttfamily, % Typeset listings in monospace font
32}
33
34%----------------------------------------------------------------------------------------
35% DOCUMENT MARGINS
36%----------------------------------------------------------------------------------------
37
38\usepackage{geometry} % Required for adjusting page dimensions and margins
39
40\geometry{
41 paper=a4paper, % Paper size, change to letterpaper for US letter size
42 top=2.5cm, % Top margin
43 bottom=3cm, % Bottom margin
44 left=2.5cm, % Left margin
45 right=2.5cm, % Right margin
46 headheight=14pt, % Header height
47 footskip=1.5cm, % Space from the bottom margin to the baseline of the footer
48 headsep=1.2cm, % Space from the top margin to the baseline of the header
49 % showframe, % Uncomment to show how the type block is set on the page
50}
51
52%----------------------------------------------------------------------------------------
53% FONTS
54%----------------------------------------------------------------------------------------
55
56\usepackage[utf8]{inputenc} % Required for inputting international characters
57\usepackage[T1]{fontenc} % Output font encoding for international characters
58
59% \usepackage{XCharter} % Use the XCharter fonts
60
61%----------------------------------------------------------------------------------------
62% COMMAND LINE ENVIRONMENT
63%----------------------------------------------------------------------------------------
64
65% Usage:
66% \begin{commandline}
67% \begin{verbatim}
68% $ ls
69%
70% Applications Desktop ...
71% \end{verbatim}
72% \end{commandline}
73
74\mdfdefinestyle{commandline}{
75 leftmargin=10pt,
76 rightmargin=10pt,
77 innerleftmargin=15pt,
78 middlelinecolor=black!50!white,
79 middlelinewidth=2pt,
80 frametitlerule=false,
81 backgroundcolor=black!5!white,
82 frametitle={\ttfamily\cmdname},
83 frametitlefont={\normalfont\sffamily\color{white}\hspace{-1em}},
84 frametitlebackgroundcolor=black!50!white,
85 nobreak,
86}
87
88% Define a custom environment for command-line snapshots
89\newenvironment{commandline}[1][Cmd]{
90 \medskip
91 \newcommand{\cmdname}{#1}
92 \begin{mdframed}[style=commandline]
93}{
94 \end{mdframed}
95 \medskip
96}
97
98%----------------------------------------------------------------------------------------
99% FILE CONTENTS ENVIRONMENT
100%----------------------------------------------------------------------------------------
101
102% Usage:
103% \begin{file}[optional filename, defaults to "File"]
104% File contents, for example, with a listings environment
105% \end{file}
106
107\mdfdefinestyle{file}{
108 innertopmargin=1.6\baselineskip,
109 innerbottommargin=0.8\baselineskip,
110 topline=false, bottomline=false,
111 leftline=false, rightline=false,
112 leftmargin=2cm,
113 rightmargin=2cm,
114 singleextra={%
115 \draw[fill=black!10!white](P)++(0,-1.2em)rectangle(P-|O);
116 \node[anchor=north west]
117 at(P-|O){\ttfamily\mdfilename};
118 %
119 \def\l{3em}
120 \draw(O-|P)++(-\l,0)--++(\l,\l)--(P)--(P-|O)--(O)--cycle;
121 \draw(O-|P)++(-\l,0)--++(0,\l)--++(\l,0);
122 },
123 nobreak,
124}
125
126% Define a custom environment for file contents
127\newenvironment{file}[1][File]{ % Set the default filename to "File"
128 \medskip
129 \newcommand{\mdfilename}{#1}
130 \begin{mdframed}[style=file]
131}{
132 \end{mdframed}
133 \medskip
134}
135
136%----------------------------------------------------------------------------------------
137% NUMBERED QUESTIONS ENVIRONMENT
138%----------------------------------------------------------------------------------------
139
140% Usage:
141% \begin{question}[optional title]
142% Question contents
143% \end{question}
144
145\mdfdefinestyle{question}{
146 innertopmargin=1.2\baselineskip,
147 innerbottommargin=0.8\baselineskip,
148 roundcorner=5pt,
149 nobreak,
150 singleextra={%
151 \draw(P-|O)node[xshift=1em,anchor=west,fill=white,draw,rounded corners=5pt]{%
152 Question (\alph{Question})\questionTitle};
153 },
154}
155
156\newcounter{Question}[section] % Stores the current question number that gets iterated with each new question TODO reset after each section
157
158% Define a custom environment for numbered questions
159\newenvironment{question}[1][\unskip]{
160 \bigskip
161 \stepcounter{Question}
162 \newcommand{\questionTitle}{~#1}
163 \begin{mdframed}[style=question]
164}{
165 \end{mdframed}
166 \medskip
167}
168
169%----------------------------------------------------------------------------------------
170% WARNING TEXT ENVIRONMENT
171%----------------------------------------------------------------------------------------
172
173% Usage:
174% \begin{warn}[optional title, defaults to "Warning:"]
175% Contents
176% \end{warn}
177
178\mdfdefinestyle{warning}{
179 topline=false, bottomline=false,
180 leftline=false, rightline=false,
181 nobreak,
182 singleextra={%
183 \draw(P-|O)++(-0.5em,0)node(tmp1){};
184 \draw(P-|O)++(0.5em,0)node(tmp2){};
185 \fill[black,rotate around={45:(P-|O)}](tmp1)rectangle(tmp2);
186 \node at(P-|O){\color{white}\scriptsize\bf !};
187 \draw[very thick](P-|O)++(0,-1em)--(O);%--(O-|P);
188 }
189}
190
191% Define a custom environment for warning text
192\newenvironment{warn}[1][Warning:]{ % Set the default warning to "Warning:"
193 \medskip
194 \begin{mdframed}[style=warning]
195 \noindent{\textbf{#1}}
196}{
197 \end{mdframed}
198}
199
200%----------------------------------------------------------------------------------------
201% INFORMATION ENVIRONMENT
202%----------------------------------------------------------------------------------------
203
204% Usage:
205% \begin{info}[optional title, defaults to "Info:"]
206% contents
207% \end{info}
208
209\mdfdefinestyle{info}{%
210 topline=false, bottomline=false,
211 leftline=false, rightline=false,
212 nobreak,
213 singleextra={%
214 \fill[black](P-|O)circle[radius=0.6em];
215 \node at(P-|O){\color{white}\scriptsize\bf Q};
216 \draw[very thick](P-|O)++(0,-0.8em)--(O);%--(O-|P);
217 }
218}
219
220% Define a custom environment for information
221\newenvironment{info}[1][Info:]{ % Set the default title to "Info:"
222 \medskip
223 \begin{mdframed}[style=info]
224 \noindent{\textbf{#1}}
225}{
226 \end{mdframed}
227}