Allow 'long' labels with single-argument %xd too. The label need to be at least 3...
[kugel-rb.git] / manual / preamble.tex
blob5394c63bf1135dbcd66f0ff937c0e0144c3587f0
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 \usepackage[T1]{fontenc}
25 % This manual used to use Palatino as font. This caused issues with small caps
26 % (textsc), so do not use that font as default one anymore.
28 \usepackage{tabularx}
29 \usepackage{multirow}
30 \usepackage{multicol}
32 \usepackage{float}
33 \floatstyle{ruled}
35 \usepackage{hyperref}
36 \usepackage{enumitem}
38 \usepackage{optional}
40 \usepackage[table]{xcolor}
42 \input{platform/\platform.tex}
43 \input{features.tex}
45 \newcommand{\playername}{\playerman\ \playerlongtype}
47 \hypersetup{% add some values to the pdf properties
48 colorlinks = true,
49 pdfstartview = FitV,
50 linkcolor = blue,
51 citecolor = blue,
52 urlcolor = blue,
53 pdftitle = {Rockbox user manual},
54 pdfauthor = {The Rockbox Team},
55 pdfsubject = {Rockbox user manual for \playername}
58 \newcommand{\fname}[1]{\texttt{#1}}
59 \newcommand{\tabeltc}[1]{{\centering #1 \par}}
60 \newcommand{\tabelth}[1]{{\centering \textbf{\textit{#1}} \par}}
62 \newcommand{\fixme}[1]{\textbf{\textcolor{red}{#1}}}
64 % Colors used to typeset table headers and alternating table rows
65 \colorlet{tblhdrbgcolor}{blue!30} % Background color for headers
66 \colorlet{tbloddrowbgcolor}{blue!10} % Background color for odd rows (headers not included)
67 \colorlet{tblevenrowbgcolor}{white} % Background color for even rows (headers not included)
69 \usepackage{fancyhdr}
70 \usepackage{graphicx}
71 \usepackage{verbatim}
72 \usepackage{makeidx}
73 \usepackage{fancyvrb}
74 \usepackage{color}
75 \ifpdfoutput{\usepackage{booktabs}}%
76 {\newcommand{%
77 \toprule}{}\newcommand{\midrule}{\hline}\newcommand{\bottomrule}{}%
79 \usepackage{longtable}
80 \usepackage{url}
81 \urlstyle{sf}
82 \usepackage{marvosym}
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 \ifpdfoutput{%
106 \renewcommand{\toprule}{\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}}
107 \renewcommand{\midrule}{\specialrule{\lightrulewidth}{0pt}{\belowrulesep}}
109 \newcommand{\tblhdrstrut}{\rule[-1.3ex]{0mm}{4.0ex}}
112 %% \newenvironment{example}
113 %% {\stepcounter{example}\paragraph{Example \theexample:}}
114 %% {\hfill$\Box$
116 %% \bigskip
117 %% \noindent}
119 % found on the internet, posting by Donald Arseneau
120 % I may as well include my robust expandable definions, which can be
121 % used in \edef or \write where the \def would not be executed:
123 % \if\blank --- checks if parameter is blank (Spaces count as blank)
124 % \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
125 % \if\nil --- checks if parameter is null (spaces are NOT null)
126 % use \if\given{ } ... \else ... \fi etc.
128 {\catcode`\!=8 % funny catcode so ! will be a delimiter
129 \catcode`\Q=3 % funny catcode so Q will be a delimiter
130 \long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
131 \long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
132 \long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
133 \long\gdef\IfN@Ught#1 #2!{\blank{#2}}
134 \long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
137 % environment for setting the changelog.
138 \newenvironment{changelog}%
139 {\renewcommand{\labelitemi}{$\star$}\setitemize{noitemsep,topsep=0pt}%
140 \begin{itemize}}%
141 {\end{itemize}}
144 \newcommand{\dapdisplaysize}{\dapdisplaywidth$\times$\dapdisplayheight$\times$\dapdisplaydepth}
145 \newcommand{\genericimg}{\dapdisplaywidth x\dapdisplayheight x\dapdisplaydepth}
147 % add screenshot image.
148 % Usage: \screenshot{filename}{caption}{label}
149 % By using the 'H' (HERE) placement, the screenshots are placed where
150 % we want them.
151 % Note: use this only for screenshots!
152 % Note: leave caption empty to supress it.
153 % Resulting file names in the source should consist of up to 3 parts
154 % "filename-\genericimg-[\specimg|\seriesimg]" (the third is optional)
155 % filename is specified by the use of this macro in the tex file
156 % \genericimg will be generated using the display's resolution (see above)
157 % \specimg or \seriesimg are possible options set in the platform files
158 % Files will be used in the following order: 1.filename contains \specimg part
159 % 2. filename contains \seriesimg part, 3. filename without the third part
161 % set seriesimg if it isn't defined in the platform file to not break manuals
162 \ifdefined\seriesimg
163 \else
164 \newcommand{\seriesimg}{\specimg}
167 \newcommand{\screenshot}[3]{
168 \begin{figure}[H]
169 \begin{center}
170 \IfFileExists{#1-\genericimg-\specimg.png}
171 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\specimg.png}
172 \typeout{Note: device specific image used}}
173 {\IfFileExists{#1-\genericimg-\seriesimg.png}
174 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\seriesimg.png}
175 \typeout{Note: series specific image used}}
176 {\IfFileExists{#1-\genericimg.png}
177 {\includegraphics[width=\screenshotsize]{#1-\genericimg.png}}
178 {\IfFileExists{#1}
179 {\includegraphics[width=\screenshotsize]{#1}
180 \typeout{Warning: deprecated plain image name used}}%
181 {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
182 \color{red}{\textbf{WARNING!} Image not found}%
187 \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
188 \caption{#2}}\fi
189 \end{center}
190 \end{figure}
193 % command to display a note.
194 % Usage: \note{text of your note}
195 % Note: do NOT use \textbf or similar to emphasize text, use \emph!
196 \ifpdfoutput{
197 \newcommand{\note}[1]{
198 \ifinner\else\vspace{1ex}\par\noindent\fi
199 \textbf{Note:}\ %
200 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\vspace{1ex}\fi%
202 {\newcommand{\note}[1]{\ifinner\else\par\noindent\fi\textbf{Note:{} }#1\par}}
204 % command to display a warning.
205 % Usage: \warn{text of your warning}
206 % Note: do NOT use \textbf or similar to emphasize text!
207 \ifpdfoutput{
208 \newcommand{\warn}[1]{
209 \ifinner\else\par\noindent\fi
210 \textbf{Warning:\ }%
211 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
213 {\newcommand{\warn}[1]{\ifinner\else\par\noindent\fi\textbf{Warning:{} }#1}}
215 % command to mark a text block as intended especially for blind people
216 % Usage: \blind{text}
217 \ifpdfoutput{
218 \newcommand{\blind}[1]{\mbox{}\marginpar{\raisebox{-1ex}{\Huge{\ForwardToEnd}}}#1}
220 {\newcommand{\blind}[1]{\ifinner\else\par\noindent\fi#1}}
222 % make table floats use "H" (as for screenshots) as default positioning
223 \makeatletter\renewcommand{\fps@table}{H}\makeatother
224 % change defaults for floats on a page as we have a lot of small images
225 \setcounter{topnumber}{3} % default: 2
226 \setcounter{bottomnumber}{2} % default: 1
227 \setcounter{totalnumber}{5} % default: 3
230 % Environment for typesetting tables in a consistent way. The header has
231 % a darker background; rows are white and light gray (alternating). Top,
232 % middle and bottom rules are automatically set.
234 % Params:
235 % #1 -- table width
236 % #2 -- column specification (as used in the package tabularx)
237 % #3 -- contents of the header row. The number of items must
238 % match the number of specs in #2
239 % #4 -- caption (optional). If used then this must be inside a floating
240 % environment, e.g. table
241 % #5 -- label (optional)
243 % Example:
244 % \begin{rbtabular}{0.9\textwidth}{lX}{Col1 & Col2}{}{}
245 % A1 & A2\\
246 % B1 & B2\\
247 % C1 & C2\\
248 % \end{rbtabular}
250 \newenvironment{rbtabular}[5]{%
251 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
252 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
253 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
254 \bottomrule
255 \SavedEndTab%
256 \if\given{#4}\caption{#4}\fi%
257 \if\given{#5}\label{#5}\fi%
258 \endcenter%
260 \center
261 \tabularx{#1}{#2}\toprule\rowcolor{tblhdrbgcolor}
262 \tblhdrstrut#3\\\midrule
264 \endtabularx
267 \newcommand{\tabnlindent}{\newline\mbox{ }\mbox{ }}
271 % command to set the default table heading for button lists
272 \newcommand{\taghead}{\tblhdrstrut\textbf{Tag} & \textbf{Description} \\\midrule}
274 % environment intended to be used with tag maps (for wps)
275 % usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{tagmap}
276 % Note: this automatically sets the table lines.
277 % Note: you *need* to terminate the last line with a linebreak \\
278 % Cheers for the usenet helping me building this up :)
279 \newenvironment{tagmap}{%
280 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
281 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
282 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
283 \bottomrule
284 \SavedEndTab%
285 \endcenter%
287 \center
288 \tabularx{\textwidth}{Xp{.7\textwidth}}\toprule\rowcolor{tblhdrbgcolor} % here is the table width defined
289 \taghead
291 \endtabularx
294 % When creating HTML, use the soul package.
295 % This produces much nicer HTML code (textsc results in each character being
296 % put in a separate <span>).
297 \ifpdfoutput{\newcommand{\caps}[1]{\textsc{#1}}}{\usepackage{soul}}
298 \newcommand{\setting}[1]{\caps{#1}}
300 \newcommand{\config}[1]{\texttt{#1}}
302 % set link to download server
303 % Usage: \download{bootloader/bootloader-ipodnano.ipod}
304 % gets expanded to
305 % "http://download.rockbox.org/bootloader/bootloader-ipodnano.ipod"
306 \newcommand{\download}[1]{\url{http://download.rockbox.org/#1}}
308 % set link to the wiki.
309 % Usage: \wikilink{WebHome}
310 % with "WebHome" being the wiki page name
311 \newcommand{\wikibaseurl}{http://www.rockbox.org/wiki/}
312 \ifpdfoutput{\newcommand{\wikiicon}{\Pointinghand}}
313 {\newcommand{\wikiicon}{}}
314 \newcommand{\wikilink}[1]{\wikiicon{}\href{\wikibaseurl#1}{#1}}
315 %\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/wiki/#1}}
317 % define environment "code" based on fancyvrb.
318 % use it to set code the user should type / see on his screen.
319 % Note: the first 4 characters of each line will be stripped,
320 % requiring everything to be indendet by exactly _4_ spaces!
321 % This is intended to make the LaTeX sources more readable.
322 % Note: when using the code environment you need to use optv instead of opt!
323 \DefineVerbatimEnvironment{code}{Verbatim}%
324 {framerule=0.4pt, framesep=1ex,frame=lines,%numbers=left,stepnumber=5,%
325 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
326 label=\textnormal{\textsc{Code}},%
327 commandchars=\\\{\}%
330 % define environment "example" based on fancyvrb.
331 % use it to set example code the user should type / see on his screen.
332 % Note: the first 4 characters of each line will be stripped,
333 % requiring everything to be indendet by exactly _4_ spaces!
334 % This is intended to make the LaTeX sources more readable.
335 % Note: when using the example environment you need to use optv instead of opt!
336 \DefineVerbatimEnvironment{example}{Verbatim}%
337 {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
338 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
339 label=\textnormal{\textsc{Example}},%
340 commandchars=\\\{\}%
343 % Use the nopt command to exclude a certain defined feature from a section
344 % Example:
345 % \nopt{ondio}{This text will be excluded for ondios}
346 \makeatletter
347 \newcommand*\nopt[1]{\if\Opl@notlisted{#1}\expandafter\@firstofone
348 \else \expandafter\@gobble \fi}
349 \makeatother
351 % Use the reference to handle get a flexible reference command
352 % usage \reference{ref_section}
353 \ifpdfoutput{%
354 \newcommand{\reference}[1]{%
355 section~\ref{#1} (page~\pageref{#1})%
357 {\newcommand{\reference}[1]{section~\ref{#1}}}
359 % special HTML output adjustments
360 \ifpdfoutput{}{\setlength{\parindent}{0mm}}
361 \ifpdfoutput{}{\renewcommand{\Forward}[1]{$\triangleright${}#1}}
363 \newcommand{\btnfnt}[1]{\textbf{#1}}
364 %\hfuzz=2pt
366 % generate index
367 \usepackage{makeidx}
368 \makeindex
371 % command to set the default table heading for button lists
372 \newcommand{\btnhead}{\textbf{Key} \opt{HAVEREMOTEKEYMAP}{%
373 & \textbf{Remote Key}} & \textbf{Action} \\\midrule}
374 % environment intended to be used with button maps
375 % usage: \begin{btnmap} Button & ButtonAction \\ \end{btnmap}
376 % Note: this automatically sets the table lines.
377 % Note: you *need* to terminate the last line with a linebreak \\
378 % Cheers for the usenet helping me building this up :)
380 % tabularx is set to be either two or three columns wide depending on whether
381 % HAVEREMOTEKEYMAP is defined in the platform file for the target in question.
382 % If it is, then every button table has three columns of the form
383 % Main Unit Key & Remote Key & Description \\
385 \newenvironment{btnmap}{%
386 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
387 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
388 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
389 \bottomrule
390 \SavedEndTab%
391 \endcenter\vspace{2ex}%
393 \vspace{2ex}\center
394 \opt{HAVEREMOTEKEYMAP}{
395 % here is the table width defined for 3 columns
396 \tabularx{.95\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}>{\raggedright\arraybackslash}p{.2\textwidth}X}\toprule\rowcolor{tblhdrbgcolor}
398 \nopt{HAVEREMOTEKEYMAP}{
399 % here is the table width defined for 2 columns
400 \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule\rowcolor{tblhdrbgcolor}
402 \tblhdrstrut\btnhead
404 \endtabularx