texlive[51776] Master/texmf-dist: awesomebox (30jul19)

commits+karl at tug.org commits+karl at tug.org
Tue Jul 30 22:59:04 CEST 2019


Revision: 51776
          http://tug.org/svn/texlive?view=revision&revision=51776
Author:   karl
Date:     2019-07-30 22:59:04 +0200 (Tue, 30 Jul 2019)
Log Message:
-----------
awesomebox (30jul19)

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-07-30 00:11:43 UTC (rev 51775)
+++ trunk/Master/texmf-dist/doc/latex/awesomebox/README.md	2019-07-30 20:59:04 UTC (rev 51776)
@@ -16,9 +16,10 @@
 The following LaTeX packages are required (they should be already
 included in your LaTeX distribution):
 
+-   `array`
 -   `fontawesome5`
+-   `ifthen`
 -   `xcolor`
--   `array`
 -   `xparse`
 
 Installation
@@ -30,6 +31,25 @@
 For system wide installation, please refer to the documentation of your
 LaTeX distribution.
 
+Compatibility
+=============
+
+This repository also hosts the package `awesomebox-compat`, which
+depends on the `fontawesome` package, instead of `fontawesome5`. Apart
+from that, it has the exact same features set.
+
+This can be usefull for you if you want to use it with an old LaTeX
+distribution, which does not embed `fontawesome5` yet (like Overleaf
+system). To use it, download the file `awesomebox-compat.sty` in this
+repository, put it near your tex files and just replace your
+`\usepackage{awesomebox}` instruction by
+`\usepackage{awesomebox-compat}`.
+
+Be aware that icon names changes between FontAwesome and FontAwesome5
+and thus using the compatibility package may break your current files.
+FontAwesome also requires you to use XeLaTeX or LuaTeX: you cannot use
+PDFLaTeX with the compatibility package.
+
 License
 =======
 

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-07-30 00:11:43 UTC (rev 51775)
+++ trunk/Master/texmf-dist/doc/latex/awesomebox/awesomebox.tex	2019-07-30 20:59:04 UTC (rev 51776)
@@ -19,7 +19,14 @@
 %\usepackage[T1]{fontenc}
 %\usepackage[english,frenchb]{babel}
 
