5

I am trying to draw a text box with rounded corner and shadow like this:

enter image description here

I have no idea how to do this. The only I managed to do is this:

\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. 
    }%
}

Which only draws a box but not with rounded corner and shadow.

Can someone please suggest me a solution?

1
  • Take a look at the tcolorbox package.
    – leandriis
    Jul 20 '20 at 20:41
4

enter image description here

\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}

If you want to use the same style of box multiple times in your document, you can also define it in the preamble using \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}
4

Another idea considering the mdframed package rev. 212 with the use of TikZ. If you want to increase the rounded corner you increase the value 8pt. And for the thickness of the border you increase the value of 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}

enter image description here

Another alternative without the use of mdframed can be with pure TikZ using the library shadows to make the drop shadows at the below-right:

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.