Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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{
{\color{#1}\vbox to \ht0{\xleaders\bulletfill\vfill}}%
\setbox0=\hbox{%
\colorbox{yellow!20}{%
##1
}%
}%
\usebox0}%
\MakeFramed {\advance\hsize -\width \FrameRestore}}%
{\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.

share|improve this question

2 Answers 2

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}
share|improve this answer
3  
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
}%
}%
{\color{#1}\vbox to \ht0{\xleaders\bulletfill\vfill}}%
\usebox0}%
\MakeFramed {\advance\hsize -\width \FrameRestore}}%
{\endMakeFramed}

added note from David:

A more orthodox set of LaTeX box commands would be

\newenvironment{defn}[1][blue]{%
\def\FrameCommand##1{%
\sbox{0}{\colorbox{yellow!20}{##1}%
}%
\parbox[b][\ht0]{0pt}{\color{#1}\xleaders\bulletfill\vfill}%
\usebox{0}}%
\MakeFramed {\advance\hsize -\width \FrameRestore}}%
{\endMakeFramed}
share|improve this answer
    
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
    
@DavidCarlisle So what should be used? I would appreciate the correction as an edit. –  azetina Feb 19 '13 at 17:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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