aboutsummaryrefslogtreecommitdiff
path: root/example.tex
blob: ee1377aee58f903994c989111ee5e0519fb05213 (plain)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
\documentclass{projdoc}
% if the document compiles too slow (likely due to many/large images), try compiling
% with the [draft] option. this replaces all images with placeholders.
\input{meta.tex}

\input{reqs.aux}

\title{Example Document}

\begin{document}

% generate table of contents, list of figures and list of tables
\tablestables

\bigskip
Look how nice and consistent these tables and lists look compared to the default in
MS Word!

% flush page
\newpage

\section{Introduction}

This is an example document that is meant to demonstrate various \LaTeX{} features,
as well as some macros specific to \hbox{projdoc.cls}.
% LaTeX has automatic line breaking. \hbox is used here to ensure projdoc.cls is
% never broken across lines.

\section{Sectioning}
\subsection{Subsections}
\subsubsection{Subsubsections}
\paragraph{Paragraphs (level 4)}

These don't show up in the table of contents by default

\section{Figures and tables}

\Cref{fig:example-a} definitely shows something. Referencing multiple things at once
is neatly handled by cleveref:
\cref{fig:example-a,fig:example-b,fig:example-puml,tab:gate-xor}.

\begin{figure}
	\centering
	\includegraphics[width=8cm]{example-image-a}
	\caption{This is the figure title}
	\label{fig:example-a} % label must be placed AFTER caption
\end{figure}

\begin{figure}
	\begin{subfigure}{0.45\textwidth}%
		\centering
		\fitimg{\includegraphics{example-image-b}}
		\caption{Example image B}
		\label{fig:example-b}
	\end{subfigure}%
	\hfill
	\begin{subfigure}{0.45\textwidth}%
		\centering
		\includepumldiag{img/example.puml}
		\caption{Example PlantUML diagram}
		\label{fig:example-puml}
	\end{subfigure}%
	\caption{Subfigures}
\end{figure}

\begin{table}
	\centering
	% i know, table code sucks
	\begin{tabular}{ll@{\qquad}r}
		\toprule
		$a$ & $b$ & $x$\\
		\midrule
		0 & 0 & 0\\
		0 & 1 & 1\\
		1 & 0 & 1\\
		1 & 1 & 0\\
		\bottomrule
	\end{tabular}
	% booktabs tables look very nice, but it seems the author hates vertical rules with
	% a burning passion. please avoid using vertical rules for consistency.
	\caption{XOR-gate truth table}
	\label{tab:gate-xor}
\end{table}

\begin{table}
	\begin{tabularx}{\linewidth}{lXr}
		\toprule
		left & & right\\
		\midrule
		This table & fills all available & horizontal space\\
		\bottomrule
	\end{tabularx}
	\caption{Really wide table}
\end{table}

\section{Other markup}

\subsection{Fonts}

The \codeinline{\emph} command can be used to \emph{emphasize} (i.e.~italicize) text.
% Note the ~ (non-breaking space) after "i.e.". LaTeX inserts some extra negative
% space after a full stop, but since the full stop is used to denote an abbreviation
% we need to tell LaTeX to insert a regular space. This can also be achieved by using
% "\ ", though this allows LaTeX to break a line after the "i.e." which looks ugly in
% my opinion.

The \codeinline{\codeinline} command can be used to insert inline code.

The \codeinline{blockcode} environment can be used to insert a code block:

\begin{blockcode}
This is all included verbatim: \verb|asdf| \ $%!(*@#&)$
\end{blockcode}

\subsection{Information dumps}

Unordered (bullet) list:

\begin{itemize}
	\item Foo
	\item Bar
	\item Baz
\end{itemize}

Numbered list:

\begin{enumerate}
	\item Foo
	\item Bar
	\item Baz
	\item \begin{enumerate}
		\item These
		\item Can
		\item Be
		\item Nested
		\item And
		\item \label{item:enum-nest-ref} Referenced
	\end{enumerate}
\end{enumerate}

(See \cref{item:enum-nest-ref})

Description:

\begin{description}
	\item[Item one] description of item one
	\item[Item two] description of item two
	\item[Item three] ...
\end{description}

\subsection{Comparisons}

\begin{comparison}
	\pro{Good thing}
	\con{Bad thing}
	\pro{Good thing 2}
	\con{Bad thing 2}
\end{comparison}

\subsection{References}

\subsubsection{Citations}

Citations are inserted using the \codeinline{\autocite} command \autocite{rfc:3339}.
The bibliography is automatically printed after \codeinline{\end{document}}.

\subsubsection{Glossary}

Glossary entries can be inserted using the \codeinline{\gls} commands. Example:
``\Gls{sdl2} handles \glspl{hid} as well!''. In following occurrences of acronyms,
only their short form is printed: `\gls{sdl2}' and `\gls{hid}'. All of these link to
the glossary that is automatically printed after \codeinline{\end{document}}.

\subsubsection{Requirements}

Requirements are referenced like \codeinline{\label}s:
e.g.~\cref{req:audio:handle:id,req:audio:async-api:id}.

\end{document}