Introduce names for header and row color in the tables so that they are the same...
[kugel-rb.git] / manual / preamble.tex
blob8bbce066bd7ac1b276aec801c18fc08693545906
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}{gray!60} % Background color for headers
65 \colorlet{tblrowbgcolor}{gray!30} % Background color for rows
67 \usepackage{fancyhdr}
68 \usepackage{graphicx}
69 \usepackage{verbatim}
70 \usepackage{makeidx}
71 \usepackage{fancyvrb}
72 \usepackage{enumerate}
73 \usepackage{color}
74 \ifpdfoutput{\usepackage{booktabs}}%
75 {\newcommand{%
76 \toprule}{}\newcommand{\midrule}{\hline}\newcommand{\bottomrule}{}%
78 \usepackage{longtable}
79 \usepackage{url}
80 \urlstyle{sf}
81 \usepackage{marvosym}
82 \usepackage{ifthen}
83 \usepackage{rotating}
85 % pdf output: try pdf first, then png and jpg as file format
86 % html output: try png first, then jpg. Ignore pdf files
87 % this only applies if no file extension is given!
88 \ifpdfoutput{\DeclareGraphicsExtensions{.pdf,.png,.jpg}}%
89 {\DeclareGraphicsExtensions{.png,.jpg}}
91 % fancy header style adjustments
92 \fancyhead{}
93 \fancyfoot{}
94 \fancyhead[L]{{\nouppercase{\textsc{\leftmark}}}}
95 \fancyhead[R]{\iffloatpage{}{\thepage}}
96 \fancyfoot[L]{\textsc{The Rockbox manual}}
97 \fancyfoot[R]{\textsc{\playerman{} \playertype}}
98 \fancypagestyle{plain}{}
100 \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
101 \renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}
102 \setlength{\headheight}{18.5pt}
103 \newcounter{example}[chapter]
105 %% \newenvironment{example}
106 %% {\stepcounter{example}\paragraph{Example \theexample:}}
107 %% {\hfill$\Box$
109 %% \bigskip
110 %% \noindent}
112 % found on the internet, posting by Donald Arseneau
113 % I may as well include my robust expandable definions, which can be
114 % used in \edef or \write where the \def would not be executed:
116 % \if\blank --- checks if parameter is blank (Spaces count as blank)
117 % \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
118 % \if\nil --- checks if parameter is null (spaces are NOT null)
119 % use \if\given{ } ... \else ... \fi etc.
121 {\catcode`\!=8 % funny catcode so ! will be a delimiter
122 \catcode`\Q=3 % funny catcode so Q will be a delimiter
123 \long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
124 \long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
125 \long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
126 \long\gdef\IfN@Ught#1 #2!{\blank{#2}}
127 \long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
130 % environment for setting the changelog.
131 \newenvironment{changelog}%
132 {\renewcommand{\labelitemi}{$\star$}\setitemize{noitemsep,topsep=0pt}%
133 \begin{itemize}}%
134 {\end{itemize}}
137 % add screenshot image.
138 % Usage: \screenshot{filename}{caption}{label}
139 % By using the 'H' (HERE) placement, the screenshots are placed where
140 % we want them.
141 % Note: use this only for screenshots!
142 % Note: leave caption empty to supress it.
143 \newcommand{\screenshot}[3]{
144 \begin{figure}[H]
145 \begin{center}
146 \IfFileExists{#1-\genericimg-\specimg.png}
147 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\specimg.png}
148 \typeout{Note: device specific image used}}
149 {\IfFileExists{#1-\genericimg.png}
150 {\includegraphics[width=\screenshotsize]{#1-\genericimg.png}}
151 {\IfFileExists{#1}
152 {\includegraphics[width=\screenshotsize]{#1}
153 \typeout{Warning: deprecated plain image name used}}%
154 {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
155 \color{red}{\textbf{WARNING!} Image not found}%
159 \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
160 \caption{#2}}\fi
161 \end{center}
162 \end{figure}
165 % command to display a note.
166 % Usage: \note{text of your note}
167 % Note: do NOT use \textbf or similar to emphasize text, use \emph!
168 \ifpdfoutput{
169 \newcommand{\note}[1]{
170 \ifinner\else\par\noindent\fi
171 \textbf{Note:}\ %
172 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\fi%
174 {\newcommand{\note}[1]{\ifinner\else\par\noindent\fi\textbf{Note:{} }#1\par}}
176 % command to display a warning.
177 % Usage: \warn{text of your warning}
178 % Note: do NOT use \textbf or similar to emphasize text!
179 \ifpdfoutput{
180 \newcommand{\warn}[1]{
181 \ifinner\else\par\noindent\fi
182 \textbf{Warning:\ }%
183 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
185 {\newcommand{\warn}[1]{\ifinner\else\par\noindent\fi\textbf{Warning:{} }#1}}
187 % command to mark a text block as intended especially for blind people
188 % Usage: \blind{text}
189 \ifpdfoutput{
190 \newcommand{\blind}[1]{
191 \ifinner\else\par\noindent\fi
192 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\ForwardToEnd}}#1\par\fi%
194 {\newcommand{\blind}[1]{\ifinner\else\par\noindent\fi#1}}
196 % make table floats use "H" (as for screenshots) as default positioning
197 \makeatletter\renewcommand{\fps@table}{H}\makeatother
198 % change defaults for floats on a page as we have a lot of small images
199 \setcounter{topnumber}{3} % default: 2
200 \setcounter{bottomnumber}{2} % default: 1
201 \setcounter{totalnumber}{5} % default: 3
207 % command to set the default table heading for button lists
208 \newcommand{\taghead}{\textbf{Tag} & \textbf{Description} \\\midrule}
210 % environment intended to be used with tag maps (for wps)
211 % usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{tagmap}
212 % Note: this automatically sets the table lines.
213 % Note: you *need* to terminate the last line with a linebreak \\
214 % Note: you still need to enclose this with \begin{table} / \end{table}
215 % Cheers for the usenet helping me building this up :)
216 \newenvironment{tagmap}[2]{%
217 \rowcolors{1}{}{tblrowbgcolor}
218 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
219 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
220 \bottomrule
221 \SavedEndTab%
222 \if\given{#1}\caption{#1}\fi%
223 \if\given{#2}\label{#2}\fi%
224 \endcenter%
226 \center
227 \tabularx{\textwidth}{lX}\toprule % here is the table width defined
228 \taghead
230 \endtabularx
233 % When creating HTML, use the soul package.
234 % This produces much nicer HTML code (textsc results in each character being
235 % put in a separate <span>).
236 \ifpdfoutput{\newcommand{\caps}[1]{\textsc{#1}}}{\usepackage{soul}}
237 \newcommand{\setting}[1]{\caps{#1}}
239 \newcommand{\config}[1]{\texttt{#1}}
241 % set link to download server
242 % Usage: \download{bootloader/bootloader-ipodnano.ipod}
243 % gets expanded to
244 % "http://download.rockbox.org/bootloader/bootloader-ipodnano.ipod"
245 \newcommand{\download}[1]{\url{http://download.rockbox.org/#1}}
247 % set link to the wiki.
248 % Usage: \wikilink{WebHome}
249 % with "WebHome" being the wiki page name
250 \newcommand{\wikibaseurl}{http://www.rockbox.org/wiki/}
251 \ifpdfoutput{\newcommand{\wikiicon}{\Pointinghand}}
252 {\newcommand{\wikiicon}{}}
253 \newcommand{\wikilink}[1]{\wikiicon{}\href{\wikibaseurl#1}{#1}}
254 %\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/wiki/#1}}
256 % define environment "code" based on fancyvrb.
257 % use it to set code the user should type / see on his screen.
258 % Note: the first 4 characters of each line will be stripped,
259 % requiring everything to be indendet by exactly _4_ spaces!
260 % This is intended to make the LaTeX sources more readable.
261 % Note: when using the code environment you need to use optv instead of opt!
262 \DefineVerbatimEnvironment{code}{Verbatim}%
263 {framerule=0.4pt, framesep=1ex,frame=lines,%numbers=left,stepnumber=5,%
264 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
265 label=\textnormal{\textsc{Code}},%
266 commandchars=\\\{\}%
269 % define environment "example" based on fancyvrb.
270 % use it to set example code the user should type / see on his screen.
271 % Note: the first 4 characters of each line will be stripped,
272 % requiring everything to be indendet by exactly _4_ spaces!
273 % This is intended to make the LaTeX sources more readable.
274 % Note: when using the example environment you need to use optv instead of opt!
275 \DefineVerbatimEnvironment{example}{Verbatim}%
276 {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
277 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
278 label=\textnormal{\textsc{Example}},%
279 commandchars=\\\{\}%
282 % Use the nopt command to exclude a certain defined feature from a sectio
283 % Example:
284 % \nopt{ondio}{This text will be excluded for ondios}
285 \newcommand{\optnvalue}{0}
286 \newcommand{\nopt}[2]{%
287 \renewcommand{\optnvalue}{0}\opt{#1}{\renewcommand{\optnvalue}{1}}%
288 \ifthenelse{\optnvalue > 0}{}{#2}%
291 % Use the reference to handle get a flexible reference command
292 % usage \reference{ref_section}
293 \ifpdfoutput{%
294 \newcommand{\reference}[1]{%
295 section~\ref{#1} (page~\pageref{#1})%
297 {\newcommand{\reference}[1]{section~\ref{#1}}}
299 % special HTML output adjustments
300 \ifpdfoutput{}{\setlength{\parindent}{0mm}}
301 \ifpdfoutput{}{\renewcommand{\Forward}[1]{$\triangleright${}#1}}
303 \newcommand{\btnfnt}[1]{\textbf{#1}}
304 %\hfuzz=2pt
306 % generate index
307 \usepackage{makeidx}
308 \makeindex
311 % command to set the default table heading for button lists
312 \newcommand{\btnhead}{\textbf{Key} \opt{HAVEREMOTEKEYMAP}{%
313 & \textbf{Remote Key}} & \textbf{Action} \\\midrule}
314 % environment intended to be used with button maps
315 % usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
316 % Note: this automatically sets the table lines.
317 % Note: you *need* to terminate the last line with a linebreak \\
318 % Note: you still need to enclose this with \begin{table} / \end{table}
319 % Cheers for the usenet helping me building this up :)
321 % tabularx is set to be either two or three columns wide depending on whether
322 % HAVEREMOTEKEYMAP is defined in the platform file for the target in question.
323 % If it is, then every button table has three columns of the form
324 % Main Unit Key & Remote Key & Description \\
326 \newenvironment{btnmap}[2]{%
327 \rowcolors{1}{}{tblrowbgcolor}
328 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
329 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
330 \bottomrule
331 \SavedEndTab%
332 \if\given{#1}\caption{#1}\fi%
333 \if\given{#2}\label{#2}\fi%
334 \endcenter%
336 \center
337 \opt{HAVEREMOTEKEYMAP}{
338 % here is the table width defined for 3 columns
339 \tabularx{.95\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}>{\raggedright\arraybackslash}p{.2\textwidth}X}\toprule
341 \nopt{HAVEREMOTEKEYMAP}{
342 % here is the table width defined for 2 columns
343 \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule
345 \btnhead
347 \endtabularx