1

I'm writing a report and using shadowbox for some important points. I have used the code below and it is working fine. However, when I tried to use the bullet points an extra space is added to the start of the shadowbox. I not sure what is the problem?. I found another way to do the shadowbox by using xcolorbox, but I couldn't figure out how to change the parameters to get same as the below shadowbox.

Here is my code:

\documentclass{article}
\usepackage{varwidth}  
\usepackage{fancybox}

\newcommand\Cshadowbox{\VerbBox\@Cshadowbox}
 \def\@Cshadowbox#1{%
\setbox\@fancybox\hbox{\fbox{#1}}%
 \leavevmode\vbox{%
  \offinterlineskip
 \dimen@=\shadowsize
 \advance\dimen@ .5\fboxrule
 \hbox{\copy\@fancybox\kern.5\fboxrule\lower\shadowsize\hbox{%
  \color{ShadowColor}\vrule \@height\ht\@fancybox \@depth\dp\@fancybox   \@width\dimen@}}%
  \vskip\dimexpr-\dimen@+0.5\fboxrule\relax
  \moveright\shadowsize\vbox{%
  \color{ShadowColor}\hrule \@width\wd\@fancybox \@height\dimen@}}}

\begin{document}
 \shadowbox{
  \begin{varwidth}{\textwidth}\textbf{\begin{center} \textit{\begin{itemize}
          \item First item of the list  .
           \item Second item of the list.\\
           \end{itemize}}
              \bigskip 
           \end{center}
           } 
            \bigskip
            \end{varwidth}
 }
\bigskip 
\end{document}

Any suggestion to solve the space with current code or new suggestion ?

enter image description here

2
  • 1
    Remove the \begin{center}, and \end{center}, and add a % following \shadowbox { as in ` \shadowbox{%`. Commented Jun 16, 2014 at 1:16
  • Thanks a lot, it works. What's the point of the % ?
    – EngS
    Commented Jun 16, 2014 at 2:28

1 Answer 1

2

Here is how I would do it:

enter image description here

Notes:

  • Typically you should use \centering instead of the center environment (see References below). But, in this case, there is no point in centering as you care using varwidth.
  • Since you want the entire environment in italics and bold, I would use the switches \bfseries and \itshape for the font switching instead of the macros.
  • Be careful of spurious spaces. For instance, see what happens when you use \shadowbox{% instead of \shadowbox{. Extra space that was not intended gets inserted. Now, in this particular case you may not care, but it can lead to disastrous results (see Reference 4).

References:

  1. Should I use center or centering for figures and tables?

  2. When should we use \begin{center} instead of \centering?

  3. Is there a difference between \textit and \itshape?

  4. Tex Capacity Exceeded (if remove % after use of macro)

Code:

\documentclass{article}
\usepackage{varwidth}  
\usepackage{fancybox}

\begin{document}
\shadowbox{%
  \begin{varwidth}{\textwidth}\bfseries\itshape%
      \begin{itemize}
            \item First item of the list.
            \item Second item of the list.
       \end{itemize}
   \end{varwidth}%
}%
\bigskip\par 
\shadowbox{%
  \begin{varwidth}{\textwidth}\bfseries\itshape%
      \begin{itemize}
            \item[]
            \item First item of the list.
            \item Second item of the list.
            \item[]
       \end{itemize}
   \end{varwidth}%
 }%
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .