Manual: do filling the table headers with colors in a more official way, so that...
[kugel-rb.git] / manual / preamble.tex
bloba9ace76d122dbfa31ac6933759e8f25ba5a57d48
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 % __________ __ ___.
3 % Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 % Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 % Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 % Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 % \/ \/ \/ \/ \/
8 % - M A N U A L -
10 % $Id$
12 % Copyright (C) 2006 The Rockbox Manual Team
14 % All files in this archive are subject to the GNU Free Documentation License
15 % See the file COPYING-MANUAL in the source tree docs/ directory for full license
16 % agreement.
18 % Contributors are listed in the file docs/CREDITS-MANUAL
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 \documentclass[a4paper,11pt]{scrreprt}
23 \usepackage[utf8]{inputenc}
24 % This manual used to use Palatino as font. This caused issues with small caps
25 % (textsc), so do not use that font as default one anymore.
27 \usepackage{tabularx}
28 \usepackage{multirow}
29 \usepackage{multicol}
31 \usepackage{float}
32 \floatstyle{ruled}
34 \usepackage{hyperref}
35 \usepackage{enumitem}
37 \usepackage{optional}
39 \usepackage[table]{xcolor}
41 \input{platform/\platform.tex}
42 \input{features.tex}
44 \newcommand{\playername}{\playerman\ \playerlongtype}
46 \hypersetup{% add some values to the pdf properties
47 colorlinks = true,
48 pdfstartview = FitV,
49 linkcolor = blue,
50 citecolor = blue,
51 urlcolor = blue,
52 pdftitle = {Rockbox user manual},
53 pdfauthor = {The Rockbox Team},
54 pdfsubject = {Rockbox user manual for \playername}
57 \newcommand{\fname}[1]{\texttt{#1}}
58 \newcommand{\tabeltc}[1]{{\centering #1 \par}}
59 \newcommand{\tabelth}[1]{{\centering \textbf{\textit{#1}} \par}}
61 \newcommand{\fixme}[1]{\textbf{\textcolor{red}{#1}}}
63 % Colors used to typeset table headers and alternating table rows
64 \colorlet{tblhdrbgcolor}{blue!30} % Background color for headers
65 \colorlet{tbloddrowbgcolor}{blue!10} % Background color for odd rows (headers not included)
66 \colorlet{tblevenrowbgcolor}{white} % Background color for even rows (headers not included)
68 % We use or own rules to typeset tables since we want the headers to
69 % be fully filled with colors
70 \newcommand{\rbtoprule}{\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}%
71 \arrayrulecolor{tblhdrbgcolor}\specialrule{\belowrulesep}{0pt}{0pt}%
72 \arrayrulecolor{black}}
73 \newcommand{\rbmidrule}{\arrayrulecolor{tblhdrbgcolor}\specialrule{\aboverulesep}{0pt}{0pt}%
74 \arrayrulecolor{black}\specialrule{\lightrulewidth}{0pt}{0pt}%
75 \arrayrulecolor{tblevenrowbgcolor}\specialrule{\belowrulesep}{0pt}{0pt}%
76 \arrayrulecolor{black}}
77 \newcommand{\rbbottomrule}{\specialrule{\heavyrulewidth}{\aboverulesep}{0pt}%
78 \arrayrulecolor{white}\specialrule{\belowbottomsep}{0pt}{0pt}%
79 \arrayrulecolor{black}}
82 \usepackage{fancyhdr}
83 \usepackage{graphicx}
84 \usepackage{verbatim}
85 \usepackage{makeidx}
86 \usepackage{fancyvrb}
87 \usepackage{color}
88 \ifpdfoutput{\usepackage{booktabs}}%
89 {\newcommand{%
90 \toprule}{}\newcommand{\midrule}{\hline}\newcommand{\bottomrule}{}%
92 \usepackage{longtable}
93 \usepackage{url}
94 \urlstyle{sf}
95 \usepackage{marvosym}
96 \usepackage{ifthen}
97 \usepackage{rotating}
99 % pdf output: try pdf first, then png and jpg as file format
100 % html output: try png first, then jpg. Ignore pdf files
101 % this only applies if no file extension is given!
102 \ifpdfoutput{\DeclareGraphicsExtensions{.pdf,.png,.jpg}}%
103 {\DeclareGraphicsExtensions{.png,.jpg}}
105 % fancy header style adjustments
106 \fancyhead{}
107 \fancyfoot{}
108 \fancyhead[L]{{\nouppercase{\textsc{\leftmark}}}}
109 \fancyhead[R]{\iffloatpage{}{\thepage}}
110 \fancyfoot[L]{\textsc{The Rockbox manual}}
111 \fancyfoot[R]{\textsc{\playerman{} \playertype}}
112 \fancypagestyle{plain}{}
114 \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
115 \renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}
116 \setlength{\headheight}{18.5pt}
117 \newcounter{example}[chapter]
119 %% \newenvironment{example}
120 %% {\stepcounter{example}\paragraph{Example \theexample:}}
121 %% {\hfill$\Box$
123 %% \bigskip
124 %% \noindent}
126 % found on the internet, posting by Donald Arseneau
127 % I may as well include my robust expandable definions, which can be
128 % used in \edef or \write where the \def would not be executed:
130 % \if\blank --- checks if parameter is blank (Spaces count as blank)
131 % \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
132 % \if\nil --- checks if parameter is null (spaces are NOT null)
133 % use \if\given{ } ... \else ... \fi etc.
135 {\catcode`\!=8 % funny catcode so ! will be a delimiter
136 \catcode`\Q=3 % funny catcode so Q will be a delimiter
137 \long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
138 \long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
139 \long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
140 \long\gdef\IfN@Ught#1 #2!{\blank{#2}}
141 \long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
144 % environment for setting the changelog.
145 \newenvironment{changelog}%
146 {\renewcommand{\labelitemi}{$\star$}\setitemize{noitemsep,topsep=0pt}%
147 \begin{itemize}}%
148 {\end{itemize}}
151 % add screenshot image.
152 % Usage: \screenshot{filename}{caption}{label}
153 % By using the 'H' (HERE) placement, the screenshots are placed where
154 % we want them.
155 % Note: use this only for screenshots!
156 % Note: leave caption empty to supress it.
157 \newcommand{\screenshot}[3]{
158 \begin{figure}[H]
159 \begin{center}
160 \IfFileExists{#1-\genericimg-\specimg.png}
161 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\specimg.png}
162 \typeout{Note: device specific image used}}
163 {\IfFileExists{#1-\genericimg.png}
164 {\includegraphics[width=\screenshotsize]{#1-\genericimg.png}}
165 {\IfFileExists{#1}
166 {\includegraphics[width=\screenshotsize]{#1}
167 \typeout{Warning: deprecated plain image name used}}%
168 {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
169 \color{red}{\textbf{WARNING!} Image not found}%
173 \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
174 \caption{#2}}\fi
175 \end{center}
176 \end{figure}
179 % command to display a note.
180 % Usage: \note{text of your note}
181 % Note: do NOT use \textbf or similar to emphasize text, use \emph!
182 \ifpdfoutput{
183 \newcommand{\note}[1]{
184 \ifinner\else\par\noindent\fi
185 \textbf{Note:}\ %
186 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\fi%
188 {\newcommand{\note}[1]{\ifinner\else\par\noindent\fi\textbf{Note:{} }#1\par}}
190 % command to display a warning.
191 % Usage: \warn{text of your warning}
192 % Note: do NOT use \textbf or similar to emphasize text!
193 \ifpdfoutput{
194 \newcommand{\warn}[1]{
195 \ifinner\else\par\noindent\fi
196 \textbf{Warning:\ }%
197 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
199 {\newcommand{\warn}[1]{\ifinner\else\par\noindent\fi\textbf{Warning:{} }#1}}
201 % command to mark a text block as intended especially for blind people
202 % Usage: \blind{text}
203 \ifpdfoutput{
204 \newcommand{\blind}[1]{
205 \ifinner\else\par\noindent\fi
206 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\ForwardToEnd}}#1\par\fi%
208 {\newcommand{\blind}[1]{\ifinner\else\par\noindent\fi#1}}
210 % make table floats use "H" (as for screenshots) as default positioning
211 \makeatletter\renewcommand{\fps@table}{H}\makeatother
212 % change defaults for floats on a page as we have a lot of small images
213 \setcounter{topnumber}{3} % default: 2
214 \setcounter{bottomnumber}{2} % default: 1
215 \setcounter{totalnumber}{5} % default: 3
218 % Environment for typesetting tables in a consistent way. The header has
219 % a darker background; rows are white and light gray (alternating). Top,
220 % middle and bottom rules are automatically set.
222 % Params:
223 % #1 -- table width
224 % #2 -- column specification (as used in the package tabularx)
225 % #3 -- contents of the header row. The number of items must
226 % match the number of specs in #2
227 % #4 -- caption (optional). If used then this must be inside a floating
228 % environment, e.g. table
229 % #5 -- label (optional)
231 % Example:
232 % \begin{rbtabular}{0.9\textwidth}{lX}{Col1 & Col2}{}{}
233 % A1 & A2\\
234 % B1 & B2\\
235 % C1 & C2\\
236 % \end{rbtabular}
238 \newenvironment{rbtabular}[5]{%
239 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
240 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
241 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
242 \rbbottomrule%
243 \SavedEndTab%
244 \if\given{#4}\caption{#4}\fi%
245 \if\given{#5}\label{#5}\fi%
246 \endcenter%
248 \center
249 \tabularx{#1}{#2}\rbtoprule\rowcolor{tblhdrbgcolor}
250 #3\\\rbmidrule
252 \endtabularx
258 % command to set the default table heading for button lists
259 \newcommand{\taghead}{\textbf{Tag} & \textbf{Description} \\\rbmidrule}
261 % environment intended to be used with tag maps (for wps)
262 % usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{tagmap}
263 % Note: this automatically sets the table lines.
264 % Note: you *need* to terminate the last line with a linebreak \\
265 % Note: you still need to enclose this with \begin{table} / \end{table}
266 % Cheers for the usenet helping me building this up :)
267 \newenvironment{tagmap}[2]{%
268 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
269 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
270 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
271 \rbbottomrule%
272 \SavedEndTab%
273 \if\given{#1}\caption{#1}\fi%
274 \if\given{#2}\label{#2}\fi%
275 \endcenter%
277 \center
278 \tabularx{\textwidth}{lX}\rbtoprule\rowcolor{tblhdrbgcolor} % here is the table width defined
279 \taghead
281 \endtabularx
284 % When creating HTML, use the soul package.
285 % This produces much nicer HTML code (textsc results in each character being
286 % put in a separate <span>).
287 \ifpdfoutput{\newcommand{\caps}[1]{\textsc{#1}}}{\usepackage{soul}}
288 \newcommand{\setting}[1]{\caps{#1}}
290 \newcommand{\config}[1]{\texttt{#1}}
292 % set link to download server
293 % Usage: \download{bootloader/bootloader-ipodnano.ipod}
294 % gets expanded to
295 % "http://download.rockbox.org/bootloader/bootloader-ipodnano.ipod"
296 \newcommand{\download}[1]{\url{http://download.rockbox.org/#1}}
298 % set link to the wiki.
299 % Usage: \wikilink{WebHome}
300 % with "WebHome" being the wiki page name
301 \newcommand{\wikibaseurl}{http://www.rockbox.org/wiki/}
302 \ifpdfoutput{\newcommand{\wikiicon}{\Pointinghand}}
303 {\newcommand{\wikiicon}{}}
304 \newcommand{\wikilink}[1]{\wikiicon{}\href{\wikibaseurl#1}{#1}}
305 %\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/wiki/#1}}
307 % define environment "code" based on fancyvrb.
308 % use it to set code the user should type / see on his screen.
309 % Note: the first 4 characters of each line will be stripped,
310 % requiring everything to be indendet by exactly _4_ spaces!
311 % This is intended to make the LaTeX sources more readable.
312 % Note: when using the code environment you need to use optv instead of opt!
313 \DefineVerbatimEnvironment{code}{Verbatim}%
314 {framerule=0.4pt, framesep=1ex,frame=lines,%numbers=left,stepnumber=5,%
315 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
316 label=\textnormal{\textsc{Code}},%
317 commandchars=\\\{\}%
320 % define environment "example" based on fancyvrb.
321 % use it to set example code the user should type / see on his screen.
322 % Note: the first 4 characters of each line will be stripped,
323 % requiring everything to be indendet by exactly _4_ spaces!
324 % This is intended to make the LaTeX sources more readable.
325 % Note: when using the example environment you need to use optv instead of opt!
326 \DefineVerbatimEnvironment{example}{Verbatim}%
327 {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
328 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
329 label=\textnormal{\textsc{Example}},%
330 commandchars=\\\{\}%
333 % Use the nopt command to exclude a certain defined feature from a sectio
334 % Example:
335 % \nopt{ondio}{This text will be excluded for ondios}
336 \newcommand{\optnvalue}{0}
337 \newcommand{\nopt}[2]{%
338 \renewcommand{\optnvalue}{0}\opt{#1}{\renewcommand{\optnvalue}{1}}%
339 \ifthenelse{\optnvalue > 0}{}{#2}%
342 % Use the reference to handle get a flexible reference command
343 % usage \reference{ref_section}
344 \ifpdfoutput{%
345 \newcommand{\reference}[1]{%
346 section~\ref{#1} (page~\pageref{#1})%
348 {\newcommand{\reference}[1]{section~\ref{#1}}}
350 % special HTML output adjustments
351 \ifpdfoutput{}{\setlength{\parindent}{0mm}}
352 \ifpdfoutput{}{\renewcommand{\Forward}[1]{$\triangleright${}#1}}
354 \newcommand{\btnfnt}[1]{\textbf{#1}}
355 %\hfuzz=2pt
357 % generate index
358 \usepackage{makeidx}
359 \makeindex
361 % command to set the default table heading for button lists
362 \newcommand{\btnhead}{\textbf{Key} \opt{HAVEREMOTEKEYMAP}{%
363 & \textbf{Remote Key}} & \textbf{Action} \\\rbmidrule}
364 % environment intended to be used with button maps
365 % usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
366 % Note: this automatically sets the table lines.
367 % Note: you *need* to terminate the last line with a linebreak \\
368 % Note: you still need to enclose this with \begin{table} / \end{table}
369 % Cheers for the usenet helping me building this up :)
371 % tabularx is set to be either two or three columns wide depending on whether
372 % HAVEREMOTEKEYMAP is defined in the platform file for the target in question.
373 % If it is, then every button table has three columns of the form
374 % Main Unit Key & Remote Key & Description \\
376 \newenvironment{btnmap}[2]{%
377 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
378 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
379 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
380 \rbbottomrule%
381 \SavedEndTab%
382 \if\given{#1}\caption{#1}\fi%
383 \if\given{#2}\label{#2}\fi%
384 \endcenter%
386 \center
387 \opt{HAVEREMOTEKEYMAP}{
388 % here is the table width defined for 3 columns
389 \tabularx{.95\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}>{\raggedright\arraybackslash}p{.2\textwidth}X}\rbtoprule\rowcolor{tblhdrbgcolor}
391 \nopt{HAVEREMOTEKEYMAP}{
392 % here is the table width defined for 2 columns
393 \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\rbtoprule\rowcolor{tblhdrbgcolor}
395 \btnhead
397 \endtabularx