[tex-eplain] fcolorbox misses fbox
Helmut Jarausch
jarausch at igpm.rwth-aachen.de
Fri Dec 6 13:22:12 CET 2013
On 12/05/2013 07:28:52 PM, Daniel H. Luecking wrote:
> On Thursday, December 05, 2013 3:15 AM, Helmut Jarausch
> <jarausch at igpm.rwth-aachen.de> wrote:
>
> >I've tried to use \fcolorbox from the color package.
> >This fails with an unknown \fbox macro unless I add the code below.
> >
> >I have blindly copied these macros from
> >/usr/share/texmf-dist/tex/latex/base/latex.ltx
> >
> >Is there a more eplain friendly definition of \fbox ?
>
> It is odd that miniltx defines \fboxsep and \fboxrule, but not \fbox.
> However, eplain has a \boxit macro that draws a frame around a box
> (that is, to work correctly, its argument must be a box, not plain
> text).
> It employs some lengths that have to match the ones expected in the
> latex code for \fcolorbox. Thus:
>
> % Use \let so these dimens are not just equal in value, but actually
> % refer to the same dimen register.
> \let\boxitspace\fboxsep
> \def\fbox#1{%
> {%
> \hruledefaultheight=\fboxrule
> \hruledefaultdepth=0pt
> \vruledefaultwidth=\fboxrule
> \boxit{\hbox{#1}}%
> }%
> }
>
> It worked for me in very simple tests.
>
Many thanks Daniel.
I've modified it to include color at begingroup / color at endgroup
to not let any color changes get out of this box.
\beginpackages
\usepackage{color}
\endpackages
% Use \let so these dimens are not just equal in value, but actually
% refer to the same dimen register.
\let\boxitspace\fboxsep
\makeatletter
\def\fbox#1{%
{%
\hruledefaultheight=\fboxrule
\hruledefaultdepth=0pt
\vruledefaultwidth=\fboxrule
\boxit{\color at begingroup\hbox{#1}\color at endgroup}%
}
}
\makeatother
Helmut
More information about the tex-eplain
mailing list