[texhax] Selecting which edge should be framed in a box

José Romildo Malaquias j.romildo at gmail.com
Sun May 2 19:57:30 CEST 2010


On Sun, May 02, 2010 at 01:41:21PM -0300, José Romildo Malaquias wrote:
> On Sun, May 02, 2010 at 01:09:47PM -0300, Jim Diamond wrote:
> > On Sun, May  2, 2010 at 13:02 (-0300), José Romildo Malaquias wrote:
> > 
> > > I am looking for a way of put frames around a box, but
> > > selectively. That is, not all four edges need frames, but only
> > > some of them. For instance, I may need frames on all edges but the
> > > bottom one. Or I may need frames only on the vertical edges.
> > 
> > > Any hints on how to accomplish this?
> > 
> > > Regards,
> > 
> > Romildo,
> > 
> > how do you want to specify which sides get an edge?
> > 
> > Do you want to call something like
> > 	\framit yyny {material to be framed}
> > or
> > 	\framit 13 {material to be framed}  % 8 + 4 + 0 + 1
> > or
> > 	\framebottomtrue
> > 	\framelefttrue
> > 	\framerightfalse
> > 	\frametoptrue
> > 	\framit {material to be framed}
> > or ...
> > ?
> > 
> > And do you already have a macro to draw a 4-sided frame?
> > 
> > And are you using plain tex, latex or context?
> > 
> > More details would be useful.
> 
> I am using LaTeX.
> 
> I need exactly the following commands to put frames around boxes. They
> should be similar to \fbox. Each command should have one argument,
> which is the contents to be framed.
> 
> - a command to put frames in all edges but the last one
> - a command to put frames in all edges but the first one
> - a command to put frames in the vertical edges (that is, left and
>   right)

I wrote to the following commands to do what I need:

% this should be similar to \fcolorbox, except that the
% top and bottom frames are not drawn

\def\MyMidFrameCommand#1#2{%
  \vrule width \fboxrule%
  \colorbox{#1}{#2}%
  \vrule width \fboxrule%

}

% this should be similar to \fcolorbox, except that the
% bottom frame is not drawn

\def\MyTopFrameCommand#1#2{%
  \vbox{%
    \offinterlineskip%
    \hrule height \fboxrule%
    \noindent\MyMidFrameCommand{#1}{#2}%
  }%

}

% this should be similar to \fcolorbox, except that the
% top frame is not drawn

\def\MyBottomFrameCommand#1#2{%
  \vbox{%
    \offinterlineskip%
    \noindent\MyMidFrameCommand{#1}{#2}%
    \hrule height \fboxrule%
  }%

}

Any comments about them?

Romildo 


More information about the texhax mailing list