[tex-eplain] fcolorbox misses fbox

Daniel H. Luecking luecking at uark.edu
Thu Dec 5 19:28:52 CET 2013


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.

Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
Fayetteville, Arkansas

________________________________________
From: tex-eplain [tex-eplain-bounces at tug.org] on behalf of Helmut Jarausch [jarausch at igpm.rwth-aachen.de]
Sent: Thursday, December 05, 2013 3:15 AM
To: tex-eplain at tug.org
Subject: [tex-eplain] fcolorbox misses fbox

Hi,

Helmut


\beginpackages
\usepackage{color}
\endpackages
\makeatletter
\def\@frameb at x#1{%
   \@tempdima\fboxrule
   \advance\@tempdima\fboxsep
   \advance\@tempdima\dp\@tempboxa
   \hbox{%
     \lower\@tempdima\hbox{%
       \vbox{%
         \hrule\@height\fboxrule
         \hbox{%
           \vrule\@width\fboxrule
           #1%
           \vbox{%
             \vskip\fboxsep
             \box\@tempboxa
             \vskip\fboxsep}%
           #1%
           \vrule\@width\fboxrule}%
         \hrule\@height\fboxrule}%
                           }%
         }%
}
\long\def\fbox#1{%
   \leavevmode
   \setbox\@tempboxa\hbox{%
     \color at begingroup
       \kern\fboxsep{#1}\kern\fboxsep
     \color at endgroup}%
   \@frameb at x\relax}
\makeatother

\pagecolor{black}   % schwarzer Seitenhintergrund
\color{red}         % roter Text
\definecolor{gray}{gray}{.5}
\fcolorbox{green}{gray}{Box with a green boundary on a gray background
--- the text is read}
\bye




More information about the tex-eplain mailing list