~mattgriffin/ubuntu-manual/10.10-updated-u1-content

1 by Kevin Godby
* Initial import of files.
1
%
2
% This document class style is used with the Ubuntu Manual.
3
% https://wiki.ubuntu.com/ubuntu-manual/
4
% https://launchpad.net/ubuntu-manual
5
%
6
7
%
8
% Idenfification
9
%
10
11
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
12
13
\ProvidesClass{ubuntu-manual}[2010/01/12 v0.0.9 Ubuntu manual document class]
14
15
\RequirePackage{xkeyval}
16
\RequirePackage{xifthen}
17
\RequirePackage{ifpdf}
18
\IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}}{\ClassError{ubuntu-manual}{The ifxetex package is missing.\MessageBreak Run the install-pkgs.sh script again}{The ifxetex package is required but is not installed.\MessageBreak Run the install-pkgs.sh script to install it.}}
19
\RequireXeTeX% XeTeX is required now
20
%\RequirePackage[utf8]{inputenc}
21
22
%
23
% Declaration of options
24
%
25
26
\newboolean{@ubuntu@debug}
27
\DeclareOptionX<ubuntu-manual>{debug}{\setboolean{@ubuntu@debug}{true}}
28
29
% Current languages
30
\providecommand*{\@ubuntu@script}{Latin}
31
\providecommand*{\@ubuntu@language}{english}
32
\providecommand*{\@ubuntu@language@options}{}
33
\providecommand*{\@ubuntu@language@code}{en}
34
\providecommand*{\@ubuntu@xindy@language}{}
35
\define@key{ubuntu-manual}{lang}[default]{%
36
  \ClassInfo{ubuntu-manual}{Specified language is: #1}%
37
  \renewcommand*{\@ubuntu@language@code}{\detokenize{#1}}%
38
  \ifthenelse{\equal{#1}{en}}   {\ExecuteOptionsX<ubuntu-manual>{letterpaper}\ExecuteOptionsX<ubuntu-manual>{USenglish}\renewcommand*{\@ubuntu@language}{USenglish}}{}% English (US)
39
  \ifthenelse{\equal{#1}{en_US}}{\ExecuteOptionsX<ubuntu-manual>{letterpaper}\ExecuteOptionsX<ubuntu-manual>{USenglish}\renewcommand*{\@ubuntu@language}{USenglish}}{}% English (US)
40
  \ifthenelse{\equal{#1}{af}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{afrikaans}\RequireXeTeX\renewcommand*{\@ubuntu@language}{afrikaans}}{}% Afrikaans
41
  \ifthenelse{\equal{#1}{am}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{amharic}\RequireXeTeX\renewcommand*{\@ubuntu@language}{amharic}}{}% Amharic
42
  \ifthenelse{\equal{#1}{ar}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{arabic}\RequireXeTeX\renewcommand*{\@ubuntu@language}{arabic}\PassOptionsToPackage{RTLdocument}{bidi}\PassOptionsToClass{bidi}{tufte-book}}{}% Arabic
43
  \ifthenelse{\equal{#1}{ast}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{asturian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{asturian}}{}% Asturian
44
  \ifthenelse{\equal{#1}{bg}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{bulgarian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{bulgarian}}{}% Bulgarian
45
  \ifthenelse{\equal{#1}{bn}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{bengali}\RequireXeTeX\renewcommand*{\@ubuntu@language}{bengali}}{}% Bengali
46
  \ifthenelse{\equal{#1}{br}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{breton}\RequireXeTeX\renewcommand*{\@ubuntu@language}{breton}}{}% Breton
47
  \ifthenelse{\equal{#1}{cop}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{coptic}\RequireXeTeX\renewcommand*{\@ubuntu@language}{coptic}}{}% Coptic
48
  \ifthenelse{\equal{#1}{ca}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{catalan}\RequireXeTeX\renewcommand*{\@ubuntu@language}{catalan}}{}% Catalan
49
  \ifthenelse{\equal{#1}{cs}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{czech}\RequireXeTeX\renewcommand*{\@ubuntu@language}{czech}}{}% Czech
50
  \ifthenelse{\equal{#1}{cy}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{welsh}\RequireXeTeX\renewcommand*{\@ubuntu@language}{welsh}}{}% Welsh
51
  \ifthenelse{\equal{#1}{da}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{danish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{danish}}{}% Danish
52
  \ifthenelse{\equal{#1}{de}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{german}\RequireXeTeX\renewcommand*{\@ubuntu@language}{german}\renewcommand*{\@ubuntu@xindy@language}{german-din}}{}% German
53
  \ifthenelse{\equal{#1}{dsb}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{lsorbian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{lsorbian}}{}% Lower Sorbian
54
  \ifthenelse{\equal{#1}{dv}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{divehi}\RequireXeTeX\renewcommand*{\@ubuntu@language}{divehi}}{}% Divehi
55
  \ifthenelse{\equal{#1}{el}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{greek}\RequireXeTeX\renewcommand*{\@ubuntu@language}{greek}}{}% Greek
56
  \ifthenelse{\equal{#1}{en_AU}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{australian}\renewcommand*{\@ubuntu@language}{australian}}{}% English (Australian)
57
  \ifthenelse{\equal{#1}{en_GB}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{UKenglish}\renewcommand*{\@ubuntu@language}{UKenglish}}{}% English (United Kingdom)
58
  \ifthenelse{\equal{#1}{eo}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{esperanto}\RequireXeTeX\renewcommand*{\@ubuntu@language}{esperanto}}{}% Esperanto
59
  \ifthenelse{\equal{#1}{es}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{spanish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{spanish}}{}% Spanish
60
  \ifthenelse{\equal{#1}{et}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{estonian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{estonian}}{}% Estonian
61
  \ifthenelse{\equal{#1}{eu}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{basque}\RequireXeTeX\renewcommand*{\@ubuntu@language}{basque}}{}% Basque
62
  \ifthenelse{\equal{#1}{fi}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{finnish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{finnish}}{}% Finnish
63
  \ifthenelse{\equal{#1}{fa}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{farsi}\RequireXeTeX\renewcommand*{\@ubuntu@language}{farsi}}{}% Persian
64
  \ifthenelse{\equal{#1}{fr}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{french}\RequireXeTeX\renewcommand*{\@ubuntu@language}{french}}{}% French
65
  \ifthenelse{\equal{#1}{ga}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{irish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{irish}}{}% Irish
66
  \ifthenelse{\equal{#1}{gd}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{scottish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{scottish}}{}% Scottish
67
  \ifthenelse{\equal{#1}{gl}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{galician}\RequireXeTeX\renewcommand*{\@ubuntu@language}{galician}}{}% Galician
68
  %\ifthenelse{\equal{#1}{grc}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{greek}\RequireXeTeX\renewcommand{\@ubuntu@language@options}{variant=ancient}\renewcommand*{\@ubuntu@language}{greek}}{}% Ancient Greek (to 1453)
69
  \ifthenelse{\equal{#1}{grc}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{greek}\RequireXeTeX\renewcommand*{\@ubuntu@language}{ancientgreek}}{}% Ancient Greek (to 1453)
70
  \ifthenelse{\equal{#1}{he}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{hebrew}\RequireXeTeX\renewcommand*{\@ubuntu@language}{hebrew}}{}% Hebrew
71
  \ifthenelse{\equal{#1}{hi}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{hindi}\RequireXeTeX\renewcommand*{\@ubuntu@language}{hindi}}{}% Hindi
72
  \ifthenelse{\equal{#1}{hr}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{croatian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{croatian}}{}% Croatian
73
  \ifthenelse{\equal{#1}{hsb}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{usorbian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{usorbian}}{}% Upper Sorbian
74
  \ifthenelse{\equal{#1}{hu}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{magyar}\RequireXeTeX\renewcommand*{\@ubuntu@language}{magyar}}{}% Hungarian
75
  \ifthenelse{\equal{#1}{ia}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{interlingua}\RequireXeTeX\renewcommand*{\@ubuntu@language}{interlingua}}{}% Interlingua
76
  \ifthenelse{\equal{#1}{id}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{bahasai}\RequireXeTeX\renewcommand*{\@ubuntu@language}{bahasai}}{}% Indonesian
77
  \ifthenelse{\equal{#1}{is}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{icelandic}\RequireXeTeX\renewcommand*{\@ubuntu@language}{icelandic}}{}% Icelandic
78
  \ifthenelse{\equal{#1}{it}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{italian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{italian}}{}% Italian
79
  \ifthenelse{\equal{#1}{ja}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{japanese}\RequireXeTeX\renewcommand*{\@ubuntu@language}{japanese}}{}% Japanese
80
  \ifthenelse{\equal{#1}{ko}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{korean}\RequireXeTeX\renewcommand*{\@ubuntu@language}{korean}}{}% Korean
81
  \ifthenelse{\equal{#1}{la}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{latin}\RequireXeTeX\renewcommand*{\@ubuntu@language}{latin}}{}% Latin
82
  \ifthenelse{\equal{#1}{lv}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{latvian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{latvian}}{}% Latvian
83
  \ifthenelse{\equal{#1}{lt}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{lithuanian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{lithuanian}}{}% Lithuanian
84
  \ifthenelse{\equal{#1}{ml}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{malayalam}\RequireXeTeX\renewcommand*{\@ubuntu@language}{malayalam}}{}% Malayalam
85
  \ifthenelse{\equal{#1}{mr}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{marathi}\RequireXeTeX\renewcommand*{\@ubuntu@language}{marathi}}{}% Marathi
86
  \ifthenelse{\equal{#1}{ms}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{bahasam}\RequireXeTeX\renewcommand*{\@ubuntu@language}{bahasam}}{}% Malaysian
87
  \ifthenelse{\equal{#1}{nb}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{norsk}\RequireXeTeX\renewcommand*{\@ubuntu@language}{norsk}}{}% Norwegian
88
  \ifthenelse{\equal{#1}{nn}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{nynorsk}\RequireXeTeX\renewcommand*{\@ubuntu@language}{nynorsk}}{}% Nynorsk
89
  \ifthenelse{\equal{#1}{nl}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{dutch}\RequireXeTeX\renewcommand*{\@ubuntu@language}{dutch}}{}% Dutch
90
  \ifthenelse{\equal{#1}{oc}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{occitan}\RequireXeTeX\renewcommand*{\@ubuntu@language}{occitan}}{}% Occitan (post 1500)
91
  \ifthenelse{\equal{#1}{pl}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{polish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{polish}}{}% Polish
92
  \ifthenelse{\equal{#1}{pt_BR}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{brazil}\RequireXeTeX\renewcommand*{\@ubuntu@language}{brazil}}{}% Brazilian Porteguese
93
  \ifthenelse{\equal{#1}{pt}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{portuges}\RequireXeTeX\renewcommand*{\@ubuntu@language}{portuges}}{}% Porteguese
94
  \ifthenelse{\equal{#1}{ro}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{romanian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{romanian}}{}% Romanian
95
  \ifthenelse{\equal{#1}{ru}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{russian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{russian}}{}% Russian
96
  \ifthenelse{\equal{#1}{sa}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{sanskrit}\RequireXeTeX\renewcommand*{\@ubuntu@language}{sanskrit}}{}% Sanskrit
97
  \ifthenelse{\equal{#1}{se}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{samin}\RequireXeTeX\renewcommand*{\@ubuntu@language}{samin}}{}% Northern Sami
98
  \ifthenelse{\equal{#1}{sk}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{slovak}\RequireXeTeX\renewcommand*{\@ubuntu@language}{slovak}}{}% Slovak
99
  \ifthenelse{\equal{#1}{sl}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{slovenian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{slovenian}}{}% Slovenian
100
  \ifthenelse{\equal{#1}{sq}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{albanian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{albanian}}{}% Albanian
101
  \ifthenelse{\equal{#1}{sr}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{serbian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{serbian}}{}% Serbian
102
  \ifthenelse{\equal{#1}{sv}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{swedish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{swedish}}{}% Swedish
103
  \ifthenelse{\equal{#1}{syc}}  {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{syriac}\RequireXeTeX\renewcommand*{\@ubuntu@language}{syriac}}{}% Syriac
104
  \ifthenelse{\equal{#1}{ta}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{tamil}\RequireXeTeX\renewcommand*{\@ubuntu@language}{tamil}}{}% Tamil
105
  \ifthenelse{\equal{#1}{te}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{telugu}\RequireXeTeX\renewcommand*{\@ubuntu@language}{telugu}}{}% Telugu
106
  \ifthenelse{\equal{#1}{th}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{thai}\RequireXeTeX\renewcommand*{\@ubuntu@language}{thai}}{}% Thai
107
  \ifthenelse{\equal{#1}{tr}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{turkish}\RequireXeTeX\renewcommand*{\@ubuntu@language}{turkish}}{}% Turkish
108
  \ifthenelse{\equal{#1}{uk}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{ukrainian}\RequireXeTeX\renewcommand*{\@ubuntu@language}{ukrainian}}{}% Ukrainian
109
  \ifthenelse{\equal{#1}{vi}}   {\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{vietnamese}\RequireXeTeX\renewcommand*{\@ubuntu@language}{vietnamese}}{}% Vietnamese
110
  \ifthenelse{\equal{#1}{zh_CH}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{chinese}\RequireXeTeX\renewcommand*{\@ubuntu@language}{chinese}}{}% Chinese
111
  \ifthenelse{\equal{#1}{zh_CN}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{chinese}\RequireXeTeX\renewcommand*{\@ubuntu@language}{chinese}\renewcommand*{\@ubuntu@language@options}{variant=simplified}}{}% Chinese (simplified)
112
  \ifthenelse{\equal{#1}{zh_TW}}{\ExecuteOptionsX<ubuntu-manual>{a4paper}\ExecuteOptionsX<ubuntu-manual>{chinese}\RequireXeTeX\renewcommand*{\@ubuntu@language}{chinese}\renewcommand*{\@ubuntu@language@options}{variant=traditional}}{}% Chinese (traditional)
113
114
  \ifthenelse{\equal{#1}{default}}{%
115
    \ClassWarningNoLine{ubuntu-manual}{Invalid option `#1' for lang key.\MessageBreak The language #1 is not supported yet.\MessageBreak Defaulting to US English.\MessageBreak Email the Ubuntu Manual team for help.}%
116
    \ExecuteOptionsX<ubuntu-manual>{letterpaper}%
117
    \ExecuteOptionsX<ubuntu-manual>{USenglish}%
118
    \renewcommand*{\@ubuntu@language}{USenglish}%
119
    \renewcommand*{\@ubuntu@language@code}{en}%
120
  }
121
122
  \ifthenelse{\equal{\@ubuntu@xindy@language}{}}{%
123
    \let\@ubuntu@xindy@language\@ubuntu@language%
124
  }{}
125
}
126
127
% Provide ``print'' and ``screen'' options
128
\newboolean{@ubuntu@print}\setboolean{@ubuntu@print}{false}
129
\DeclareOptionX<ubuntu-manual>{print}{\setboolean{@ubuntu@print}{true}}
130
\DeclareOptionX<ubuntu-manual>{screen}{\setboolean{@ubuntu@print}{false}}
131
132
% The ubuntu-manual document class has no options of its own, yet.  We just
133
% pass along any options to the underlying Tufte-LaTeX book class.
134
\DeclareOptionX*{%
135
  \PassOptionsToClass{\CurrentOption}{tufte-book}%
136
}
137
138
% Don't use letterspacing from tufte-book class as there's a bug there.
139
\PassOptionsToClass{nols}{tufte-book}
140
141
% Use sans serif margin notes
142
\PassOptionsToClass{sfsidenotes}{tufte-book}
143
144
% Fully-ustified text
145
%\PassOptionsToClass{justified}{tufte-book}
146
147
%
148
% Execute options
149
%
150
151
\ProcessOptionsX*<ubuntu-manual>\relax
152
153
%
154
% Load the underlying Tufte-LaTeX book class
155
%
156
157
\LoadClass{tufte-book}
158
159
%
160
% Load packages
161
%
162
163
\RequirePackage{wrapfig}% load before bidi package
164
165
\RequirePackage{calc}
166
\RequirePackage{setspace}
167
168
%\RequirePackage{listings}
169
\RequirePackage{graphicx}
170
\RequirePackage{fancyhdr}% to modify the running heads/feet and page styles
171
\RequirePackage{makeidx}% to create the index
172
\RequirePackage{eso-pic}% to insert the cover page
173
\RequirePackage{paralist}% for fancier enumeration environments
174
\RequirePackage{comment}% provides comment environment
175
\RequirePackage{multicol}% for putting text into multiple columns (load before bidi)
176
\RequirePackage{pifont}% for arrows and other dingbats
177
\RequirePackage{textcase}% forces text to be upper- or lowercase
178
\RequirePackage{substr}% provides some substr-like functions
179
\RequirePackage{ccicons}% Creative Commons icons
180
\RequirePackage[unicode]{hyperref}% sets up hyperlinking colors (load before bidi)
181
\graphicspath{{.}{graphics}{../graphics}}
182
\RequirePackage[load=abbr,mode=text,alsoload=binary]{siunitx}% proper spacing and names for units
183
\RequirePackage[colorinlistoftodos,disable]{todonotes}% for putting notes in the PDF to be disabled in production PDF
184
\RequirePackage[nonumberlist,translate=true,toc,xindy={glsnumbers=false,language=\@ubuntu@xindy@language,codepage=utf8}]{glossaries}% to create a glossary -- must be loaded AFTER hyperref
185
\renewcommand{\glspostdescription}{}% suppresses full stop after the description in the glossary
186
187
\RequirePackage{polyglossia}% for translations and other languages/scripts
188
\setdefaultlanguage[\@ubuntu@language@options]{\@ubuntu@language}%
189
\setotherlanguage[variant=american]{english}%
190
\RequirePackage[babel]{csquotes}% for language-specific quotation marks
191
192
%\setmainfont[Mapping=tex-text,Numbers=OldStyle,SmallCapsFont={* C}]{Linux Libertine O}
193
\setmainfont[Mapping=tex-text,Numbers=OldStyle]{Linux Libertine O}
194
\setsansfont[Mapping=tex-text,Numbers=OldStyle]{Linux Biolinum O}
195
\setmonofont[Mapping=text-text,Scale=MatchLowercase]{DejaVu Sans Mono}
196
%\newfontinstance\scshape[Letters=SmallCaps,Numbers=Uppercase]{Linux Libertine O}
197
% Set the xindy language for glossaries
198
%\GlsSetXdyLanguage{\@ubuntu@language}
199
200
% A command that prints an interrupting dash.  Varies per language.  (For example, US is ``---'' without spacing, UK is `` -- '' with space.)
201
\newcommand{\dash}{\unskip\penalty0---\ignorespaces}
202
203
\ifthenelse{\boolean{@ubuntu@debug}}{\XeTeXtracingfonts=1}{\XeTeXtracingfonts=0}% log font switching
204
205
%\RequirePackage{xmpincl}% XMP for CC licensing% FIXME fails with XeTeX
206
207
% Make sure URLs are printed in English
208
\urlstyle{same} % gets rid of that rubbishy monospaced URL font - humphreybc
209
\def\UrlBigBreaks{\do@url@hyp}% removed colon
210
\def\UrlNoBreaks{\do\(\do\[\do\{\do\<\do\:}% added colon
211
\let\@ubuntu@orig@url\url
212
\renewcommand{\url}[1]{\textenglish{\@ubuntu@orig@url{#1}}}
213
214
%
215
% Format the document style
216
%
217
218
% Ubuntu color palette
219
\definecolor{UbuntuOrange}              {HTML}{FF6309}% Ubuntu orange
220
\definecolor{UbuntuYellow}              {HTML}{FFB515}% Ubuntu yellow
221
\definecolor{UbuntuRed}                 {HTML}{C90016}% Ubuntu red
222
\definecolor{OrangeHilight}             {HTML}{EEC73E}% oranges
223
\definecolor{Orange}                    {HTML}{F0A513}
224
\definecolor{OrangeBase}                {HTML}{FB8B00}
225
\definecolor{OrangeShadow}              {HTML}{F44800}
226
\definecolor{AccentYellowHilight}       {HTML}{FDFF99}% yellows
227
\definecolor{Yellow}                    {HTML}{FFFF00}
228
\definecolor{AccentYellowBase}          {HTML}{FDCA01}
229
\definecolor{AccentYellowShadow}        {HTML}{986601}
230
\definecolor{AccentOrange}              {HTML}{F44800}% reds
231
\definecolor{AccentRed}                 {HTML}{FD3301}
232
\definecolor{AccentRedBase}             {HTML}{D40000}
233
\definecolor{AccentDeepRed}             {HTML}{980101}
234
\definecolor{HumanHighlight}            {HTML}{FDD99B}% skin tones
235
\definecolor{Human}                     {HTML}{D9BB7A}
236
\definecolor{HumanBase}                 {HTML}{816647}
237
\definecolor{EnvironmentalShadow}       {HTML}{565248}
238
\definecolor{EnvironmentalBlueHighlight}{HTML}{AACCEE}% environmental blues
239
\definecolor{EnvironmentalBlueMedium}   {HTML}{6699CC}
240
\definecolor{EnvironmentalBlueBase}     {HTML}{336699}
241
\definecolor{EnvironmentalBlueShadow}   {HTML}{003366}
242
\definecolor{AccentBlueHighlight}       {HTML}{B3DEFD}% accent blues
243
\definecolor{AccentBlue}                {HTML}{0197FD}
244
\definecolor{AccentBlueBase}            {HTML}{0169C9}
245
\definecolor{AccentBlueShadow}          {HTML}{013397}
246
\definecolor{AccentGreenHiglight}       {HTML}{CCFF99}% greens
247
\definecolor{AccentGreen}               {HTML}{98FC66}
248
\definecolor{AccentGreenBase}           {HTML}{339900}
249
\definecolor{AccentGreenShadow}         {HTML}{015A01}
250
\definecolor{UbuntuToner}               {HTML}{002B3D}% toner
251
\definecolor{AccentMagentHighlight}     {HTML}{FF9BFF}% magentas
252
\definecolor{AccentMagenta}             {HTML}{FF00FF}
253
\definecolor{AccentDarkViolet}          {HTML}{6600CC}
254
255
\definecolor{important}{HTML}{980101}% same as accent deep red
256
%\definecolor{UbuntuAubergine}{HTML}{772953}% aubergine (from design.canonical.com heading)
257
%\definecolor{UbuntuAubergine}{HTML}{1A0512}% aubergine (from https://wiki.ubuntu.com/Brand?action=AttachFile&do=get&target=boot.png)
258
%\definecolor{UbuntuAubergine}{HTML}{6e154c}% aubergine
259
%\definecolor{UbuntuAubergine}{HTML}{4c0d34}% aubergine
260
%\definecolor{UbuntuAubergine}{HTML}{991a68}% aubergine
261
262
% If we're generating the print version, use slightly larger pages to allow for bleed.
263
%\ifthenelse{\boolean{@ubuntu@print}}{%
264
  %\ifthenelse{\boolean{@tufte@afourpaper}}{%
265
    %\geometry{layoutwidth=210mm,layoutheight=297mm,paperwidth=213.175mm,paperheight=300.175mm,left=24.8mm,top=27.4mm,headsep=2\baselineskip,textwidth=107mm,marginparsep=8.2mm,marginparwidth=49.4mm,textheight=49\baselineskip,headheight=\baselineskip}%
266
  %}{%
267
    %\geometry{layoutwidth=8.5in,layoutheight=11in,paperwidth=8.75in,paperheight=11.25in,left=1in,top=1in,headsep=2\baselineskip,textwidth=26pc,marginparsep=2pc,marginparwidth=12pc,textheight=44\baselineskip,headheight=\baselineskip}%
268
  %}%
269
%}
270
271
272
\hypersetup{%
273
  pdfborder = {0 0 0},
274
  bookmarksdepth = section,
275
  citecolor = AccentDeepRed, %DarkGreen,
276
  linkcolor = AccentDeepRed, %DarkBlue,
277
  urlcolor = AccentDeepRed, %DarkGreen,
278
  %colorlinks = true,
279
}%
280
281
% If it's for on-screen viewing, use color links; otherwise use black links.
282
\ifthenelse{\boolean{@ubuntu@print}}{%
283
  \hypersetup{colorlinks=false}%
284
}{%
285
  \hypersetup{colorlinks=true}%
286
}
287
288
% Set the paragraph spacing and indentation
289
%\setlength{\parskip}{0pt}
290
%\setlength{\parindent}{0pt}
291
%\setlength{\parskip}{\baselineskip}
292
293
294
% For acronyms
295
\DeclareRobustCommand{\smallcaps}[1]{{\scshape\MakeTextLowercase{#1}}}
296
\newcommand{\acronym}[1]{\smallcaps{#1}}
297
298
% Format code listings
299
%\lstset{
300
  %basicstyle=\normalsize,
301
  %language=bash,
302
  %aboveskip=.6em,
303
  %belowskip=.6em,
304
  %breaklines=true,
305
  %identifierstyle=\ttfamily,
306
  %keywordstyle=\color[rgb]{0,0,1},
307
  %commentstyle=\color[rgb]{0.133,0.545,0.133},
308
  %stringstyle=\color[rgb]{0.627,0.126,0.941}
309
%}
310
311
% Enable indexing
312
\makeindex
313
314
% Enable glossaries
315
\makeglossaries
316
317
% Set the running head style to \smallcaps by default
318
\let\runningheadstyle\smallcaps
319
320
% Print the full running heads in the front matter
321
\renewcommand\frontmatter{%
322
  \cleardoublepage%
323
  \@mainmatterfalse%
324
  \pagenumbering{arabic}%
325
  %\pagestyle{plain}%
326
  \fancyhf{}%
327
  \ifthenelse{\boolean{@tufte@twoside}}%
328
    {% two-side
329
      \renewcommand{\chaptermark}[1]{\markboth{##1}{}}%
330
      \fancyhead[LE]{\thepage\quad\runningheadstyle{\newlinetospace{\plaintitle}}}% book title
331
      \fancyhead[RO]{\runningheadstyle{\newlinetospace{\leftmark}}\quad\thepage}% chapter title
332
    }%
333
    {% one-side
334
      \fancyhead[RE,RO]{\runningheadstyle{\newlinetospace{\plaintitle}}\quad\thepage}% book title
335
    }%
336
}
337
338
339
340
341
% Format the chapter and section marks (primarily to remove the \uppercase stuff)
342
\renewcommand*{\chaptermark}[1]{\markboth{#1}{#1}}%
343
\renewcommand*{\sectionmark}[1]{}
344
345
% Remove \MakeUppercase from TOC marks
346
\renewcommand\tableofcontents{%
347
  \if@twocolumn
348
    \@restonecoltrue\onecolumn
349
  \else
350
    \@restonecolfalse
351
  \fi
352
  \chapter*{\contentsname}\markboth{\contentsname}{}%
353
  \pdfbookmark[0]{\contentsname}{pdfbookmark:contents}%
354
  \@starttoc{toc}%
355
  \if@restonecol\twocolumn\fi
356
}
357
358
359
% Formatting for main TOC (printed in front matter)
360
% {section} [left] {above} {before w/label} {before w/o label} {filler + page} [after]
361
\newlength{\contentsindent}
362
\setlength{\contentsindent}{1em}
363
\titlecontents{part}% FIXME
364
  [0em] % distance from left margin
365
  {\vspace{\baselineskip}} % above (global formatting of entry)
366
  {\contentslabel{\contentsindent}} % before w/label (label = ``II'')
367
  {} % before w/o label
368
  {\quad\thecontentspage} % filler + page (leaders and page num)
369
  [] % after
370
\titlecontents{chapter}%
371
  [0em] % distance from left margin
372
  {\vspace{1\baselineskip}} % above (global formatting of entry)
373
  {\hspace*{2\contentsindent}\contentslabel{2\contentsindent}} % before w/label (label = ``2'')
374
  {\hspace*{2\contentsindent}} % before w/o label
375
  {\quad\thecontentspage} % filler + page (leaders and page num)
376
  [] % after
377
\titlecontents{section}% FIXME
378
  [0em] % distance from left margin
379
  {\vspace{0\baselineskip}} % above (global formatting of entry)
380
  {\hspace*{3\contentsindent}\contentslabel{3\contentsindent}} % before w/label (label = ``2.6'')
381
  {\hspace*{3\contentsindent}} % before w/o label
382
  {\quad\thecontentspage} % filler + page (leaders and page num)
383
  [] % after
384
\titlecontents{subsection}% FIXME
385
  [0em] % distance from left margin
386
  {\vspace{0\baselineskip}} % above (global formatting of entry)
387
  {\hspace*{4\contentsindent}\contentslabel{4\contentsindent}} % before w/label (label = ``2.6.1'')
388
  {\hspace*{4\contentsindent}} % before w/o label
389
  {\quad\thecontentspage} % filler + page (leaders and page num)
390
  [] % after
391
392
393
394
395
% Format the chapter headings
396
\titleformat{\chapter}[block]% command and paragraph shape
397
  {\bfseries\Huge\sffamily}% format
398
  {\bfseries\Huge\sffamily\thechapter\quad}% label
399
  {0mm}% separation
400
  {}% before
401
  []% after
402
403
\titlespacing*{\chapter}%
404
  {0pt}% left
405
  {0pt}% vertical space before title
406
  {\baselineskip}% separation between title and text
407
  [0pt]% right
408
409
% Format the section headings
410
\titleformat*{\section}{\sffamily\bfseries\Large}%
411
412
% Format the subsection headings
413
\titleformat*{\subsection}{\sffamily\bfseries\large}%
414
415
% Define the \subsubsection command since tufte-book doesn't
416
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
417
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
418
                                     {1.5ex \@plus .2ex}%
419
                                     {\normalfont\normalsize\sffamily\bfseries}}
420
421
% Format the subsubsection headings
422
\titleformat*{\subsubsection}{\sffamily\bfseries\normalsize}%
423
424
425
% The table of contents entries should only go down to \section
426
\setcounter{tocdepth}{1}
427
428
% Only number chapters
429
\setcounter{secnumdepth}{0}
430
431
% Single-space the entire document
432
\singlespacing
433
434
% Inserts the front cover image
435
\newcommand{\frontcover}{%
436
  \thispagestyle{empty}%
437
  %\AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{coverpage.pdf}}}%
438
  %\AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{titlepage/Alpha-Title-letter.png}}}%
439
  \IfFileExists{titlepage/titlepage-\polang.pdf}{%
440
    \AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{titlepage/titlepage-\polang.pdf}}}%
441
  }{%
442
    \ifthenelse{\boolean{@tufte@afourpaper}}{%
443
      \ClassWarningNoLine{ubuntu-manual}{No cover page for \@ubuntu@language\space found.\MessageBreak Defaulting to English A4 cover page.}%
444
      \AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{titlepage/title_page_a4_en.pdf}}}%
445
    }{%
446
      \ClassWarningNoLine{ubuntu-manual}{No cover page for \@ubuntu@language\space found.\MessageBreak Defaulting to English letter cover page.}%
447
      \AddToShipoutPicture*{\put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{titlepage/title_page_letter_en.pdf}}}%
448
    }%
449
  }%
450
  \null\clearpage%
451
}
452
453
% When cleardoublepage is called, produce a blank (empty) page -- i.e.,
454
% without headers and footers
455
\def\cleardoublepage{%
456
  \clearpage
457
  \if@twoside%
458
    \ifodd\c@page\else
459
      \hbox{}%
460
      %\vspace*{\fill}
461
      %\begin{center}
462
      %  This page intentionally contains only this sentence.
463
      %\end{center}
464
      %\vspace{\fill}
465
      \thispagestyle{empty}%
466
      \newpage%
467
      \if@twocolumn\hbox{}\newpage\fi%
468
    \fi%
469
  \fi%
470
}
471
472
% Set up the bulleted lists to use gray square bullets
473
\definecolor{halfgray}{gray}{0.55}% light gray
474
\newcommand{\bull}{\vrule height 1ex width .8ex depth -.2ex}% square bullet
475
\newcommand{\graybullet}{\textcolor{halfgray}{\bull}}% gray square bullet
476
%\setdefaultitem{\graybullet}{}{}{}% set up the four levels of bullets (leave empty to keep default)
477
%\newcommand{\ubuntubullet}{\smash{\raisebox{0.0ex}{\includegraphics[width=0.666em]{graphics/UbuntuCoF-grey.pdf}}}}
478
%\newsavebox{\ubuntubulletbox}% using a box for the bullet means the graphic file gets loaded only once -- faster compile times!
479
%\sbox{\ubuntubulletbox}{\smash{\raisebox{0.0ex}{\includegraphics[width=0.666em]{graphics/UbuntuCoF-grey.pdf}}}}
480
%\setdefaultitem{\usebox{\ubuntubulletbox}}{}{}{}% set up the four levels of bullets (leave empty to keep default)
481
\let\smallarrow\relax
482
\setdefaultitem{\smallarrow}{}{}{}% set up the four levels of bullets (leave empty to keep default)
483
\setdefaultleftmargin{\parindent}{\parindent}{\parindent}{}{}{}% left margins of lists (leave empty to keep default)
484
485
486
% Set spacing of lists
487
\RequirePackage{enumitem}
488
\setlist{noitemsep}% removes vertical spacing between list items
489
490
491
% Adjust the float parameters so things are a bit more compact
492
\setcounter{topnumber}{1}
493
\setcounter{bottomnumber}{1}
494
\setcounter{totalnumber}{4}
495
\renewcommand{\topfraction}{0.900}
496
\renewcommand{\bottomfraction}{0.900}
497
\renewcommand{\textfraction}{0.050}
498
\renewcommand{\floatpagefraction}{0.900}
499
500
% Disallow orphans and widows
501
\AtBeginDocument{%
502
  \widowpenalty=10000%
503
  \clubpenalty=10000%
504
  \raggedbottom%
505
}%
506
507
%
508
% Define useful macros
509
%
510
511
\newcommand{\notecallout}[2][Note]{%
512
  \marginnote{\textbf{#1:} #2}
513
}
514
515
516
% An environment for displaying terminal output
517
\newenvironment{terminal}{%
518
  \begin{list}{}{%
519
    \setlength{\itemindent}{0pt}%
520
    \setlength{\labelwidth}{0pt}%
521
    \setlength{\labelsep}{0pt}%
522
    \setlength{\leftmargin}{12pt}%
523
    \setlength{\rightmargin}{12pt}%
524
    \setlength{\listparindent}{0pt}%
525
    \setlength{\topsep}{0.5\baselineskip}%
526
    \setlength{\partopsep}{0pt}%
527
    \setlength{\parsep}{0pt}%
528
    \setlength{\itemsep}{0pt}%
529
  }%
530
    \small\ttfamily\obeylines%
531
    \item\relax
532
}{%
533
  \end{list}%
534
}
535
536
% An environment to set the list of credits (names) in three columns.
537
\newenvironment{credits}[1][]{%
4 by Kevin Godby
* Playing around with formatting the Credits pages.
538
  \begin{fullwidth}%
539
  \begin{multicols}{4}[#1]%
540
    \parskip0pt%
541
    \parindent0pt%
542
    \let\item\par%
543
    \small%
544
}{%
545
  \end{multicols}%
546
  \end{fullwidth}%
547
}
548
549
% A special environment for the translator credits
550
\newenvironment{translatorcredits}[1][]{%
1 by Kevin Godby
* Initial import of files.
551
  \begin{multicols}{3}[#1]%
552
    \parskip0pt%
553
    \parindent0pt%
554
    \small%
4 by Kevin Godby
* Playing around with formatting the Credits pages.
555
    \obeylines%
1 by Kevin Godby
* Initial import of files.
556
}{%
557
  \end{multicols}%
558
}
559
560
% Macros to distinguish prompts and user input from program output in terminal displays
561
\newcommand{\prompt}{\texttt{\$}~}
562
\newcommand{\rootprompt}{\texttt{\#}~}
563
%\newcommand{\userinput}[1]{{\ttfamily\textcolor{AccentDeepRed}{#1}}}% FIXME we'll adjust this formatting later -- red for easy editing at the moment
564
\newcommand{\userinput}[1]{{\ttfamily\bfseries{#1}}}% FIXME we'll adjust this formatting later -- red for easy editing at the moment
565
\newcommand{\code}[1]{{\ttfamily#1}}
566
567
% Icons for advanced and warning notices
568
\newsavebox{\advancedicon}\savebox{\advancedicon}[0.25in][c]{\includegraphics[width=0.25in]{graphics/advanced.pdf}}
569
\newsavebox{\warningicon}\savebox{\warningicon}[0.25in][c]{\includegraphics[width=0.25in]{graphics/warning.pdf}}
570
571
% Macro for advanced usage notes
572
\newcommand{\advanced}[1]{%
573
  \smallskip%
574
  \begin{center}
575
  \noindent%
576
  \hspace{\parindent}%
577
  \begin{minipage}[t]{0.25in}%
578
    \centering\usebox\advancedicon%
579
  \end{minipage}%
580
  \hfill%
581
  \begin{minipage}[t]{\linewidth-0.30in}%
582
    \vspace{-\baselineskip}\small\em#1%
583
  \end{minipage}%
584
  \hspace{\parindent}%
585
  \end{center}
586
  \smallskip\par%
587
}
588
589
% Macro for warning notes
590
\newcommand{\warning}[1]{%
591
  \smallskip%
592
  \begin{center}
593
  \noindent%
594
  \hspace{\parindent}%
595
  \begin{minipage}[t]{0.25in}%
596
    \centering\usebox\warningicon%
597
  \end{minipage}%
598
  \hfill%
599
  \begin{minipage}[t]{\linewidth-0.30in}%
600
    \vspace{-\baselineskip}\small\em#1%
601
  \end{minipage}%
602
  \hspace{\parindent}%
603
  \end{center}
604
  \smallskip\par%
605
}
606
607
608
% Macro for typesetting menu selection sequences.
609
% \nav{Menu \then Submenu \then Subsubmenu} would generate text looking like
610
% ``Menu --> Submenu --> Subsubmenu''.
611
%\newcommand{\smallarrow}{\raisebox{0.333ex}{\scalebox{0.5}{\ding{228}}}}
612
\newcommand{\smallarrow}{{\normalfontlatin ‣}}%
613
%\newcommand{\smallarrow}{\raisebox{0.250ex}{\scalebox{0.5}{\ding{228}}}}
614
615
\def\then{\unskip\,\smallarrow\,\allowbreak\ignorespaces}%
616
617
\newcommand{\menu}[1]{%
618
  \begingroup%
619
    %\def\then{\unskip\ensuremath{\,\rightarrow\,}\ignorespaces}%
620
    %\def\then{\unskip\,\smallarrow\,\allowbreak\ignorespaces}%
621
    \textbf{#1}%
622
  \endgroup%
623
}
624
625
% Macro to format application names and index them
626
\newcommand{\applicationsheadword}{applications}
627
\newcommand{\application}[2][]{%
628
  #2%
629
  \ifthenelse{\isempty{#1}}{%
630
    \protect\index{#2}%\protect\index{\applicationsheadword!#2}%
631
  }{%
632
    \protect\index{#1}%\protect\index{\applicationsheadword!#1}%
633
  }%
634
}
635
636
% Macro to format command line programs and index them
637
\newcommand{\commandlineappheadword}{command line}
638
\newcommand{\commandlineapp}[2][]{%
639
  {\ttfamily #2}%
640
  \ifthenelse{\isempty{#1}}{%
641
    \protect\index{#2@\texttt{#2}}%\protect\index{\commandlineappheadword!#2}%
642
  }{%
643
    \protect\index{#1@\texttt{#1}}%\protect\index{\commandlineappheadword!#1}%
644
  }%
645
}
646
647
% Add an entry to the index and the main text
648
\newcommand{\Index}[2][]{%
649
  #2%
650
  \ifthenelse{\isempty{#1}}{%
651
    \protect\index{#2}%
652
  }{%
653
    \protect\index{#1}%
654
  }%
655
}
656
657
% Macro to simplify linking to chapters
658
\newcommand{\chaplink}[1]{%
659
  % not using \autoref here because I don't want to fix the case of \chapterautorefname for individual languages --godbyk
660
  \IfBeforeSubStringEmpty{ch:}{#1}{\hyperref[#1]{\@chapapp~}\ref{#1}\hyperref[#1]{: }\nameref{#1}}{\hyperref[ch:#1]{\@chapapp~}\ref{ch:#1}\hyperref[ch:#1]{: }\nameref{ch:#1}}%
661
}
662
663
% Macro to simplify linking to sections
664
\newcommand{\seclink}[1]{%
665
  %\IfBeforeSubStringEmpty{sec:}{#1}{\autoref{#1}\hyperref[#1]{: }\nameref{#1}}{\autoref{sec:#1}\hyperref[sec:#1]{: }\nameref{sec:#1}}%
666
  \IfBeforeSubStringEmpty{sec:}{#1}{\nameref{#1}}{\nameref{sec:#1}}%
667
}
668
669
% Macros to format UI elements
670
\newcommand{\button}[1]{\textbf{#1}}
671
\newcommand{\tab}[1]{\textbf{#1}}
672
\newcommand{\dropdown}[1]{\textbf{#1}}
673
\newcommand{\checkbox}[1]{\textbf{#1}}
674
\newcommand{\window}[1]{{``#1''}}
675
\newcommand{\keystroke}[1]{\texttt{#1}}
676
\newcommand{\radiobutton}[1]{\textbf{#1}}
677
\newcommand{\textfield}[1]{\textbf{#1}}
678
679
% Aliases to keep things working smoothly
680
%\let\nav\menu
681
%\let\menuitem\menu
682
\newcommand{\nav}[1]{\ClassError{ubuntu-manual}{The \string\nav\space command is obsolete.\MessageBreak Use the \string\menu\space command instead.}{Just replace \string\nav\space with \string\menu\space and you'll be set!}}
683
\newcommand{\menuitem}[1]{\ClassError{ubuntu-manual}{The \string\menuitem\space command is obsolete.\MessageBreak Use the \string\menu\space command instead.}{Just replace \string\menuitem\space with \string\menu\space and you'll be set!}}
684
685
% Screenshot placeholder
686
\setlength{\fboxsep}{0pt}
687
\newcommand*{\screenshotslog}{screenshots.log}
688
\newwrite\screenshots
689
\newcommand{\screenshotTODO}[1]{%
690
  \immediate\write\screenshots{Chapter \thechapter, page \thepage: #1}%
691
  \par\noindent%
692
  \begin{figure}
693
    \fbox{\parbox[c][0.75\linewidth][c]{\linewidth}{\begin{center}\sffamily\bfseries\color{important} M~I~S~S~I~N~G~~~S~C~R~E~E~N~S~H~O~T\par\medskip\footnotesize\normalcolor#1\end{center}}}
694
    \caption{#1}
695
  \end{figure}%
696
  \par%
697
}
698
\AtBeginDocument{\immediate\openout\screenshots=\screenshotslog}% open the screenshots.log file
699
\AtEndDocument{\immediate\closeout\screenshots}% close the screenshots.log file
700
701
\ifthenelse{\boolean{@ubuntu@debug}}{\listfiles}{}
702
703
% Command for handling translated licenses
704
\newcommand{\LoadLicenseFile}{%
705
  \IfFileExists{backmatter/license-\@ubuntu@language@code.tex}{\input{backmatter/license-\@ubuntu@language@code.tex}\ClassInfo{ubuntu-manual}{Found backmatter/license-\@ubuntu@language@code.tex}}{\input{backmatter/license-en.tex}\ClassInfo{ubuntu-manual}{Didn't find backmatter/license-\@ubuntu@language@code.tex, using backmatter/license-en.tex instead.}}%
706
}
707
708
% The screenshot scale
709
\newlength{\screenshotscale}
710
\setlength{\screenshotscale}{1.0pt}
711
712
% Measures the width of a graphic and scales it to the max figure* width.
713
\newlength{\maxscreenshotwidth}%
714
\newcommand{\setmaxscreenshot}[1]{%
715
  \TufteRecalculate% to make sure \@tufte@fullwidth has been calculated
716
  \settowidth{\maxscreenshotwidth}{\includegraphics{#1}}%
717
  \gsetlength{\screenshotscale}{1.0pt * \ratio{\@tufte@fullwidth}{\maxscreenshotwidth}}%
718
}
719
720
% Define the screenshot command
721
%   #1 optional float position specifier
722
%   #2 screenshot filename (example: xyzzy.png)
723
%   #3 label (example: xyzzy)
724
%   #4 caption
725
\newsavebox{\screenshotgraphic}
726
\newcommand{\screenshot}[4][htbp!]{%
727
  \ifvmode\else\unskip\fi%
728
  \IfFileExists{screenshots/\@ubuntu@language@code/#2}{%
729
    \savebox{\screenshotgraphic}{\includegraphics[scale=\strip@pt\screenshotscale]{screenshots/\@ubuntu@language@code/#2}}%
730
    \ifthenelse{\wd\screenshotgraphic>\textwidth}{%
731
      \begin{figure*}[#1]%
732
        \begin{center}%
733
          \usebox{\screenshotgraphic}%
734
        \end{center}%
735
        \caption{#4}%
736
        \label{#3}%
737
      \end{figure*}%
738
    }{%
739
      \begin{figure}[#1]%
740
        \begin{center}%
741
          \usebox{\screenshotgraphic}%
742
        \end{center}%
743
        \caption{#4}%
744
        \label{#3}%
745
      \end{figure}%
746
    }%
747
  }{%
748
    \begin{figure}[#1]%
749
      \fbox{\parbox[c][0.75\linewidth][c]{\linewidth}{\begin{center}\sffamily\bfseries\color{important} M~I~S~S~I~N~G~~~S~C~R~E~E~N~S~H~O~T\par\medskip\footnotesize\normalcolor#3\par\medskip The file \texttt{screenshots/\@ubuntu@language@code/#2} does not exist!\end{center}}}%
750
      \caption{#4}%
751
      \label{#3}%
752
    \end{figure}%
753
  }%
754
  \@esphack%
755
  \ignorespaces%
756
}
757
758
\newcommand{\gltodo}[1]{%
759
  \todo[color=LightSkyBlue]{Add #1 to the glossary.}%
760
}
761
762
\newcommand{\hairsp}{\hspace{1pt}}% hair space
763
\newcommand{\hquad}{\hskip0.5em\relax}% half quad space
764
\newcommand{\ie}{\textit{i.\kern0.5pt e.}\xspace}
765
\newcommand{\eg}{\textit{e.\kern0.5pt g.}\xspace}
766
767
% Formats placeholder argument as <placeholder> (in italics)
768
\DeclareRobustCommand\variable[1]{%
769
     \ensuremath\langle
770
     \ifmmode \expandafter \nfss@text \fi
771
     {%
772
      \itshape
773
      \edef\meta@hyphen@restore
774
        {\hyphenchar\the\font\the\hyphenchar\font}%
775
      \hyphenchar\font\m@ne
776
      \language\l@nohyphenation
777
      #1\/%
778
      \meta@hyphen@restore
779
     }\ensuremath\rangle
780
}
781
782
% Revision information that's displayed on the copyright page
783
\newcommand{\revisionnumbercaption}{Revision number}
784
\newcommand{\revisiondatecaption}{Revision date}
785
\newcommand{\revinfo}[2]{% #1 is the revision number, #2 is the revision date
786
  \revisionnumbercaption: #1%
787
  \qquad%
788
  \revisiondatecaption: #2%
789
}
790
791
% PDF bookmark names
792
\newcommand{\colophoncaption}{Colophon}
793
\newcommand{\titlepagecaption}{Title page}
794
795
% URL for printed book (appears on copyright page)
2 by Kevin Godby
* Updated the print url.
796
\newcommand{\printurl}{http://ubuntu-manual.org/buy/gswu1010/\polang}
1 by Kevin Godby
* Initial import of files.
797
798
799
%
800
% Language-specific overrides
801
%
802
803
% Load language-specific settings
804
\IfFileExists{um-\@ubuntu@language.clo}{\input{um-\@ubuntu@language.clo}}{}%
805
806
807
%
808
% Metadata for po4a
809
%
810
811
% po4a: environment lstlisting
812
% po4a: environment comment
813
% po4a: command *todo {}
814
% po4a: environment terminal
815
% po4a: environment credits
816
817
% Document headings
818
% po4a: command title {_}
819
% po4a: command author {_}
820
% po4a: command part {_}
821
822
% From Tufte-LaTeX
823
% po4a: environment fullwidth
824
825
%
826
% All done!
827
%
828
829
\endinput
830