summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-04-04 20:54:25 +0000
committerKarl Berry <karl@freefriends.org>2019-04-04 20:54:25 +0000
commit93f5c4643a3d0a596d220ff14756ce68d99afe33 (patch)
tree3b4f0cef3891b27c01ad58fe8856767108594936
parenta1793dc7c8f8fa5cb0b32fe6f0218c094a280c56 (diff)
awesomebox (4apr19)
git-svn-id: svn://tug.org/texlive/trunk@50757 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/awesomebox/README.md3
-rw-r--r--Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdfbin47179 -> 50878 bytes
-rw-r--r--Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex114
-rw-r--r--Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty54
4 files changed, 120 insertions, 51 deletions
diff --git a/Master/texmf-dist/doc/latex/awesomebox/README.md b/Master/texmf-dist/doc/latex/awesomebox/README.md
index 47582479b91..18adc1aac5d 100644
--- a/Master/texmf-dist/doc/latex/awesomebox/README.md
+++ b/Master/texmf-dist/doc/latex/awesomebox/README.md
@@ -18,7 +18,8 @@ included in your LaTeX distribution):
- `fontawesome5`
- `xcolor`
-- `tabu`
+- `array`
+- `xparse`
Installation
============
diff --git a/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf b/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf
index 1f21f7fc6e5..c59857aae35 100644
--- a/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf
+++ b/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex b/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex
index 809c9c43694..8403ed7dd75 100644
--- a/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex
+++ b/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex
@@ -1,7 +1,6 @@
\documentclass[a4paper,12pt]{article}
\usepackage{awesomebox}
-\setlength{\aweboxvskip}{0pt}
\usepackage{xltxtra}
\defaultfontfeatures{Scale=MatchLowercase}
@@ -12,6 +11,8 @@
\usepackage{polyglossia}
\setdefaultlanguage{english}
+\usepackage{minted}
+
% Comment out the lines above and uncomment the following lines to test
% usage with pdflatex
%\usepackage[utf8]{inputenc}
@@ -51,7 +52,7 @@
\title{Awesome Boxes}
\author{Étienne Deparis}
-\date{2018-11-26 v0.4}
+\date{2019-04-04 v0.5}
\begin{document}
@@ -145,7 +146,7 @@ The provided boxes follow the name convention of the
\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.
+same names can be used, but with a \emph{block} suffix.
\begin{verbatim}
\begin{noteblock}
@@ -157,8 +158,6 @@ aliquet libero quis lectus elementum fermentum.
For the exactly same rendering:
-\vspace{5mm}
-
\begin{noteblock}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam aliquet
libero quis lectus elementum fermentum.
@@ -183,11 +182,13 @@ For example, if you want to add the \emph{rocket} icon
\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:
+To create your own box, with your own icon and colour, your own
+vertical rule width and colour, your own horizontal rules at the top
+and the bottom of your boxes, or a title, you can use our meta
+command:
\begin{center}
-\verb!\awesomebox[rulecolor]{rulewidth}{icon}{iconcolor}{your text content}!
+\verb!\awesomebox[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}{your text content}!
\end{center}
Here are some examples of custom boxes:
@@ -208,14 +209,13 @@ Here are some examples of custom boxes:
\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.
+\awesomebox{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}
+ egestas commodo nisl.}
\begin{center}
\verb!\awesomebox[violet]{2pt}{\faRocket}{violet}{Lorem ipsum…}!
@@ -229,13 +229,41 @@ Here are some examples of custom boxes:
dictum felis. Pellentesque tortor lacus, semper et neque vitae,
egestas commodo nisl.}
+\begin{center}
+\verb!\awesomebox[white][\abShortLine]{0pt}{\faGrinBeam[regular]}{black}{Lorem ipsum…}!
+\end{center}
+
+\awesomebox[white][\abShortLine]{0pt}{\faGrinBeam[regular]}{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.}
+
+\clearpage
+
+\begin{center}
+\verb!\awesomebox[white][\abLongLine][\textbf{Watch out}]{0pt}{\faBomb}{black}{Lorem ipsum…}!
+\end{center}
+
+\awesomebox[white][\abLongLine][\textbf{Watch out}]{0pt}{\faBomb}{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.}
+
\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:
+To create your own box, with your own icon and colour, your own
+vertical rule width and colour, your own horizontal rules at the top
+and the bottom of your boxes, or a title, you can use our meta
+command:
\begin{verbatim}
-\begin{awesomeblock}[rulecolor]{rulewidth}{icon}{iconcolor}
+\begin{awesomeblock}[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}
your text content
\end{awesomeblock}
\end{verbatim}
@@ -251,8 +279,6 @@ For example, we can rewrite the first previous example as:
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.
@@ -271,8 +297,16 @@ 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}!.
+the icon. You can change it with the following command
+(\verb!0.08\linewidth! is the default one):\\
+\verb!\setlength{\aweboxleftmargin}{0.08\linewidth}!.
+
+\subsection{Content width}
+
+The content width is the space used to insert the body of your
+admonition block. You can change it with the following command
+(\verb!0.92\linewidth! is the default one):\\
+\verb!\setlength{\aweboxcontentwidth}{0.92\linewidth}!.
\subsection{Vertical skip}
@@ -285,16 +319,16 @@ 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}
+\subsection{Vertical 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}
+\subsection{Vertical 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
+The vertical 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}!
@@ -334,19 +368,41 @@ prefer the environment API (see Section \ref{sec:environments}):
will give:
-\vspace{5mm}
-
\begin{importantblock}
\begin{itemize}
+ \vspace{-5mm}
\item My first item
\item My second item with \notebox{A note box!}
\item Last and finally
+ \vspace{-5mm}
\end{itemize}
\end{importantblock}
+\clearpage
+
+Or with a more complex example with minted environment:
+
+\begin{verbatim}
+\begin{noteblock}
+ This could be written as:
+
+ \begin{minted}{c++}
+ std::cout << "hello world!" << std::endl;
+ \end{minted}
+\end{noteblock}
+\end{verbatim}
+
+\begin{noteblock}
+ This could be written as:
+
+ \begin{minted}{c++}
+ std::cout << "hello world!" << std::endl;
+ \end{minted}
+\end{noteblock}
+
\section{Breaking changes}
-The version 0.4 of this package introduces a way to customize the rule
+Version 0.4 of this package introduced a way to customize the rule
color. Thus, the commands and environments arguments have been
reorganized to be in a more logical order.
@@ -356,8 +412,8 @@ Historically, the \verb!\awesomebox! command used the following syntax:
\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
+This syntax now leads to compiling errors, as you must now write it
+as the following example shows you (and as explained in the Section
\ref{sec:howtoown} "\nameref{sec:howtoown}"), to avoid an alternate
declaration of rule and icon options:
diff --git a/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty b/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
index 7db70cbaf66..db360d541f5 100644
--- a/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
+++ b/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{awesomebox}[2018/11/26 v0.4]
+\ProvidesPackage{awesomebox}[2019/04/04 v0.5]
% Awesome Box has been written by Étienne Deparis and is released under
% the WTFPL (http://www.wtfpl.net/txt/copying/).
@@ -12,10 +12,10 @@
% v0.4: Marcel Krüger https://github.com/zauguin
% * Fontawesome5 compatibility
% Gilbert Fuerer
-% * Custom rule color
+% * Custom vertical rule color
+% v0.5: Georger Araújo https://github.com/georgerbr
+% * Horizontal rules at top and bottom, title
-
-% Try to just depend on fontawesome5 package
% https://ctan.org/pkg/fontawesome5
\RequirePackage{fontawesome5}
@@ -43,7 +43,9 @@
\definecolor{abvrulecolor}{RGB}{221,221,216}
\newlength{\aweboxleftmargin}
-\setlength{\aweboxleftmargin}{9mm}
+\setlength{\aweboxleftmargin}{0.08\linewidth}
+\newlength{\aweboxcontentwidth}
+\setlength{\aweboxcontentwidth}{0.92\linewidth}
\newlength{\aweboxvskip}
\setlength{\aweboxvskip}{5mm}
\newlength{\aweboxsignraise}
@@ -51,18 +53,25 @@
\newlength{\aweboxrulewidth}
\setlength{\aweboxrulewidth}{2pt}
-% https://ctan.org/pkg/tabu
-\RequirePackage{tabu}
+\RequirePackage{array}
+
+% To allow for more than one optional argument
+\RequirePackage{xparse}
+
+% Horizontal rule definitions used with second optional argument [hrule]
+\def\abShortLine{\cline{2-2}}
+\def\abLongLine{\hline}
% Commands API
-% \awesomebox[rulecolor]{rulewidth}{icon}{iconcolor}{content}
-\newcommand{\awesomebox}[5][abvrulecolor]{%
- \vspace{\aweboxvskip}
- \noindent
- \begin{tabu} to \linewidth
- {m{\aweboxleftmargin}!{\color{#1}\vrule width #2}X}
- \raisebox{\aweboxsignraise}{\textcolor{#4}{\Huge#3}} & #5 \\
- \end{tabu}
+% \awesomebox[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}{content}
+\NewDocumentCommand \awesomebox { O{abvrulecolor} O{} o m m m +m }{%
+ \vspace{\aweboxvskip}\noindent
+ \begin{tabular}%
+ {p{\aweboxleftmargin}!{\color{#1}\vrule width #4}p{\aweboxcontentwidth}}
+ \IfValueTF {#3}
+ { & #3 \\ #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} & #7 \\ #2}
+ { #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} & #7 \\ #2}
+ \end{tabular}
\vspace{\aweboxvskip}}
\newcommand{\notebox}[1]{%
@@ -81,15 +90,17 @@
\awesomebox[abimportant]{\aweboxrulewidth}{\abIconExclamationCircle}{abimportant}{#1}}
% Environments API
-% \begin{awesomeblock}[rulecolor]{rulewidth}{icon}{iconcolor}
+% \begin{awesomeblock}[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}
% content
% \end{awesomeblock}
-\newenvironment{awesomeblock}[4][abvrulecolor]%
+\NewDocumentEnvironment{awesomeblock}{ O{abvrulecolor} O{} o m m m }
{\vspace{\aweboxvskip}\noindent
- \begin{tabu} to \linewidth %
- {m{\aweboxleftmargin}!{\color{#1}\vrule width #2}X}%
- \raisebox{\aweboxsignraise}{\textcolor{#4}{\Huge#3}} & }
- {\\\end{tabu}\vspace{\aweboxvskip}}
+ \begin{tabular}%
+ {p{\aweboxleftmargin}!{\color{#1}\vrule width #4}p{\aweboxcontentwidth}}
+ \IfValueTF {#3}
+ { & #3 \\ #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} &}
+ { #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} &}}
+{\\ #2 \end{tabular}\vspace{\aweboxvskip}}
\newenvironment{noteblock}%
{\begin{awesomeblock}[abnote]{\aweboxrulewidth}{\abIconInfoCircle}{abnote}}
@@ -110,4 +121,5 @@
\newenvironment{importantblock}%
{\begin{awesomeblock}[abimportant]{\aweboxrulewidth}{\abIconExclamationCircle}{abimportant}}
{\end{awesomeblock}}
+
\endinput