Correctly compute the array size regardless of the element type
[kugel-rb/myfork.git] / manual / preamble.tex
blob0d0082e47ab9310cce126ff06fea7607e0b49da4
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 \input{platform/\platform.tex}
40 \input{features.tex}
42 \newcommand{\playername}{\playerman\ \playerlongtype}
44 \hypersetup{% add some values to the pdf properties
45 colorlinks = true,
46 pdfstartview = FitV,
47 linkcolor = blue,
48 citecolor = blue,
49 urlcolor = blue,
50 pdftitle = {Rockbox user manual},
51 pdfauthor = {The Rockbox Team},
52 pdfsubject = {Rockbox user manual for \playername}
55 \newcommand{\fname}[1]{\texttt{#1}}
56 \newcommand{\tabeltc}[1]{{\centering #1 \par}}
57 \newcommand{\tabelth}[1]{{\centering \textbf{\textit{#1}} \par}}
59 \newcommand{\fixme}[1]{\textbf{\textcolor{red}{#1}}}
61 \usepackage{fancyhdr}
62 \usepackage{graphicx}
63 \usepackage{verbatim}
64 \usepackage{makeidx}
65 \usepackage{fancyvrb}
66 \usepackage{enumerate}
67 \usepackage{color}
68 \ifpdfoutput{\usepackage{booktabs}}%
69 {\newcommand{%
70 \toprule}{}\newcommand{\midrule}{\hline}\newcommand{\bottomrule}{}%
72 \usepackage{longtable}
73 \usepackage{url}
74 \urlstyle{sf}
75 \usepackage{marvosym}
76 \usepackage{ifthen}
77 \usepackage{rotating}
79 % pdf output: try pdf first, then png and jpg as file format
80 % html output: try png first, then jpg. Ignore pdf files
81 % this only applies if no file extension is given!
82 \ifpdfoutput{\DeclareGraphicsExtensions{.pdf,.png,.jpg}}%
83 {\DeclareGraphicsExtensions{.png,.jpg}}
85 % fancy header style adjustments
86 \fancyhead{}
87 \fancyfoot{}
88 \fancyhead[L]{{\nouppercase{\textsc{\leftmark}}}}
89 \fancyhead[R]{\iffloatpage{}{\thepage}}
90 \fancyfoot[L]{\textsc{The Rockbox manual}}
91 \fancyfoot[R]{\textsc{\playerman{} \playertype}}
92 \fancypagestyle{plain}{}
94 \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
95 \renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}
96 \setlength{\headheight}{18.5pt}
97 \newcounter{example}[chapter]
99 %% \newenvironment{example}
100 %% {\stepcounter{example}\paragraph{Example \theexample:}}
101 %% {\hfill$\Box$
103 %% \bigskip
104 %% \noindent}
106 % found on the internet, posting by Donald Arseneau
107 % I may as well include my robust expandable definions, which can be
108 % used in \edef or \write where the \def would not be executed:
110 % \if\blank --- checks if parameter is blank (Spaces count as blank)
111 % \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
112 % \if\nil --- checks if parameter is null (spaces are NOT null)
113 % use \if\given{ } ... \else ... \fi etc.
115 {\catcode`\!=8 % funny catcode so ! will be a delimiter
116 \catcode`\Q=3 % funny catcode so Q will be a delimiter
117 \long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
118 \long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
119 \long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
120 \long\gdef\IfN@Ught#1 #2!{\blank{#2}}
121 \long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
124 % environment for setting the changelog.
125 \newenvironment{changelog}%
126 {\renewcommand{\labelitemi}{$\star$}\setitemize{noitemsep,topsep=0pt}%
127 \begin{itemize}}%
128 {\end{itemize}}
131 % add screenshot image.
132 % Usage: \screenshot{filename}{caption}{label}
133 % By using the 'H' (HERE) placement, the screenshots are placed where
134 % we want them.
135 % Note: use this only for screenshots!
136 % Note: leave caption empty to supress it.
137 \newcommand{\screenshot}[3]{
138 \begin{figure}[H]
139 \begin{center}
140 \IfFileExists{#1-\genericimg-\specimg.png}
141 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\specimg.png}
142 \typeout{Note: device specific image used}}
143 {\IfFileExists{#1-\genericimg.png}
144 {\includegraphics[width=\screenshotsize]{#1-\genericimg.png}}
145 {\IfFileExists{#1}
146 {\includegraphics[width=\screenshotsize]{#1}
147 \typeout{Warning: deprecated plain image name used}}%
148 {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
149 \color{red}{\textbf{WARNING!} Image not found}%
153 \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
154 \caption{#2}}\fi
155 \end{center}
156 \end{figure}
159 % command to display a note.
160 % Usage: \note{text of your note}
161 % Note: do NOT use \textbf or similar to emphasize text, use \emph!
162 \ifpdfoutput{
163 \newcommand{\note}[1]{
164 \ifinner\else\par\noindent\fi
165 \textbf{Note:}\ %
166 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\fi%
168 {\newcommand{\note}[1]{\ifinner\else\par\noindent\fi\textbf{Note:{} }#1\par}}
170 % command to display a warning.
171 % Usage: \warn{text of your warning}
172 % Note: do NOT use \textbf or similar to emphasize text!
173 \ifpdfoutput{
174 \newcommand{\warn}[1]{
175 \ifinner\else\par\noindent\fi
176 \textbf{Warning:\ }%
177 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
179 {\newcommand{\warn}[1]{\ifinner\else\par\noindent\fi\textbf{Warning:{} }#1}}
181 % command to mark a text block as intended especially for blind people
182 % Usage: \blind{text}
183 \ifpdfoutput{
184 \newcommand{\blind}[1]{
185 \ifinner\else\par\noindent\fi
186 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\ForwardToEnd}}#1\par\fi%
188 {\newcommand{\blind}[1]{\ifinner\else\par\noindent\fi#1}}
190 % make table floats use "H" (as for screenshots) as default positioning
191 \makeatletter\renewcommand{\fps@table}{H}\makeatother
192 % change defaults for floats on a page as we have a lot of small images
193 \setcounter{topnumber}{3} % default: 2
194 \setcounter{bottomnumber}{2} % default: 1
195 \setcounter{totalnumber}{5} % default: 3
201 % command to set the default table heading for button lists
202 \newcommand{\taghead}{\textbf{Tag} & \textbf{Description} \\\midrule}
204 % environment intended to be used with tag maps (for wps)
205 % usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{tagmap}
206 % Note: this automatically sets the table lines.
207 % Note: you *need* to terminate the last line with a linebreak \\
208 % Note: you still need to enclose this with \begin{table} / \end{table}
209 % Cheers for the usenet helping me building this up :)
210 \newenvironment{tagmap}[2]{%
211 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
212 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
213 \bottomrule
214 \SavedEndTab%
215 \if\given{#1}\caption{#1}\fi%
216 \if\given{#2}\label{#2}\fi%
217 \endcenter%
219 \center
220 \tabularx{\textwidth}{lX}\toprule % here is the table width defined
221 \taghead
223 \endtabularx
226 % When creating HTML, use the soul package.
227 % This produces much nicer HTML code (textsc results in each character being
228 % put in a separate <span>).
229 \ifpdfoutput{\newcommand{\caps}[1]{\textsc{#1}}}{\usepackage{soul}}
230 \newcommand{\setting}[1]{\caps{#1}}
232 \newcommand{\config}[1]{\texttt{#1}}
234 % set link to download server
235 % Usage: \download{bootloader/bootloader-ipodnano.ipod}
236 % gets expanded to
237 % "http://download.rockbox.org/bootloader/bootloader-ipodnano.ipod"
238 \newcommand{\download}[1]{\url{http://download.rockbox.org/#1}}
240 % set link to the wiki.
241 % Usage: \wikilink{WebHome}
242 % with "WebHome" being the wiki page name
243 \newcommand{\wikibaseurl}{http://www.rockbox.org/wiki/}
244 \ifpdfoutput{\newcommand{\wikiicon}{\Pointinghand}}
245 {\newcommand{\wikiicon}{}}
246 \newcommand{\wikilink}[1]{\wikiicon{}\href{\wikibaseurl#1}{#1}}
247 %\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/wiki/#1}}
249 % define environment "code" based on fancyvrb.
250 % use it to set code the user should type / see on his screen.
251 % Note: the first 4 characters of each line will be stripped,
252 % requiring everything to be indendet by exactly _4_ spaces!
253 % This is intended to make the LaTeX sources more readable.
254 % Note: when using the code environment you need to use optv instead of opt!
255 \DefineVerbatimEnvironment{code}{Verbatim}%
256 {framerule=0.4pt, framesep=1ex,frame=lines,%numbers=left,stepnumber=5,%
257 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
258 label=\textnormal{\textsc{Code}},%
259 commandchars=\\\{\}%
262 % define environment "example" based on fancyvrb.
263 % use it to set example code the user should type / see on his screen.
264 % Note: the first 4 characters of each line will be stripped,
265 % requiring everything to be indendet by exactly _4_ spaces!
266 % This is intended to make the LaTeX sources more readable.
267 % Note: when using the example environment you need to use optv instead of opt!
268 \DefineVerbatimEnvironment{example}{Verbatim}%
269 {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
270 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
271 label=\textnormal{\textsc{Example}},%
272 commandchars=\\\{\}%
275 % Use the nopt command to exclude a certain defined feature from a sectio
276 % Example:
277 % \nopt{ondio}{This text will be excluded for ondios}
278 \newcommand{\optnvalue}{0}
279 \newcommand{\nopt}[2]{%
280 \renewcommand{\optnvalue}{0}\opt{#1}{\renewcommand{\optnvalue}{1}}%
281 \ifthenelse{\optnvalue > 0}{}{#2}%
284 % Use the reference to handle get a flexible reference command
285 % usage \reference{ref_section}
286 \ifpdfoutput{%
287 \newcommand{\reference}[1]{%
288 section~\ref{#1} (page~\pageref{#1})%
290 {\newcommand{\reference}[1]{section~\ref{#1}}}
292 % special HTML output adjustments
293 \ifpdfoutput{}{\setlength{\parindent}{0mm}}
294 \ifpdfoutput{}{\renewcommand{\Forward}[1]{$\triangleright${}#1}}
296 \newcommand{\btnfnt}[1]{\textbf{#1}}
297 %\hfuzz=2pt
299 % generate index
300 \usepackage{makeidx}
301 \makeindex
304 % command to set the default table heading for button lists
305 \newcommand{\btnhead}{\textbf{Key} \opt{HAVEREMOTEKEYMAP}{%
306 & \textbf{Remote Key}} & \textbf{Action} \\\midrule}
307 % environment intended to be used with button maps
308 % usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
309 % Note: this automatically sets the table lines.
310 % Note: you *need* to terminate the last line with a linebreak \\
311 % Note: you still need to enclose this with \begin{table} / \end{table}
312 % Cheers for the usenet helping me building this up :)
314 % tabularx is set to be either two or three columns wide depending on whether
315 % HAVEREMOTEKEYMAP is defined in the platform file for the target in question.
316 % If it is, then every button table has three columns of the form
317 % Main Unit Key & Remote Key & Description \\
319 \newenvironment{btnmap}[2]{%
320 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
321 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
322 \bottomrule
323 \SavedEndTab%
324 \if\given{#1}\caption{#1}\fi%
325 \if\given{#2}\label{#2}\fi%
326 \endcenter%
328 \center
329 \opt{HAVEREMOTEKEYMAP}{
330 % here is the table width defined for 3 columns
331 \tabularx{.9\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}>{\raggedright\arraybackslash}p{.2\textwidth}X}\toprule
333 \nopt{HAVEREMOTEKEYMAP}{
334 % here is the table width defined for 2 columns
335 \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule
337 \btnhead
339 \endtabularx