# Creating a command similar to \vrule

Upon trying to create a new border similar to the \vrule command, I have the following:

\documentclass{article}
\usepackage{xcolor,framed,lipsum}

\def\bulletfill{\vbox to 3ex{\vfil\hbox{$\bullet$}\vfil}}

\newenvironment{defn}[1][blue]{%
\def\FrameCommand##1{
\setbox0=\hbox{%
\colorbox{yellow!20}{%
##1
}%
}%
\usebox0}%
{\endMakeFramed}

\begin{document}
\begin{defn}
\lipsum[1-2]
\end{defn}
\end{document}


Unfortunately the \bullet is not being copied but if change \vbox to \ht0 to say \vbox to \vsize the bullets appear. Weird? The question is then, why is it behaving in such a manner and a possible solution to the copying of the bullet as a border.

-

Here a solution using mdframed

\documentclass{article}
\usepackage{xcolor,lipsum}
\usepackage[framemethod=TikZ]{mdframed}

\newmdenv[hidealllines=true,leftline=true,
linecolor=yellow!20,backgroundcolor=yellow!20,
tikzsetting={draw=blue,dashed,dash pattern= on 1pt off 3pt}]{defn}

\begin{document}
\begin{defn}
\lipsum[1-2]
\end{defn}
\end{document}

-
using your own packages is cheating:) – David Carlisle Feb 19 '13 at 18:07
@DavidCarlisle: I know ;-) – Marco Daniel Feb 19 '13 at 20:23

Found the solution. By defining the box content first allows for the existence of \ht0 for the use in the \vbox.

\newenvironment{defn}[1][blue]{%
\def\FrameCommand##1{%
\setbox0=\hbox{%
\colorbox{yellow!20}{%
##1
}%
}%
\usebox0}%
{\endMakeFramed}


A more orthodox set of LaTeX box commands would be

\newenvironment{defn}[1][blue]{%
\def\FrameCommand##1{%
\sbox{0}{\colorbox{yellow!20}{##1}%
}%

you are missing a % after ##1 you also have a strange mixture of latex and primitives, \usebox not \box or for latex \setbox not \savebox although it works beware primitive box saving commands are not colour safe – David Carlisle Feb 19 '13 at 17:22