summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/awesomebox/awesomebox.sty
blob: 118541619664e356e27972546ea61c252756c318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{awesomebox}[2016/11/22 v0.1]

% 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
\RequirePackage{xcolor}
\definecolor{abnote}{RGB}{25,64,122}
\definecolor{abcaution}{RGB}{188,50,0}
\definecolor{abwarning}{RGB}{188,103,0}
\definecolor{abimportant}{RGB}{188,0,0}

\newlength{\aweboxleftmargin}
\setlength{\aweboxleftmargin}{9mm}
\newlength{\aweboxvskip}
\setlength{\aweboxvskip}{5mm}
\newlength{\aweboxsignraise}
\setlength{\aweboxsignraise}{-5mm}
\newlength{\aweboxrulewidth}
\setlength{\aweboxrulewidth}{2pt}

\RequirePackage{tabularx}

% \awesomebox{icon}{rulewidth}{color}{content}
\newcommand{\awesomebox}[4]{%
  \vspace{\aweboxvskip}
  \noindent
  \begin{tabularx}{\textwidth}{%
      m{\aweboxleftmargin}!{\color{#3}\vrule width #2}X}
    \raisebox{\aweboxsignraise}{\textcolor{#3}{\Huge\ABFamily#1}} & #4 \\
  \end{tabularx}
  \vspace{\aweboxvskip}}

\newcommand{\notebox}[1]{%
  \awesomebox{\abIconInfoCircle}{\aweboxrulewidth}{abnote}{#1}}

\newcommand{\tipbox}[1]{%
  \awesomebox{\abIconLightBulb}{\aweboxrulewidth}{black}{#1}}

\newcommand{\warningbox}[1]{%
  \awesomebox{\abIconExclamationTriangle}{\aweboxrulewidth}{abwarning}{#1}}

\newcommand{\cautionbox}[1]{%
  \awesomebox{\abIconFire}{\aweboxrulewidth}{abcaution}{#1}}

\newcommand{\importantbox}[1]{%
  \awesomebox{\abIconExclamationCircle}{\aweboxrulewidth}{abimportant}{#1}}
\endinput