答案1
正如所Cragfelt
建议的,tcolorbox
可以是另一种选择,如下面的例子所示。bclogo
可能是另一种选择。
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{fontawesome}
\newtcolorbox{myalert}[1][]{
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]
\begin{myalert}
This is some important advertisement!
\end{myalert}
\lipsum[2]
\end{document}
更新:使用自己的标识。
您可以使用命令插入自己的徽标\includegraphics
。在下面的代码中,您会发现使用 tcolorbox 的三种可能实现。第一种是将徽标作为 包含在内character
,第二种是将框分为徽标和文本,第三种是使用wrapfig
框包含包裹的徽标。
使用的标志来自开放剪贴画
\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{wrapfig}
%\usepackage{fontawesome}
\newtcolorbox{firstalert}[1][]{
enhanced,
notitle,
sharp corners,
boxrule=1pt,
borderline west={2mm}{0mm}{red},
width=.8\linewidth,
center,
before upper={\includegraphics[height=8mm]{Atencio}\ },
#1
}
\newtcolorbox{secondalert}[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
}
\newtcolorbox{thirdalert}[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}
\begin{firstalert}
This is some important advertisement! \lipsum[2]
\end{firstalert}
%\lipsum[2]
\begin{secondalert}[width=.9\linewidth]
\includegraphics[width=\textwidth]{Atencio}
\tcblower
This is some important advertisement! \lipsum[2]
\end{secondalert}
\begin{thirdalert}[width=.9\linewidth]
This is some important advertisement! \lipsum[2]
\end{thirdalert}
\end{document}