texlive[50757] Master/texmf-dist: awesomebox (4apr19)

commits+karl at tug.org commits+karl at tug.org
Thu Apr 4 22:54:25 CEST 2019


Revision: 50757
          http://tug.org/svn/texlive?view=revision&revision=50757
Author:   karl
Date:     2019-04-04 22:54:25 +0200 (Thu, 04 Apr 2019)
Log Message:
-----------
awesomebox (4apr19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/awesomebox/README.md
    trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf
    trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex
    trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty

Modified: trunk/Master/texmf-dist/doc/latex/awesomebox/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/awesomebox/README.md	2019-04-04 20:54:15 UTC (rev 50756)
+++ trunk/Master/texmf-dist/doc/latex/awesomebox/README.md	2019-04-04 20:54:25 UTC (rev 50757)
@@ -18,7 +18,8 @@
 
 -   `fontawesome5`
 -   `xcolor`
--   `tabu`
+-   `array`
+-   `xparse`
 
 Installation
 ============

Modified: trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex	2019-04-04 20:54:15 UTC (rev 50756)
+++ trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex	2019-04-04 20:54:25 UTC (rev 50757)
@@ -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 @@
 \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 @@
 
 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 @@
 \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 @@
 \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 @@
   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 @@
 
 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,9 +297,17 @@
 \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}
 
 This space is used before and after the awesome box. You can change it
@@ -285,16 +319,16 @@
 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 @@
 
 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 @@
 \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:
 

Modified: trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty	2019-04-04 20:54:15 UTC (rev 50756)
+++ trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty	2019-04-04 20:54:25 UTC (rev 50757)
@@ -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



More information about the tex-live-commits mailing list