如何用阴影在框周围绘制圆角

如何用阴影在框周围绘制圆角

我正在尝试绘制一个带有圆角和阴影的文本框,如下所示:

在此处输入图片描述

我不知道该怎么做。我唯一能做的就是:

\noindent\fbox{%
    \parbox{\textwidth}{%
        The content of this chapter has been published in the SRRW conference in 2017.  The work of this chapter is also extended to handle the ER problem. 
    }%
}

它只绘制了一个框,但没有圆角和阴影。

有人可以给我建议一个解决方案吗?

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\begin{document}

\begin{tcolorbox}[enhanced jigsaw,drop shadow=black!50!white,colback=white]
The content of this chapter has been published in the SRRW conference in 2017.  The work of this chapter is also extended to handle the ER problem. 
\end{tcolorbox}
\end{document}

如果你想要在文档中多次使用相同风格的框,你也可以在序言中使用以下命令进行定义\newtcolorbox

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}

\newtcolorbox{mybox}
{
  enhanced jigsaw,
  drop shadow=black!50!white,
  colback=white
}

\begin{document}

\begin{mybox}
The content of this chapter has been published in the SRRW conference in 2017.  The work of this chapter is also extended to handle the ER problem. 
\end{mybox}
\end{document}

答案2

另一个想法是考虑到mdframed软件包 rev. 212 的使用TikZ。如果您想增加圆角,请增加值8pt。对于边框的厚度,您可以增加值middlelinewidth=2pt

\documentclass[a4paper,12pt]{article}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{shadows}
\newmdenv[tikzsetting={draw=gray,fill=white},
          roundcorner=8pt,shadow=true]{mdboxshad}
\mdfsetup{%
middlelinewidth=2pt
}
\begin{document}

\begin{mdboxshad}
The content of this chapter has been published in the SRRW conference in 2017.  The work of this chapter is also extended to handle the ER problem. 
\end{mdboxshad}

\end{document}

在此处输入图片描述

另一种不使用的替代方法mdframed是纯粹TikZ使用库shadows来制作drop shadows右下图所示的内容:

\documentclass[a4paper, 12pt]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{tikz} 
\usetikzlibrary{shadows}

\newcommand{\mybox}[2]{
    \begin{figure}[h]
        \centering
    \begin{tikzpicture}
        \node[anchor=text, text width=\textwidth, draw=gray, rounded corners, line width=1.5pt, drop shadow={shadow xshift=.7ex, shadow yshift=-.7ex},fill=#1, inner sep=3mm] (big) {\\#2};
            \end{tikzpicture}
    \end{figure}
}
\begin{document}
\mybox{white}{The content of this chapter has been published in the SRRW conference in 2017. The work of this chapter is also extended to handle the ER problem.}
\end{document}

在此处输入图片描述

相关内容