summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/awesomebox
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-11-26 21:45:02 +0000
committerKarl Berry <karl@freefriends.org>2018-11-26 21:45:02 +0000
commit11ea1f565d0ede7b7fd6b1b8bddb3801beda5dce (patch)
tree1a62f5c0cbb73d8da87497245c2d94196bda7dd6 /Master/texmf-dist/tex/latex/awesomebox
parent038a07c08873a727349b98b6fc68cca3af0fad42 (diff)
awesomebox (26nov18)
git-svn-id: svn://tug.org/texlive/trunk@49256 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/awesomebox')
-rw-r--r--Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty139
1 files changed, 77 insertions, 62 deletions
diff --git a/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty b/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
index d14b1e667a2..7db70cbaf66 100644
--- a/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
+++ b/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
@@ -1,64 +1,46 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{awesomebox}[2018/01/31 v0.2]
+\ProvidesPackage{awesomebox}[2018/11/26 v0.4]
% Awesome Box has been written by Étienne Deparis and is released under
% the WTFPL (http://www.wtfpl.net/txt/copying/).
% A copy of this license is distributed in this package.
-
-
-\RequirePackage{ifxetex,ifluatex}
-\newif\ifawesomebox@notxetex\awesomebox@notxetextrue
-\ifxetex
- \awesomebox@notxetexfalse
-\else
- \ifluatex
- \awesomebox@notxetexfalse
- \fi
-\fi
-
-\ifawesomebox@notxetex
-\PackageError{awesomebox}{%
- You are trying to use awesomebox\MessageBreak
- with something else than xelatex or luatex
-}{%
- Please abort now with <ctrl+d>
-}
-\fi
-
-% This package heavily uses the work of Honza Ustohal, known under the
-% name FontAwesome bindings for (Xe)LaTeX:
-% https://gist.github.com/sway/3101743
-%
-% Translation of FontAwesome's private range characters into XeTeX
-% symbols. All icons are camel-cased and prefixed with 'abIcon', i.e. what
-% was .icon-align-center the CSS version of FontAwesome becomes
-% \abIconAlignCenter
%
-% New icons code could be retrieve from this page
-% http://fontawesome.io/cheatsheet/
-
-\def\abIconCheck{\symbol{"F00C}}
-\def\abIconInfoCircle{\symbol{"F05A}}
-\def\abIconFire{\symbol{"F06D}}
-\def\abIconExclamationCircle{\symbol{"F06A}}
-\def\abIconExclamationTriangle{\symbol{"F071}}
-\def\abIconCogs{\symbol{"F085}}
-\def\abIconThumbsUp{\symbol{"F087}}
-\def\abIconThumbsDown{\symbol{"F088}}
-\def\abIconCertificate{\symbol{"F0A3}}
-\def\abIconLightBulb{\symbol{"F0EB}}
-\def\abIconTwitter{\symbol{"F099}}
-\def\abIconGithub{\symbol{"F09B}}
-
-\RequirePackage{xltxtra}
-\newfontfamily{\ABFamily}{FontAwesome}
-
-% Some basic colors
+% Contributors:
+% v0.2: Vincent Goulet https://github.com/vigou3
+% v0.3: Gilbert Fuerer https://github.com/foreachthing
+% * Remove xelatex/luatex requirement and add pdflatex compatibility
+% v0.4: Marcel Krüger https://github.com/zauguin
+% * Fontawesome5 compatibility
+% Gilbert Fuerer
+% * Custom rule color
+
+
+% Try to just depend on fontawesome5 package
+% https://ctan.org/pkg/fontawesome5
+\RequirePackage{fontawesome5}
+
+% Compatibility with old version of this package
+\def\abIconCheck{\faCheck}
+\def\abIconInfoCircle{\faInfoCircle}
+\def\abIconFire{\faFire}
+\def\abIconExclamationCircle{\faExclamationCircle}
+\def\abIconExclamationTriangle{\faExclamationTriangle}
+\def\abIconCogs{\faCogs}
+\def\abIconThumbsUp{\faThumbsUp}
+\def\abIconThumbsDown{\faThumbsDown}
+\def\abIconCertificate{\faCertificate}
+\def\abIconLightBulb{\faLightbulb[regular]}
+\def\abIconTwitter{\faTwitter}
+\def\abIconGithub{\faGithub}
+
+% https://ctan.org/pkg/xcolor
\RequirePackage{xcolor}
+% Some basic colors
\definecolor{abnote}{RGB}{25,64,122}
\definecolor{abcaution}{RGB}{188,50,0}
\definecolor{abwarning}{RGB}{188,103,0}
\definecolor{abimportant}{RGB}{188,0,0}
+\definecolor{abvrulecolor}{RGB}{221,221,216}
\newlength{\aweboxleftmargin}
\setlength{\aweboxleftmargin}{9mm}
@@ -69,30 +51,63 @@
\newlength{\aweboxrulewidth}
\setlength{\aweboxrulewidth}{2pt}
-\RequirePackage{tabularx}
+% https://ctan.org/pkg/tabu
+\RequirePackage{tabu}
-% \awesomebox{icon}{rulewidth}{color}{content}
-\newcommand{\awesomebox}[4]{%
+% Commands API
+% \awesomebox[rulecolor]{rulewidth}{icon}{iconcolor}{content}
+\newcommand{\awesomebox}[5][abvrulecolor]{%
\vspace{\aweboxvskip}
\noindent
- \begin{tabularx}{\linewidth}{%
- m{\aweboxleftmargin}!{\color{#3}\vrule width #2}X}
- \raisebox{\aweboxsignraise}{\textcolor{#3}{\Huge\ABFamily#1}} & #4 \\
- \end{tabularx}
+ \begin{tabu} to \linewidth
+ {m{\aweboxleftmargin}!{\color{#1}\vrule width #2}X}
+ \raisebox{\aweboxsignraise}{\textcolor{#4}{\Huge#3}} & #5 \\
+ \end{tabu}
\vspace{\aweboxvskip}}
\newcommand{\notebox}[1]{%
- \awesomebox{\abIconInfoCircle}{\aweboxrulewidth}{abnote}{#1}}
+ \awesomebox[abnote]{\aweboxrulewidth}{\abIconInfoCircle}{abnote}{#1}}
\newcommand{\tipbox}[1]{%
- \awesomebox{\abIconLightBulb}{\aweboxrulewidth}{black}{#1}}
+ \awesomebox{\aweboxrulewidth}{\abIconLightBulb}{black}{#1}}
\newcommand{\warningbox}[1]{%
- \awesomebox{\abIconExclamationTriangle}{\aweboxrulewidth}{abwarning}{#1}}
+ \awesomebox[abwarning]{\aweboxrulewidth}{\abIconExclamationTriangle}{abwarning}{#1}}
\newcommand{\cautionbox}[1]{%
- \awesomebox{\abIconFire}{\aweboxrulewidth}{abcaution}{#1}}
+ \awesomebox[abcaution]{\aweboxrulewidth}{\abIconFire}{abcaution}{#1}}
\newcommand{\importantbox}[1]{%
- \awesomebox{\abIconExclamationCircle}{\aweboxrulewidth}{abimportant}{#1}}
+ \awesomebox[abimportant]{\aweboxrulewidth}{\abIconExclamationCircle}{abimportant}{#1}}
+
+% Environments API
+% \begin{awesomeblock}[rulecolor]{rulewidth}{icon}{iconcolor}
+% content
+% \end{awesomeblock}
+\newenvironment{awesomeblock}[4][abvrulecolor]%
+{\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}}
+
+\newenvironment{noteblock}%
+{\begin{awesomeblock}[abnote]{\aweboxrulewidth}{\abIconInfoCircle}{abnote}}
+ {\end{awesomeblock}}
+
+\newenvironment{tipblock}%
+{\begin{awesomeblock}{\aweboxrulewidth}{\abIconLightBulb}{black}}
+ {\end{awesomeblock}}
+
+\newenvironment{warningblock}%
+{\begin{awesomeblock}[abwarning]{\aweboxrulewidth}{\abIconExclamationTriangle}{abwarning}}
+ {\end{awesomeblock}}
+
+\newenvironment{cautionblock}%
+{\begin{awesomeblock}[abcaution]{\aweboxrulewidth}{\abIconFire}{abcaution}}
+ {\end{awesomeblock}}
+
+\newenvironment{importantblock}%
+{\begin{awesomeblock}[abimportant]{\aweboxrulewidth}{\abIconExclamationCircle}{abimportant}}
+ {\end{awesomeblock}}
\endinput