4

I have this:

\usepackage{picins}
\shadowthickness{2pt}
\newcommand{\sidenote}[1]{
    \begin{center}
    \hpic(0.95\textwidth,0pt)[rs]{
        \parbox[b]{0.9\textwidth}{\small
             \bigskip{#1}\bigskip
        }
    }
    \end{center}
}

Which generates a nice (shadowed) box with padding. The problem is that \sidenote cannot accept formatted text (i.e. paragraphs).

Is it possible to define a "FancyRemark" environment which has the same visual style but does allow for paragraphs and display style math?

1
  • Assuming you want an output similar to the current answer, I would use mdframed- it allows you to tweak everything very easily...
    – cmhughes
    Commented Jan 29, 2013 at 22:33

2 Answers 2

3

Sorry, picins somehow does not seem to work at the moment, on this machine.

This is what I guess you wanted:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shadows}
\usepackage{environ}
\NewEnviron{sidenote}{%
  \begin{tikzpicture}[font=\normalsize]
      \node [text width=0.9\linewidth,draw,drop shadow,fill=white,inner sep=10pt]{%
           \BODY
        };
   \end{tikzpicture}
}
\begin{document}
\begin{sidenote}
  sfasdfasdfasdf
\begin{equation}
1+2=3
\end{equation}
\end{sidenote}
\end{document}

Example figure

Please give me a preview, if you want me to tweak the looks to your expectations.

4
  • That's great. Thank you. If I could just get a parameter for `cellpadding' within the box I can tweak the values on my end.
    – vrbatim
    Commented Jan 29, 2013 at 22:02
  • I assume you mean padding as in HTML5 http://www.w3schools.com/tags/att_table_cellpadding.asp ? That would be inner sep. I inserted that with 10pt. Any TeX dimension is allowed.
    – DennisH
    Commented Jan 29, 2013 at 22:08
  • Followup question: How can \sidenote be made to respect the current font size? (It seems to be outputting 12pt whereas the document is set to 11pt).
    – vrbatim
    Commented Feb 11, 2013 at 18:12
  • It should be typeset in normalsize, but I added an option to force it, just to be sure.
    – DennisH
    Commented Feb 11, 2013 at 19:39
4

Here are some options using environments defined with the help of the mdframed and tcolorbox packages; the advantage of using these packages is that the offer an easy customization mechanism and the frames allow page breaks:

\documentclass{article}
\usepackage{picins}
\usepackage[most]{tcolorbox}
\usepackage[framemethod=tikz]{mdframed}
\usetikzlibrary{shadows}

\newmdenv[
leftmargin=10pt,
rightmargin=10pt,
innertopmargin=10pt,
innerbottommargin=10pt,
shadow=true,
]{mdsidenote}

\newtcolorbox{tsidenote}{
breakable,
enhanced,
colback=white,
width=\dimexpr\linewidth-20pt\relax,
enlarge left by=10pt,
shadow={1mm}{-1mm}{0mm}{black!40}
}

\shadowthickness{2pt}
\newcommand{\sidenote}[1]{
    \begin{center}
    \hpic(0.95\textwidth,0pt)[rs]{
        \parbox[b]{0.9\textwidth}{\small
             \bigskip{#1}\bigskip
        }
    }
    \end{center}
}

\newcommand\Text{% just to generate text for the example
Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae lacus
tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In hac habitasse platea dictumst.}

\begin{document}

\sidenote{some text goes here}

\begin{mdsidenote}
Some text inside the environment; a displayed expression and some paragraphs:
\[
a + b = c + d+ e.
\]
\Text\par\Text
\end{mdsidenote}

\begin{tsidenote}
Some text inside the environment; a displayed expression and some paragraphs:
\[
a + b = c + d+ e.
\]
\Text\par\Text
\end{tsidenote}

\end{document}

enter image description here

You must log in to answer this question.

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