# [texhax] Boxes and indents

Stefan Björk stefan at raggmunk.nu
Fri Jan 28 10:10:20 CET 2005

> The problem is that \vbox has width \textwidth and then the space and rule
> thickness of \fbox havw no space left to live in.  The following is now also
> a little more kosher than before.

Thanks again. I found a solution similar to your on my own (sometimes
you should just think a little on your own before posting to the list; I
was too quick yesterday), but your proposal is - of course - much more
elegant in many ways.

However, I finally came up with the following solution that seem to work
well. The variant, \textbox*, does not add any space before the box,
which is useful just after a heading (I guess there could be a way to
automatically detect this).

\newcommand{\@textbox}[2]{%
\addvspace{#1\baselineskip}
\noindent
\fbox{%
\addtolength{\columnwidth}{-2\fboxsep}%
\addtolength{\columnwidth}{-2\fboxrule}%
\begin{minipage}{\columnwidth}%
\setlength{\parindent}{1em}%
\small\noindent\strut%
#2
\end{minipage}%
}%
\par
\nobreak
\vspace{\baselineskip}
\@afterheading
}
\newcommand{\textbox}{\@ifstar{\@textbox{0}}{\@textbox{1}}}

/Stefan (still learning)



More information about the texhax mailing list