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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
|
\documentclass[a4paper,12pt]{article}
\usepackage{awesomebox}
\setlength{\aweboxvskip}{0pt}
\usepackage{xltxtra}
\defaultfontfeatures{Scale=MatchLowercase}
\setmonofont[Mapping=tex-text,Scale=0.9]{Inconsolata}
\setromanfont[Mapping=tex-text]{Linux Libertine O}
\setsansfont[Mapping=tex-text]{Linux Biolinum O}
\usepackage{polyglossia}
\setdefaultlanguage{english}
% Comment out the lines above and uncomment the following lines to test
% usage with pdflatex
%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage[english,frenchb]{babel}
\usepackage[vmargin=2cm,hmargin=3cm,includeheadfoot=true]{geometry}
\linespread{1.2}
\newcommand{\cf}[1]{(\emph{cf.} section \ref{#1}, %
<<\,\nameref{#1}\,>>, p. \pageref{#1})}
\usepackage{datetime}
\newcommand{\colophon}{
~\vfill
\begin{center}
\scriptsize Prepared with \faHeart{} from Nantes,
France\\
Awesome Box is released under the
\hrefcolor{http://www.wtfpl.net/txt/copying/}{WTFPL}. A copy of this
license is distributed in this package.\\
\tiny version of the \today{} --- \currenttime
\end{center}
}
% configuration de la transformation en PDF
\usepackage[pdfusetitle]{hyperref}
\hypersetup{
colorlinks=false,
pdfborder=0 0 0,
breaklinks=true,
bookmarksopen=true,
pdfcreator=XeLaTeX,
pdfproducer=XeLaTeX}
\newcommand\hrefcolor[2]{\textcolor{magenta}{\href{#1}{#2}}}
\title{Awesome Boxes}
\author{Étienne Deparis}
\date{2018-11-26 v0.4}
\begin{document}
\maketitle
\section{Introduction}
Awesome Boxes is all about drawing admonition blocks around text to
inform or alert your readers about something particular. The specific
aim of this package is to use
\hrefcolor{https://fontawesome.com/}{FontAwesome 5} icons to ease the
illustration of these boxes.
The idea of admonition blocks comes from the ones you can easily do with
\hrefcolor{http://asciidoctor.org/docs/user-manual/\#admonition}{AsciiDoc}.
\section{How to use it?}
Just download this package and call it at the beginning of your
document:
\begin{center}
\verb!\usepackage{awesomebox}!
\end{center}
\section{Provided boxes}
\subsection{Inline boxes}
The provided boxes follow the name convention of the
\hrefcolor{http://asciidoctor.org/docs/user-manual/\#admonition}{admonition
blocks} from \hrefcolor{http://asciidoctor.org}{AsciiDoc}.
\begin{center}
\verb!\notebox{Lorem ipsum…}!
\end{center}
\notebox{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\clearpage
\begin{center}
\verb!\tipbox{Lorem ipsum…}!
\end{center}
\tipbox{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\begin{center}
\verb!\warningbox{Lorem ipsum…}!
\end{center}
\warningbox{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\begin{center}
\verb!\cautionbox{Lorem ipsum…}!
\end{center}
\cautionbox{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\begin{center}
\verb!\importantbox{Lorem ipsum…}!
\end{center}
\importantbox{Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Nam aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\subsection{Environments}
\label{sec:environments}
You can also insert admonition blocks with an environment syntax. The
same names can be used, but with a \emph{block} suffixe.
\begin{verbatim}
\begin{noteblock}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
aliquet libero quis lectus elementum fermentum.
\end{noteblock}
\end{verbatim}
For the exactly same rendering:
\vspace{5mm}
\begin{noteblock}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquet
libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.
\end{noteblock}
\section{How to add new icons?}
\label{sec:new-icons}
This package use the
\hrefcolor{https://www.ctan.org/pkg/fontawesome5}{FontAwesome5 package}
under the hood. In order to use your own icons, just call the proper
\verb!\faXxx! command.
For example, if you want to add the \emph{rocket} icon
(\faRocket), you just have to insert \verb!\faRocket!.
\section{How to create your own box?}
\label{sec:howtoown}
\subsection{Inline boxes}
To create your own box, with your own colour, your own icon or your own
rule width, you can use our meta command:
\begin{center}
\verb!\awesomebox[rulecolor]{rulewidth}{icon}{iconcolor}{your text content}!
\end{center}
Here are some examples of custom boxes:
\begin{center}
\verb!\awesomebox{5pt}{\faCertificate}{magenta}{Lorem ipsum…}!
\end{center}
\awesomebox{5pt}{\faCertificate}{magenta}{Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Nam aliquet libero quis lectus elementum
fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\begin{center}
\verb!\awesomebox{0pt}{\faCogs}{black}{Lorem ipsum…}!
\end{center}
\begin{awesomeblock}{0pt}{\faCogs}{black}
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Nam aliquet libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.
\end{awesomeblock}
\begin{center}
\verb!\awesomebox[violet]{2pt}{\faRocket}{violet}{Lorem ipsum…}!
\end{center}
\awesomebox[violet]{2pt}{\faRocket}{violet}{Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Nam aliquet libero quis lectus elementum
fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
\subsection{Environments}
To create your own box, with your own colour, your own icon or your own
rule width, you can use our meta command:
\begin{verbatim}
\begin{awesomeblock}[rulecolor]{rulewidth}{icon}{iconcolor}
your text content
\end{awesomeblock}
\end{verbatim}
For example, we can rewrite the first previous example as:
\begin{verbatim}
\begin{awesomeblock}[magenta]{5pt}{\faCertificate}{magenta}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquet
libero quis lectus elementum fermentum.
\end{awesomeblock}
\end{verbatim}
Which will render this way:
\vspace{5mm}
\begin{awesomeblock}[magenta]{5pt}{\faCertificate}{magenta}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquet
libero quis lectus elementum fermentum.
Fusce aliquet augue sapien, non efficitur mi ornare sed. Morbi at
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.
\end{awesomeblock}
\section{Other options}
Finally, you can also modify some internal options in order to modify
globally your awesome boxes (either the default ones or your new ones).
\subsection{Left margin}
The left margin is the space left before the vertical rule to display
the icon. You can change it with the following command (9mm is the
default one): \\ \verb!\setlength{\aweboxleftmargin}{9mm}!.
\subsection{Vertical skip}
This space is used before and after the awesome box. You can change it
with (5mm is the default): \verb!\setlength{\aweboxvskip}{5mm}!.
\subsection{Sign raise}
This length is used to raise (or lower) the left icon. Its default value
is -5mm and you can change it with:
\verb!\setlength{\aweboxsignraise}{-5mm}!.
\subsection{Rule width}
This width is used for the vertical rule of our four default boxes. Its
default value is 2pt and you can change it with:
\verb!\setlength{\aweboxrulewidth}{2pt}!.
\subsection{Rule default color}
The rule color is an optional argument passed to the commands or
environments. Its default value is the following (to match the one
defined by AsciiDoctor) and you can change it this way:
\verb!\definecolor{abvrulecolor}{RGB}{221,221,216}!
\section{With other environments}
Awesome boxes may be used in any other environments, like in a list.
\begin{verbatim}
\begin{itemize}
\item My first item
\item My second item with \notebox{A note box!}
\item Last and finally
\end{itemize}
\end{verbatim}
will give:
\begin{itemize}
\item My first item
\item My second item with \notebox{A note box!}
\item Last and finally
\end{itemize}
It may contain other environments too, but in that case, you should
prefer the environment API (see Section \ref{sec:environments}):
\begin{verbatim}
\begin{importantblock}
\begin{itemize}
\item My first item
\item My second item with \notebox{A note box!}
\item Last and finally
\end{itemize}
\end{importantblock}
\end{verbatim}
will give:
\vspace{5mm}
\begin{importantblock}
\begin{itemize}
\item My first item
\item My second item with \notebox{A note box!}
\item Last and finally
\end{itemize}
\end{importantblock}
\section{Breaking changes}
The version 0.4 of this package introduces a way to customize the rule
color. Thus, the commands and environments arguments have been
reorganized to be in a more logical order.
Historically, the \verb!\awesomebox! command used the following syntax:
\begin{center}
\verb!\awesomebox{icon}{rulewidth}{iconcolor}{your text content}!
\end{center}
This syntax will now leads to compiling errors, as you must now write it
as the following example show you (and as explained in the Section
\ref{sec:howtoown} "\nameref{sec:howtoown}"), to avoid an alternate
declaration of rule and icon options:
\begin{center}
\verb!\awesomebox[rulecolor]{rulewidth}{icon}{iconcolor}{your text content}!
\end{center}
If you only use the provided boxes and environments (the
\verb!\notebox!, \verb!\tipbox!, \verb!\warningbox!, \verb!\cautionbox!,
and \verb!\importantbox! or the \texttt{noteblock}, \texttt{tipblock},
\texttt{cautionblock}, \texttt{warningblock}, \texttt{importantblock}
environment) you are not affected by this change and your documents will
work without any change.
\colophon
\end{document}
|