# Create a special small box or environment for highlighting special content such examples, reference and links?

I am trying to create a box or a coloured section with a border and a logo, something like this warning section:

Or like this, not so nice, code link:

Which is repeated during the book for highlighting when some reference to a code is used.

# How can create my own?

I was trying to use \newcommand or \newenvironment but I would appreciate some recommendations before starting some trials.

• Have you considered the tcolorbox package? – Cragfelt Nov 14 '17 at 10:23
• @Cragfelt yes also the bclogo but I can not understand how to add my own logo, I can use only the defult logos/icons. – G M Nov 14 '17 at 15:02

As Cragfelt suggested, tcolorbox could be an alternative as it's shown in following example. bclogo could be another option.

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{fontawesome}

enhanced,
notitle,
sharp corners,
boxrule=1pt,
borderline west={2mm}{0mm}{red},
width=.8\linewidth,
center,
before upper={\textcolor{red}{\large\faBomb\ }},
#1
}

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


Update: using own logos.

Your own logo can be inserted with \includegraphics command. In following code you'll find three possible implementations with tcolorbox. The first one includes the logo as a character, the second one divides the box between logo and text and the third one uses wrapfig box to include a wrapped logo.

Used logo comes from openclipart

\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{wrapfig}
%\usepackage{fontawesome}

enhanced,
notitle,
sharp corners,
boxrule=1pt,
borderline west={2mm}{0mm}{red},
width=.8\linewidth,
center,
before upper={\includegraphics[height=8mm]{Atencio}\ },
#1
}

enhanced,
sidebyside,
lefthand width=2cm,
bicolor,
colback=red!20,
colbacklower=yellow!10,
notitle,
sharp corners,
boxrule=1pt,
borderline west={2mm}{0mm}{red},
width=.8\linewidth,
center,
#1
}

enhanced,
notitle,
sharp corners,
boxrule=1pt,
borderline west={2mm}{0mm}{red},
width=.8\linewidth,
center,
before upper={\begin{wrapfigure}{l}{.2\linewidth}\centering\includegraphics[width=.9\linewidth]{Atencio}\end{wrapfigure}},
#1
}

\begin{document}
%\lipsum[2]