Allow URLs to break at hyphens and allow more space at breaking characters.
[kugel-rb.git] / manual / preamble.tex
blob33fb365dbce774de0b77a859fc89ef25e9a3ecb9
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,hyphens]{scrreprt}
23 \usepackage[utf8]{inputenx}
24 \usepackage[T1]{fontenc}
25 % load ix-utf8enc.dfu to get additional characters from the inputenx package.
26 \makeatletter\input{ix-utf8enc.dfu}\makeatother
27 % This manual used to use Palatino as font. This caused issues with small caps
28 % (textsc), so do not use that font as default one anymore.
30 \usepackage{tabularx}
31 \usepackage{multirow}
32 \usepackage{multicol}
34 \usepackage{float}
35 \floatstyle{ruled}
37 \usepackage{hyperref}
38 \usepackage{enumitem}
40 \usepackage{optional}
42 \usepackage[table]{xcolor}
44 \input{platform/\platform.tex}
45 \input{features.tex}
47 \newcommand{\playername}{\playerman\ \playerlongtype}
49 \hypersetup{% add some values to the pdf properties
50 colorlinks = true,
51 pdfstartview = FitV,
52 linkcolor = blue,
53 citecolor = blue,
54 urlcolor = blue,
55 pdftitle = {Rockbox user manual},
56 pdfauthor = {The Rockbox Team},
57 pdfsubject = {Rockbox user manual for \playername}
60 \newcommand{\fname}[1]{\texttt{#1}}
61 \newcommand{\tabeltc}[1]{{\centering #1 \par}}
62 \newcommand{\tabelth}[1]{{\centering \textbf{\textit{#1}} \par}}
64 \newcommand{\fixme}[1]{\textbf{\textcolor{red}{#1}}}
66 % Colors used to typeset table headers and alternating table rows
67 \colorlet{tblhdrbgcolor}{blue!30} % Background color for headers
68 \colorlet{tbloddrowbgcolor}{blue!10} % Background color for odd rows (headers not included)
69 \colorlet{tblevenrowbgcolor}{white} % Background color for even rows (headers not included)
71 \usepackage{fancyhdr}
72 \usepackage{graphicx}
73 \usepackage{verbatim}
74 \usepackage{makeidx}
75 \usepackage{fancyvrb}
76 \usepackage{color}
77 \ifpdfoutput{\usepackage{booktabs}}%
78 {\newcommand{%
79 \toprule}{}\newcommand{\midrule}{\hline}\newcommand{\bottomrule}{}%
81 \usepackage{longtable}
82 \usepackage{url}
83 \urlstyle{sf}
84 \Urlmuskip = 0mu plus 1mu
85 \usepackage{marvosym}
86 \usepackage{rotating}
88 % pdf output: try pdf first, then png and jpg as file format
89 % html output: try png first, then jpg. Ignore pdf files
90 % this only applies if no file extension is given!
91 \ifpdfoutput{\DeclareGraphicsExtensions{.pdf,.png,.jpg}}%
92 {\DeclareGraphicsExtensions{.png,.jpg}}
94 % fancy header style adjustments
95 \fancyhead{}
96 \fancyfoot{}
97 \fancyhead[L]{{\nouppercase{\textsc{\leftmark}}}}
98 \fancyhead[R]{\iffloatpage{}{\thepage}}
99 \fancyfoot[L]{\textsc{The Rockbox manual}}
100 \fancyfoot[R]{\textsc{\playerman{} \playertype}}
101 \fancypagestyle{plain}{}
103 \renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
104 \renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}
105 \setlength{\headheight}{18.5pt}
106 \newcounter{example}[chapter]
108 \ifpdfoutput{%
109 \renewcommand{\toprule}{\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}}
110 \renewcommand{\midrule}{\specialrule{\lightrulewidth}{0pt}{\belowrulesep}}
112 \newcommand{\tblhdrstrut}{\rule[-1.3ex]{0mm}{4.0ex}}
115 %% \newenvironment{example}
116 %% {\stepcounter{example}\paragraph{Example \theexample:}}
117 %% {\hfill$\Box$
119 %% \bigskip
120 %% \noindent}
122 % found on the internet, posting by Donald Arseneau
123 % I may as well include my robust expandable definions, which can be
124 % used in \edef or \write where the \def would not be executed:
126 % \if\blank --- checks if parameter is blank (Spaces count as blank)
127 % \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
128 % \if\nil --- checks if parameter is null (spaces are NOT null)
129 % use \if\given{ } ... \else ... \fi etc.
131 {\catcode`\!=8 % funny catcode so ! will be a delimiter
132 \catcode`\Q=3 % funny catcode so Q will be a delimiter
133 \long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
134 \long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
135 \long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
136 \long\gdef\IfN@Ught#1 #2!{\blank{#2}}
137 \long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
140 % environment for setting the changelog.
141 \newenvironment{changelog}%
142 {\renewcommand{\labelitemi}{$\star$}\setitemize{noitemsep,topsep=0pt}%
143 \begin{itemize}}%
144 {\end{itemize}}
147 \newcommand{\dapdisplaysize}{\dapdisplaywidth$\times$\dapdisplayheight$\times$\dapdisplaydepth}
148 \newcommand{\genericimg}{\dapdisplaywidth x\dapdisplayheight x\dapdisplaydepth}
150 % add screenshot image.
151 % Usage: \screenshot{filename}{caption}{label}
152 % By using the 'H' (HERE) placement, the screenshots are placed where
153 % we want them.
154 % Note: use this only for screenshots!
155 % Note: leave caption empty to supress it.
156 % Resulting file names in the source should consist of up to 3 parts
157 % "filename-\genericimg-[\specimg|\seriesimg]" (the third is optional)
158 % filename is specified by the use of this macro in the tex file
159 % \genericimg will be generated using the display's resolution (see above)
160 % \specimg or \seriesimg are possible options set in the platform files
161 % Files will be used in the following order: 1.filename contains \specimg part
162 % 2. filename contains \seriesimg part, 3. filename without the third part
164 % set seriesimg if it isn't defined in the platform file to not break manuals
165 \ifdefined\seriesimg
166 \else
167 \newcommand{\seriesimg}{\specimg}
170 \newcommand{\screenshot}[3]{
171 \begin{figure}[H]
172 \begin{center}
173 \IfFileExists{#1-\genericimg-\specimg.png}
174 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\specimg.png}
175 \typeout{Note: device specific image used}}
176 {\IfFileExists{#1-\genericimg-\seriesimg.png}
177 {\includegraphics[width=\screenshotsize]{#1-\genericimg-\seriesimg.png}
178 \typeout{Note: series specific image used}}
179 {\IfFileExists{#1-\genericimg.png}
180 {\includegraphics[width=\screenshotsize]{#1-\genericimg.png}}
181 {\IfFileExists{#1}
182 {\includegraphics[width=\screenshotsize]{#1}
183 \typeout{Warning: deprecated plain image name used}}%
184 {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
185 \color{red}{\textbf{WARNING!} Image not found}%
190 \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
191 \caption{#2}}\fi
192 \end{center}
193 \end{figure}
196 % command to display a note.
197 % Usage: \note{text of your note}
198 % Note: do NOT use \textbf or similar to emphasize text, use \emph!
199 \ifpdfoutput{
200 \newcommand{\note}[1]{
201 \ifinner\else\vspace{1ex}\par\noindent\fi
202 \textbf{Note:}\ %
203 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\vspace{1ex}\fi%
205 {\newcommand{\note}[1]{\ifinner\else\par\noindent\fi\textbf{Note:{} }#1\par}}
207 % command to display a warning.
208 % Usage: \warn{text of your warning}
209 % Note: do NOT use \textbf or similar to emphasize text!
210 \ifpdfoutput{
211 \newcommand{\warn}[1]{
212 \ifinner\else\par\noindent\fi
213 \textbf{Warning:\ }%
214 \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
216 {\newcommand{\warn}[1]{\ifinner\else\par\noindent\fi\textbf{Warning:{} }#1}}
218 % command to mark a text block as intended especially for blind people
219 % Usage: \blind{text}
220 \ifpdfoutput{
221 \newcommand{\blind}[1]{\mbox{}\marginpar{\raisebox{-1ex}{\Huge{\ForwardToEnd}}}#1}
223 {\newcommand{\blind}[1]{\ifinner\else\par\noindent\fi#1}}
225 % make table floats use "H" (as for screenshots) as default positioning
226 \makeatletter\renewcommand{\fps@table}{H}\makeatother
227 % change defaults for floats on a page as we have a lot of small images
228 \setcounter{topnumber}{3} % default: 2
229 \setcounter{bottomnumber}{2} % default: 1
230 \setcounter{totalnumber}{5} % default: 3
233 % Environment for typesetting tables in a consistent way. The header has
234 % a darker background; rows are white and light gray (alternating). Top,
235 % middle and bottom rules are automatically set.
237 % Params:
238 % #1 -- table width
239 % #2 -- column specification (as used in the package tabularx)
240 % #3 -- contents of the header row. The number of items must
241 % match the number of specs in #2
242 % #4 -- caption (optional). If used then this must be inside a floating
243 % environment, e.g. table
244 % #5 -- label (optional)
246 % Example:
247 % \begin{rbtabular}{0.9\textwidth}{lX}{Col1 & Col2}{}{}
248 % A1 & A2\\
249 % B1 & B2\\
250 % C1 & C2\\
251 % \end{rbtabular}
253 \newenvironment{rbtabular}[5]{%
254 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
255 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
256 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
257 \bottomrule
258 \SavedEndTab%
259 \if\given{#4}\caption{#4}\fi%
260 \if\given{#5}\label{#5}\fi%
261 \endcenter%
263 \center
264 \tabularx{#1}{#2}\toprule\rowcolor{tblhdrbgcolor}
265 \tblhdrstrut#3\\\midrule
267 \endtabularx
270 \newcommand{\tabnlindent}{\newline\mbox{ }\mbox{ }}
274 % command to set the default table heading for button lists
275 \newcommand{\taghead}{\tblhdrstrut\textbf{Tag} & \textbf{Description} \\\midrule}
277 % environment intended to be used with tag maps (for wps)
278 % usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{tagmap}
279 % Note: this automatically sets the table lines.
280 % Note: you *need* to terminate the last line with a linebreak \\
281 % Cheers for the usenet helping me building this up :)
282 \newenvironment{tagmap}{%
283 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
284 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
285 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
286 \bottomrule
287 \SavedEndTab%
288 \endcenter%
290 \center
291 \tabularx{\textwidth}{Xp{.7\textwidth}}\toprule\rowcolor{tblhdrbgcolor} % here is the table width defined
292 \taghead
294 \endtabularx
297 % When creating HTML, use the soul package.
298 % This produces much nicer HTML code (textsc results in each character being
299 % put in a separate <span>).
300 \ifpdfoutput{\newcommand{\caps}[1]{\textsc{#1}}}{\usepackage{soul}}
301 \newcommand{\setting}[1]{\caps{#1}}
303 \newcommand{\config}[1]{\texttt{#1}}
305 % set link to download server
306 % Usage: \download{bootloader/bootloader-ipodnano.ipod}
307 % gets expanded to
308 % "http://download.rockbox.org/bootloader/bootloader-ipodnano.ipod"
309 \newcommand{\download}[1]{\url{http://download.rockbox.org/#1}}
311 % set link to the wiki.
312 % Usage: \wikilink{WebHome}
313 % with "WebHome" being the wiki page name
314 \newcommand{\wikibaseurl}{http://www.rockbox.org/wiki/}
315 \ifpdfoutput{\newcommand{\wikiicon}{\Pointinghand}}
316 {\newcommand{\wikiicon}{}}
317 \newcommand{\wikilink}[1]{\wikiicon{}\href{\wikibaseurl#1}{#1}}
318 %\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/wiki/#1}}
320 % define environment "code" based on fancyvrb.
321 % use it to set 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 code environment you need to use optv instead of opt!
326 \DefineVerbatimEnvironment{code}{Verbatim}%
327 {framerule=0.4pt, framesep=1ex,frame=lines,%numbers=left,stepnumber=5,%
328 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
329 label=\textnormal{\textsc{Code}},%
330 commandchars=\\\{\}%
333 % define environment "example" based on fancyvrb.
334 % use it to set example code the user should type / see on his screen.
335 % Note: the first 4 characters of each line will be stripped,
336 % requiring everything to be indendet by exactly _4_ spaces!
337 % This is intended to make the LaTeX sources more readable.
338 % Note: when using the example environment you need to use optv instead of opt!
339 \DefineVerbatimEnvironment{example}{Verbatim}%
340 {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
341 gobble=4,fontsize=\footnotesize,xleftmargin=10pt,xrightmargin=10pt,%
342 label=\textnormal{\textsc{Example}},%
343 commandchars=\\\{\}%
346 % Use the nopt command to exclude a certain defined feature from a section
347 % Example:
348 % \nopt{ondio}{This text will be excluded for ondios}
349 \makeatletter
350 \newcommand*\nopt[1]{\if\Opl@notlisted{#1}\expandafter\@firstofone
351 \else \expandafter\@gobble \fi}
352 \makeatother
354 % Use the reference to handle get a flexible reference command
355 % usage \reference{ref_section}
356 \ifpdfoutput{%
357 \newcommand{\reference}[1]{%
358 section~\ref{#1} (page~\pageref{#1})%
360 {\newcommand{\reference}[1]{section~\ref{#1}}}
362 % special HTML output adjustments
363 \ifpdfoutput{}{\setlength{\parindent}{0mm}}
364 \ifpdfoutput{}{\renewcommand{\Forward}[1]{$\triangleright${}#1}}
366 \newcommand{\btnfnt}[1]{\textbf{#1}}
367 %\hfuzz=2pt
369 % generate index
370 \usepackage{makeidx}
371 \makeindex
374 % command to set the default table heading for button lists
375 \newcommand{\btnhead}{\textbf{Key} \opt{HAVEREMOTEKEYMAP}{%
376 & \textbf{Remote Key}} & \textbf{Action} \\\midrule}
377 % environment intended to be used with button maps
378 % usage: \begin{btnmap} Button & ButtonAction \\ \end{btnmap}
379 % Note: this automatically sets the table lines.
380 % Note: you *need* to terminate the last line with a linebreak \\
381 % Cheers for the usenet helping me building this up :)
383 % tabularx is set to be either two or three columns wide depending on whether
384 % HAVEREMOTEKEYMAP is defined in the platform file for the target in question.
385 % If it is, then every button table has three columns of the form
386 % Main Unit Key & Remote Key & Description \\
388 \newenvironment{btnmap}{%
389 \rowcolors{2}{tbloddrowbgcolor}{tblevenrowbgcolor}
390 \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
391 \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
392 \bottomrule
393 \SavedEndTab%
394 \endcenter\vspace{2ex}%
396 \vspace{2ex}\center
397 \opt{HAVEREMOTEKEYMAP}{
398 % here is the table width defined for 3 columns
399 \tabularx{.95\textwidth}{>{\raggedright\arraybackslash}p{.2\textwidth}>{\raggedright\arraybackslash}p{.2\textwidth}X}\toprule\rowcolor{tblhdrbgcolor}
401 \nopt{HAVEREMOTEKEYMAP}{
402 % here is the table width defined for 2 columns
403 \tabularx{.75\textwidth}{>{\raggedright\arraybackslash}p{.22\textwidth}X}\toprule\rowcolor{tblhdrbgcolor}
405 \tblhdrstrut\btnhead
407 \endtabularx