From 946174b6ac80270b5bc3b73ea7ed34c3a24fe92e Mon Sep 17 00:00:00 2001
From: Sébastien Dailly <sebastien@chimrod.com>
Date: Mon, 26 Feb 2018 11:01:55 +0100
Subject: Update DUStyle style for latex

---
 .../texmf/tex/latex/docUtils/DUStyle/DUStyle.sty   | 44 +++++++++++++++-------
 1 file changed, 31 insertions(+), 13 deletions(-)

(limited to 'latex_docutils/texmf/tex/latex/docUtils/DUStyle/DUStyle.sty')

diff --git a/latex_docutils/texmf/tex/latex/docUtils/DUStyle/DUStyle.sty b/latex_docutils/texmf/tex/latex/docUtils/DUStyle/DUStyle.sty
index 45092b2..cd5a40e 100644
--- a/latex_docutils/texmf/tex/latex/docUtils/DUStyle/DUStyle.sty
+++ b/latex_docutils/texmf/tex/latex/docUtils/DUStyle/DUStyle.sty
@@ -1,34 +1,52 @@
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
 \ProvidesPackage{DUStyle}[2018/02/25 DUStyle Package]
 
+% The macro can be used to create your own style :
+% the style will apply by declaring a custom class :
+
+%\createIconifiedDUStyle{warning}{orange}{!}{large}
+%\createIconifiedDUStyle{note}{blue}{}{large}
+
+% .. admonition:: Title
+%   :class: warning
+
+% .. sidebar:: Title
+%  :class: note
+
 \RequirePackage{tikz}
 \RequirePackage{mdframed}
 \RequirePackage{xcolor}
+\RequirePackage{ifthen}
 
-\definecolor{lightGray}{RGB}{245, 245, 245}
+% Background color for the frame.
+\definecolor{DUStyle@lightGray}{RGB}{245, 245, 245}
 
 % arg1 : The circle backround color
-% arg2 : The dot text
-% arg3 : The title command prefix
+% arg2 : The dot content
+% arg3 : The title environment
 % arg4 : The title
-\newcommand{\DUIconizedTitle}[4]{%
-  \begin{#3}
-  \tikz[baseline]{
-    \node[circle,fill=#1,inner sep=3pt,anchor=base] at (0, 0) 
-    {\color{lightGray}#2};
-  }
+\newcommand{\DUStyle@iconizedTitle}[4]{%
+  \begin{#3}%
+  \ifthenelse{\equal{#2}{}}
+    {}
+    {%
+      \tikz[baseline]{%
+        \node[circle,fill=#1,inner sep=3pt,anchor=base] at (0, 0)%
+        {\color{DUStyle@lightGray}#2};
+      }%
+    }
   {#4}
   \end{#3}
 }
 
-\newcommand{\colorBox}[2]{%
+\newcommand{\DUStyle@colorBox}[2]{%
   \begin{mdframed}[topline=false,
     bottomline=false,
     rightline=false,
     linecolor=#1,
     linewidth=3pt,
     skipabove=0.5cm,
-    backgroundcolor=lightGray]%
+    backgroundcolor=DUStyle@lightGray]%
     #2
   \end{mdframed}
 }
@@ -37,8 +55,8 @@
 % - for the admonition colored box
 % - for the titles in styles (sidebar, admonitions...)
 \newcommand\createIconifiedDUStyle[4]{%
-  \expandafter\newcommand\csname DUadmonition#1\endcsname[1]{\colorBox{#2}{##1}}
-  \expandafter\newcommand\csname DUtitle#1\endcsname[1]{\DUIconizedTitle{#2}{#3}{#4}{##1}}
+  \expandafter\newcommand\csname DUadmonition#1\endcsname[1]{\DUStyle@colorBox{#2}{##1}}
+  \expandafter\newcommand\csname DUtitle#1\endcsname[1]{\DUStyle@iconizedTitle{#2}{#3}{#4}{##1}}
 }
 
 
-- 
cgit v1.2.3

