# Pretty formattings for warning and info blocks

I'm looking for pretty formatting for warnings, and others for some info or tips.

For the moment, I use the following formatting but maybe someone has one better idea.

To obtain this, I use the following code.

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[x11names,svgnames]{xcolor}
\usepackage{graphicx}
\usepackage{fourier-orns}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{calc}

\makeatletter
% Default settings for warnings
\newcommand{\warningSymbol}{\raisebox{0.8\depth}{\danger}}

\definecolor{warningColorText}{named}{Red3}
\definecolor{warningColorLine}{named}{Red3}
\definecolor{warningColorBack}{named}{LemonChiffon1}
\definecolor{warningColorBackSymbol}{named}{white}

% Inline mode
\newcommand{\warning}[1]{%
\textcolor{warningColorText}{\warningSymbol{}\,#1}%
}

% Block mode
\tikzset{
warningsymbol/.style={
rectangle,
draw  = warningColorText,
fill  = warningColorBackSymbol,
scale = 1,
overlay
}
}

\mdfdefinestyle{warning}{%
hidealllines      = true,
leftline          = true,
skipabove         = 12,
skipbelow         = 12pt,
innertopmargin    = 0.4em,%
innerbottommargin = 0.4em,%
innerrightmargin  = 0.7em,%
rightmargin       = 0.85em,%
innerleftmargin   = 1.1em,%
leftmargin        = 0.85em,%
middlelinewidth   = .2em,%
linecolor         = warningColorLine,%
backgroundcolor   = warningColorBack,%
fontcolor         = warningColorText,%
firstextra        = {
\path let \p1=(P), \p2=(O) in ($(\x2,\y1-4)$)
node[warningsymbol] {\warningSymbol};
},%
secondextra       = {
\path let \p1=(P), \p2=(O) in ($(\x2,\y1-4)$)
node[warningsymbol] {\warningSymbol};
},%
middleextra       = {
\path let \p1=(P), \p2=(O) in ($(\x2,\y1-4)$)
node[warningsymbol] {\warningSymbol};
},%
singleextra       = {
\path let \p1=(P), \p2=(O) in ($(\x2,\y1-4)$)
node[warningsymbol] {\warningSymbol};
},%
}

\newmdenv[style=warning]{@Warning}
\newenvironment{Warning}{\let\warning\relax\begin{@Warning}}{\end{@Warning}}
\makeatother

\usepackage{lipsum}

\begin{document}

\warning{IMPORTANT !} \lipsum[1]

\begin{Warning}
\lipsum[1]
\end{Warning}

\end{document}

-
 Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). – Tobi Aug 13 '12 at 11:05

You might have a look at the bclogo package.1 It allows you easily to create custom warning, information etc. blocks:

\documentclass{article}

\usepackage{lipsum}
\usepackage[svgnames]{xcolor}
\usepackage[tikz]{bclogo}

\begin{document}
\begin{bclogo}[logo=\bcattention, noborder=true, barre=none]{Important!}
\lipsum[1]
\end{bclogo}
\end{document}


\begin{bclogo}[logo=\bcattention, couleurBarre=red, noborder=true,
couleur=LightSalmon]{Important!}
\lipsum[1]
\end{bclogo}


\begin{bclogo}[logo=\bcinfo, couleurBarre=orange, noborder=true, couleur=white]{Information}
\lipsum[1]
\end{bclogo}
\end{document}


1 I just remarked that the manual is in French only. But as it is full of examples it shouldn't be a problem to understand it. Even for non-French speakers.

-
 Thanks for this. – projetmbc Apr 25 '12 at 21:27

I’m using something like this for important parts.

\documentclass{article}

\usepackage{xcolor,mdframed}

\newenvironment{important}[1][]{%
\begin{mdframed}[%
backgroundcolor={red!15}, hidealllines=true,
skipabove=0.7\baselineskip, skipbelow=0.7\baselineskip,
splitbottomskip=2pt, splittopskip=4pt, #1]%
\makebox[0pt]{% ignore the withd of !
\smash{% ignor the height of !
\fontsize{32pt}{32pt}\selectfont% make the ! bigger
\hspace*{-19pt}% move ! to the left
\raisebox{-2pt}{% move ! up a little
{\color{red!70!black}\sffamily\bfseries !}% type the bold red !
}%
}%
}%
}{\end{mdframed}}

\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{important}
\lipsum[2]
\end{important}
\lipsum[1]
\end{document}

-
 Thanks for this. – projetmbc Apr 25 '12 at 21:27