-\usepackage[vmargin=2cm,hmargin=3cm,includeheadfoot=true]{geometry}
+\usepackage{geometry}
+\geometry{
+  xetex,
+  vmargin=2cm,
+  hmargin=3cm,
+  includeheadfoot,
+  nomarginpar
+}
 \linespread{1.2}
 
 \newcommand{\cf}[1]{(\emph{cf.} section \ref{#1}, %
@@ -29,7 +36,7 @@
 \newcommand{\colophon}{
   ~\vfill
   \begin{center}
-    \scriptsize Prepared with \faHeart{} from Nantes,
+    \scriptsize Handcrafted with \faHeart{} from Nantes,
     France\\
     Awesome Box is released under the
     \hrefcolor{http://www.wtfpl.net/txt/copying/}{WTFPL}. A copy of this
@@ -38,6 +45,10 @@
   \end{center}
 }
 
+\title{Awesome Boxes}
+\author{Étienne Deparis}
+\date{2019-07-27 v0.6}
+
 % configuration de la transformation en PDF
 \usepackage[pdfusetitle]{hyperref}
 \hypersetup{
@@ -50,10 +61,6 @@
 
 \newcommand\hrefcolor[2]{\textcolor{magenta}{\href{#1}{#2}}}
 
-\title{Awesome Boxes}
-\author{Étienne Deparis}
-\date{2019-04-04 v0.5}
-
 \begin{document}
 
 \maketitle
@@ -155,7 +162,6 @@
 \end{noteblock}
 \end{verbatim}
 
-
 For the exactly same rendering:
 
 \begin{noteblock}
@@ -188,7 +194,7 @@
 command:
 
 \begin{center}
-\verb!\awesomebox[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}{your text content}!
+\verb!\awesomebox[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}{content}!
 \end{center}
 
 Here are some examples of custom boxes:
@@ -205,6 +211,8 @@
   dictum felis. Pellentesque tortor lacus, semper et neque vitae,
   egestas commodo nisl.}
 
+\clearpage
+
 \begin{center}
 \verb!\awesomebox{0pt}{\faCogs}{black}{Lorem ipsum…}!
 \end{center}
@@ -229,8 +237,9 @@
   dictum felis. Pellentesque tortor lacus, semper et neque vitae,
   egestas commodo nisl.}
 
+\vspace{2mm}
 \begin{center}
-\verb!\awesomebox[white][\abShortLine]{0pt}{\faGrinBeam[regular]}{black}{Lorem ipsum…}!
+\small\verb!\awesomebox[white][\abShortLine]{0pt}{\faGrinBeam[regular]}{black}{Lorem ipsum…}!
 \end{center}
 
 \awesomebox[white][\abShortLine]{0pt}{\faGrinBeam[regular]}{black}{%
@@ -241,10 +250,9 @@
   dictum felis. Pellentesque tortor lacus, semper et neque vitae,
   egestas commodo nisl.}
 
-\clearpage
-
+\vspace{2mm}
 \begin{center}
-\verb!\awesomebox[white][\abLongLine][\textbf{Watch out}]{0pt}{\faBomb}{black}{Lorem ipsum…}!
+\small\verb!\awesomebox[white][\abLongLine][\textbf{Watch out}]{0pt}{\faBomb}{black}{Lorem…}!
 \end{center}
 
 \awesomebox[white][\abLongLine][\textbf{Watch out}]{0pt}{\faBomb}{black}{%
@@ -291,28 +299,39 @@
 
 \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).
+Some internal options can be customized, in order to globally modify
+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
-(\verb!0.08\linewidth! is the default one):\\
-\verb!\setlength{\aweboxleftmargin}{0.08\linewidth}!.
+The left margin is the space left to display the icon before the
+vertical rule. You can change it with the following command
+(\verb!0.12\linewidth! is the default one):\\
+\verb!\setlength{\aweboxleftmargin}{0.12\linewidth}!.
 
+You must declare you new length \emph{after} the \verb!\begin{document}!
+instruction, or your custom length will be overriden by the default
+one.
+
 \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}!.
+(\verb!0.88\linewidth! is the default one):\\
+\verb!\setlength{\aweboxcontentwidth}{0.88\linewidth}!.
 
+You must declare you new length \emph{after} the \verb!\begin{document}!
+instruction, or your custom length will be overriden by the default
+one.
+
 \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}!.
 
+You can put your new length either in the header or in the body of your
+document.
+
 \subsection{Sign raise}
 
 This length is used to raise (or lower) the left icon. Its default value
@@ -319,6 +338,9 @@
 is -5mm and you can change it with:
 \verb!\setlength{\aweboxsignraise}{-5mm}!.
 
+You can put your new length either in the header or in the body of your
+document.
+
 \subsection{Vertical rule width}
 
 This width is used for the vertical rule of our four default boxes. Its
@@ -325,6 +347,9 @@
 default value is 2pt and you can change it with:
 \verb!\setlength{\aweboxrulewidth}{2pt}!.
 
+You can put your new length either in the header or in the body of your
+document.
+
 \subsection{Vertical rule default color}
 
 The vertical rule color is an optional argument passed to the commands
@@ -340,7 +365,7 @@
 \begin{verbatim}
 \begin{itemize}
 \item My first item
-\item My second item with \notebox{A note box!}
+\item Lorem ipsum… \notebox{Fusce aliquet…}
 \item Last and finally
 \end{itemize}
 \end{verbatim}
@@ -349,7 +374,11 @@
 
 \begin{itemize}
 \item My first item
-\item My second item with \notebox{A note box!}
+\item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam
+  aliquet libero quis lectus elementum fermentum. \notebox{Fusce aliquet
+    augue sapien, non efficitur mi ornare sed. Morbi at dictum
+    felis. Pellentesque tortor lacus, semper et neque vitae, egestas
+    commodo nisl.}
 \item Last and finally
 \end{itemize}
 
@@ -370,16 +399,12 @@
 
 \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}
@@ -402,10 +427,29 @@
 
 \section{Breaking changes}
 
-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.
+\subsection{Version 0.6}
 
+This version improved a lot block components rendering. Historically,
+awesome box used fixed length to display icon and content. This leads to
+admonition block to overflow or to be thinner than paragraphs around.
+
+Please note that we change default block components width in purpose. It
+used to be \verb!0.08\linewidth! for the margin and
+\verb!0.92\linewidth! for the content. It is now \verb!0.12\linewidth!
+for the margin and \verb!0.88\linewidth! for the content.
+
+We now compute the default \verb!\aweboxleftmargin! and
+\verb!\aweboxcontentwidth! value in a \verb!\AtBeginDocument!
+command. Thus, to avoid your custom lengths to be overriden by the
+default ones, you must declare them \emph{after} the
+\verb!\begin{document}! instruction.
+
+\subsection{Version 0.4}
+
+This version introduced 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}
@@ -413,7 +457,7 @@
 \end{center}
 
 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
+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:
 
@@ -422,11 +466,11 @@
 \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.
+\verb!\notebox!, \verb!\tipbox!, \texttt{\textbackslash warn\-ing\-box},
+\verb!\cautionbox!, \verb!\importantbox! commands or the
+\texttt{noteblock}, \texttt{tipblock}, \texttt{caution\-block},
+\texttt{warningblock}, \texttt{importantblock} environments) you are not
+affected by this change and your documents will work without any change.
 
 \colophon
 

Modified: trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty	2019-07-30 00:11:43 UTC (rev 51775)
+++ trunk/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty	2019-07-30 20:59:04 UTC (rev 51776)
@@ -1,5 +1,5 @@
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{awesomebox}[2019/04/04 v0.5]
+\ProvidesPackage{awesomebox}[2019/07/27 v0.6]
 
 % Awesome Box has been written by Étienne Deparis and is released under
 % the WTFPL (http://www.wtfpl.net/txt/copying/).
@@ -15,6 +15,8 @@
 % * Custom vertical rule color
 % v0.5: Georger Araújo https://github.com/georgerbr
 % * Horizontal rules at top and bottom, title
+% v0.6: Vincent Goulet https://github.com/vigou3
+% * Improving table cell rendering
 
 % https://ctan.org/pkg/fontawesome5
 \RequirePackage{fontawesome5}
@@ -42,10 +44,9 @@
 \definecolor{abimportant}{RGB}{188,0,0}
 \definecolor{abvrulecolor}{RGB}{221,221,216}
 
+% Customizable length
 \newlength{\aweboxleftmargin}
-\setlength{\aweboxleftmargin}{0.08\linewidth}
 \newlength{\aweboxcontentwidth}
-\setlength{\aweboxcontentwidth}{0.92\linewidth}
 \newlength{\aweboxvskip}
 \setlength{\aweboxvskip}{5mm}
 \newlength{\aweboxsignraise}
@@ -53,6 +54,10 @@
 \newlength{\aweboxrulewidth}
 \setlength{\aweboxrulewidth}{2pt}
 
+\AtBeginDocument{%
+  \setlength{\aweboxleftmargin}{0.12\linewidth}%
+  \setlength{\aweboxcontentwidth}{0.88\linewidth}}
+
 \RequirePackage{array}
 
 % To allow for more than one optional argument
@@ -62,17 +67,35 @@
 \def\abShortLine{\cline{2-2}}
 \def\abLongLine{\hline}
 
+% The following commands are used to adjust and restore awesome boxes
+% content width in respect to the current environment (e.g. lists).
+\RequirePackage{ifthen}
+\newlength{\aweboxlinewidthvar}
+\setlength{\aweboxlinewidthvar}{0pt}
+\newlength{\aweboxlinewidthref}
+\AtBeginDocument{\setlength{\aweboxlinewidthref}{\linewidth}}
+\newcommand{\awesomeboxadjustcontentwidth}{%
+  \ifthenelse{\lengthtest{\linewidth=\aweboxlinewidthref}}{}{%
+    \setlength{\aweboxlinewidthvar}{\dimexpr\aweboxlinewidthref-\linewidth}%
+    \setlength{\aweboxcontentwidth}{\dimexpr\aweboxcontentwidth-\aweboxlinewidthvar}}}%
+    %\aweboxdebug}}
+\newcommand{\awesomeboxrestorecontentwidth}{%
+  \ifthenelse{\lengthtest{\linewidth=\textwidth}}{}{%
+    \setlength{\aweboxcontentwidth}{\dimexpr\aweboxcontentwidth+\aweboxlinewidthvar}%
+    \setlength{\aweboxlinewidthvar}{0pt}}}
+
 % Commands API
 % \awesomebox[vrulecolor][hrule][title]{vrulewidth}{icon}{iconcolor}{content}
 \NewDocumentCommand \awesomebox { O{abvrulecolor} O{} o m m m +m }{%
-  \vspace{\aweboxvskip}\noindent
+  {\vskip \aweboxvskip}\noindent\awesomeboxadjustcontentwidth%
   \begin{tabular}%
-    {p{\aweboxleftmargin}!{\color{#1}\vrule width #4}p{\aweboxcontentwidth}}
+    {@{}>{\centering\arraybackslash}%
+    p{\aweboxleftmargin}@{}!{\color{#1}\vrule width #4}%
+    p{\dimexpr\aweboxcontentwidth-#4-\tabcolsep}@{}}
     \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}}
+  \end{tabular}{\vskip \aweboxvskip}\awesomeboxrestorecontentwidth}
 
 \newcommand{\notebox}[1]{%
   \awesomebox[abnote]{\aweboxrulewidth}{\abIconInfoCircle}{abnote}{#1}}
@@ -94,13 +117,15 @@
 %   content
 % \end{awesomeblock}
 \NewDocumentEnvironment{awesomeblock}{ O{abvrulecolor} O{} o m m m }
-{\vspace{\aweboxvskip}\noindent
+{{\vskip \aweboxvskip}\noindent\awesomeboxadjustcontentwidth%
   \begin{tabular}%
-    {p{\aweboxleftmargin}!{\color{#1}\vrule width #4}p{\aweboxcontentwidth}}
+    {@{}>{\centering\arraybackslash}%
+    p{\aweboxleftmargin}@{}!{\color{#1}\vrule width #4}%
+    p{\dimexpr\aweboxcontentwidth-#4-\tabcolsep}@{}}
     \IfValueTF {#3}
       { & #3 \\ #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} &}
       {         #2 \raisebox{\aweboxsignraise}{\textcolor{#6}{\Huge#5}} &}}
-{\\ #2 \end{tabular}\vspace{\aweboxvskip}}
+{\\ #2 \end{tabular}{\vskip \aweboxvskip}\awesomeboxrestorecontentwidth}
 
 \newenvironment{noteblock}%
 {\begin{awesomeblock}[abnote]{\aweboxrulewidth}{\abIconInfoCircle}{abnote}}
@@ -122,4 +147,13 @@
 {\begin{awesomeblock}[abimportant]{\aweboxrulewidth}{\abIconExclamationCircle}{abimportant}}
   {\end{awesomeblock}}
 
+\newcommand{\aweboxdebug}{%
+  \typeout{**************************}%
+  \typeout{Line width: \the\linewidth}%
+  \typeout{Reference line width: \the\aweboxlinewidthref\space(text width: \the\textwidth)}%
+  \typeout{Width difference: \the\aweboxlinewidthvar}%
+  \typeout{Margin width: \the\aweboxleftmargin}%
+  \typeout{Content width: \the\aweboxcontentwidth}%
+  \typeout{**************************}}
+
 \endinput



More information about the tex-live-commits mailing list