\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}
