summaryrefslogtreecommitdiffstats
path: root/manual/preamble.tex
blob: 7b1927cee5ea895eb7715d9e99864ab49d668cb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
\documentclass[a4paper,11pt]{scrreprt}
\usepackage[latin1]{inputenc}
\usepackage{palatino}

\usepackage{tabularx}
\usepackage{multirow}
\usepackage{multicol}

\usepackage{float}
\floatstyle{ruled}

\usepackage{hyperref}

\usepackage{optional}

\input{platform/\platform.tex}

\newcommand{\playername}{\playerman\ \playerlongtype}

\hypersetup{% add some values to the pdf properties
  colorlinks = true,
  pdfstartview = FitV,
  linkcolor = blue,
  citecolor = blue,
  urlcolor = blue,
  pdftitle = {Rockbox user manual},
  pdfauthor = {The Rockbox Team},
  pdfsubject = {Rockbox user manual for \playername}
}

\newcommand{\fname}[1]{\texttt{#1}}
\newcommand{\tabeltc}[1]{{\centering #1 \par}}
\newcommand{\tabelth}[1]{{\centering \textbf{\textit{#1}} \par}}

\newcommand{\fixme}[1]{\textbf{\textcolor{red}{#1}}}

\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{verbatim}
\usepackage{makeidx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fancyvrb}
\usepackage{enumerate}
\usepackage{subfigure}
\usepackage{color}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{url}
\urlstyle{sf}
\usepackage{marvosym}
\usepackage{ifthen}

% new \ifpdf to check if running in pdf mode. Helps for html generation.
\newif\ifpdf\ifx\pdfoutput\undefined\pdffalse\else\pdfoutput=1\pdftrue\fi

% mark this ad draft version (only for pdflatex) -- comment this out at release
\ifpdf
  \usepackage{pdfdraftcopy}
  \draftstring{DRAFT VERSION}
%   \draftangle{45}
\fi

% fancy header style adjustments
%\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
%\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\renewcommand{\rightmark}[1]{\thechapter\ }
\fancyhead{}
\fancyfoot{}
\fancyhead[L]{{\textsc{\leftmark}}}
\fancyhead[R]{\iffloatpage{}{\thepage}}
\fancyfoot[L]{\textsc{The Rockbox manual}}
\fancyfoot[R]{\textsc{\playername}}

\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.4pt}}
\renewcommand{\footrulewidth}{\iffloatpage{0pt}{0.4pt}}
\setlength{\headheight}{18.5pt}
\newcounter{example}[chapter]

%% \newenvironment{example}
%%     {\stepcounter{example}\paragraph{Example \theexample:}}
%%     {\hfill$\Box$
    
%%     \bigskip
%%     \noindent}

% found on the internet, posting by Donald Arseneau
% I may as well include my robust expandable definions, which can be
% used in \edef or \write where the \def would not be executed:
%
% \if\blank --- checks if parameter is blank (Spaces count as blank)
% \if\given --- checks if parameter is not blank: like \if\blank{#1}\else
% \if\nil --- checks if parameter is null (spaces are NOT null)
% use \if\given{ } ... \else ... \fi etc.
%
{\catcode`\!=8 % funny catcode so ! will be a delimiter
\catcode`\Q=3 % funny catcode so Q will be a delimiter
\long\gdef\given#1{88\fi\Ifbl@nk#1QQQ\empty!}
\long\gdef\blank#1{88\fi\Ifbl@nk#1QQ..!}% if null or spaces
\long\gdef\nil#1{\IfN@Ught#1* {#1}!}% if null
\long\gdef\IfN@Ught#1 #2!{\blank{#2}}
\long\gdef\Ifbl@nk#1#2Q#3!{\ifx#3}% same as above
} 

% add screenshot image.
% Usage: \screenshot{filename}{caption}{label}
% By using the 'H' (HERE) placement, the screenshots are placed where
% we want them.
% Note: use this only for screenshots!
% Note: leave caption empty to supress it.
\newcommand{\screenshot}[3]{
  \begin{figure}[H]
    \begin{center}
      \IfFileExists{#1-\genericimg-\specimg.png}
        {\includegraphics[width=4cm]{#1-\genericimg-\specimg.png}
         \typeout{Note: device specific image used}}
        {\IfFileExists{#1-\genericimg.png}
          {\includegraphics[width=4cm]{#1-\genericimg.png}}
          {\IfFileExists{#1}
            {\includegraphics[width=4cm]{#1}
             \typeout{Warning: deprecated plain image name used}}%
            {\typeout{Missing image: #1 (\genericimg) (\specimg)}%
             \color{red}{\textbf{WARNING!} Image not found}%
            }
          }
        }
      \if\blank{#3}\else{\label{#3}}\fi\if\blank{#2}\else{%
        \caption{#2}}\fi
    \end{center}
  \end{figure}
}

% command to display a note.
% Usage: \note{text of your note}
% Note: do NOT use \textbf or similar to emphasize text, use \emph!
\newcommand{\note}[1]{
  \ifinner\else\par\noindent\fi
  \textbf{Note:}\ %
  \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Writinghand}}#1\par\fi%
}

% command to display a warning.
% Usage: \warn{text of your warning}
% Note: do NOT use \textbf or similar to emphasize text!
\newcommand{\warn}[1]{
  \ifinner\else\par\noindent\fi
  \textbf{Warning:\ }%
  \ifinner#1\else\marginpar{\raisebox{-6pt}{\Huge\Stopsign}}#1\par\fi%
}

% make table floats use "H" (as for screenshots) as default positioning
\makeatletter\renewcommand{\fps@table}{H}\makeatother
% change defaults for floats on a page as we have a lot of small images
\setcounter{topnumber}{3}    % default: 2
\setcounter{bottomnumber}{2} % default: 1
\setcounter{totalnumber}{5}  % default: 3

% command to set the default table heading for button lists
\newcommand{\btnhead}{\textbf{Key} & \textbf{Action} \\\midrule}

% environment intended to be used with button maps
% usage: \begin{btnmap}{caption}{label} Button & ButtonAction \\ \end{btnmap}
% Note: this automatically sets the table lines.
% Note: you *need* to terminate the last line with a linebreak \\
% Note: you still need to enclose this with \begin{table} / \end{table}
% Cheers for the usenet helping me building this up :)
\newenvironment{btnmap}[2]{%
  \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
  \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
    \bottomrule
    \SavedEndTab%
    \if\given{#1}\caption{#1}\fi%
    \if\given{#2}\label{#2}\fi%
    \endcenter%
  }
  \center
\tabularx{.75\textwidth}{lX}\toprule % here is the table width defined
  \btnhead
}{%
  \endtabularx
}

% command to set the default table heading for button lists
\newcommand{\taghead}{\textbf{Tag} & \textbf{Description} \\\midrule}

% environment intended to be used with tag maps (for wps)
% usage: \begin{tagmap}{caption}{label} Tag & Description \\ \end{btnmap}
% Note: this automatically sets the table lines.
% Note: you *need* to terminate the last line with a linebreak \\
% Note: you still need to enclose this with \begin{table} / \end{table}
% Cheers for the usenet helping me building this up :)
\newenvironment{tagmap}[2]{%
  \expandafter\let\expandafter\SavedEndTab\csname endtabular*\endcsname
  \expandafter\renewcommand\expandafter*\csname endtabular*\endcsname{%
    \bottomrule
    \SavedEndTab%
    \if\given{#1}\caption{#1}\fi%
    \if\given{#2}\label{#2}\fi%
    \endcenter%
  }
  \center
\tabularx{\textwidth}{lX}\toprule % here is the table width defined
  \taghead
}{%
  \endtabularx
}

\newcommand{\setting}[1]{\textsc{#1}}

\newcommand{\config}[1]{\texttt{#1}}

% set link to the wiki.
% Usage: \wikilink{WebHome}
%        with "WebHome" being the wiki page name
\newcommand{\wikilink}[1]{\url{http://www.rockbox.org/twiki/bin/view/Main/#1}}

% define environment "code" based on fancyvrb.
% use it to set code the user should type / see on his screen.
% Note: the first 4 characters of each line will be stripped,
%       requiring everything to be indendet by exactly _4_ spaces!
%       This is intended to make the LaTeX sources more readable.
% Note: when using the code environment you need to use optv instead of opt!
\DefineVerbatimEnvironment{code}{Verbatim}%
  {framerule=0.4pt, framesep=1ex,numbers=left,frame=lines,%
   gobble=4,fontsize=\footnotesize,xleftmargin=10pt,%
   label=\textnormal{\textsc{Code}},%
   commandchars=\\\{\}%
   }

% define environment "example" based on fancyvrb.
% use it to set example code the user should type / see on his screen.
% Note: the first 4 characters of each line will be stripped,
%       requiring everything to be indendet by exactly _4_ spaces!
%       This is intended to make the LaTeX sources more readable.
% Note: when using the example environment you need to use optv instead of opt!
\DefineVerbatimEnvironment{example}{Verbatim}%
  {commentchar=!,framerule=0.4pt, framesep=1ex,frame=lines,%
   gobble=4,fontsize=\footnotesize,xleftmargin=10pt,%
   label=\textnormal{\textsc{Example}},%
   commandchars=\\\{\}%
   }


% Use the nopt command to exclude a certain defined feature from a sectio
% Example:
% \nopt{ondio}{This text will be excluded for ondios}
\newcommand{\optnvalue}{0}
 \newcommand{\nopt}[2]{%
   \renewcommand{\optnvalue}{0}\opt{#1}{\renewcommand{\optnvalue}{1}}%
   \ifthenelse{\optnvalue > 0}{}{#2}
 }