Article View: comp.text
Article #919Re: Boxing problem with LaTeX
From: Michal Jaegermann
Date: Wed, 27 Sep 1989 19:39
Date: Wed, 27 Sep 1989 19:39
73 lines
3143 bytes
3143 bytes
In article <824@astbe.UUCP> sstern@astbe.UUCP (Mister Tvister) writes:
> A boxed example has a line frame around it with narrow blank margins,
> inside and outside the frame on all four sides. The frame will accordingly be
> as long as a text line and approximately as high as the block manipulated
> internally by the "verbatim" mechanism.
> I am no (La)TeX whiz but could also not discern in the LaTeX reference book
> any means to accomplish this.
% For boxed text in latex you may try the following. It is not perfect,
% but it is simple and it works. Of course a use of typewriter font
% caused a lot of underfull \hbox'es, which I choosed to ignore.
% I presume that a similar thing you may do with a minipage.
%
% Michal Jaegermann
% Myrias Research Corportaion
% mj@myrias.COM
%
% ================ an example in latex follows ================
\documentstyle[12pt]{article}
\begin{document}
\newlength{\boxspan}
\newlength{\oldindnt}
\setlength{\oldindnt}{\parindent} % save old value
\setlength{\boxspan}{\textwidth} % width of a box we will create
\addtolength{\boxspan}{-1em} % decrease it slightly, so frames
% will not stick out to margins
\newcommand{\boxit}[1]{
\setlength{\parindent}{0pt}
\framebox[\textwidth]{\parbox{\boxspan}{
\setlength{\parindent}{\oldindnt}\smallskip\par{\tt #1}\smallskip\par
}}} %end of \boxit
% a whole argument to this version of the command will be set in
% a typewriter font - modify to your liking.
% this is a fragment of a text authored by my 13 year old son
\section{Adventure Background}
Read this at the beginning of the adventure:
\bigskip
\boxit{
It is the season of Gwaeron, or in Westron the season of stirring.
The time when the snow starts to slowly fade away and the bears begin to
wake from their winter slumber.\\
\verb+ You are hardy adventurers.+\\
\verb+Well, by now more like really hardy, and bored+\\
\verb+adventurers, after sitting in The Last Inn all winter long!+\\
During the long cold winter days you have listened to many tales. One of
them seems very interesting and credible. It concerns some caves northeast
of here. Asking the Innkeeper more about the story he confirms it and even
for a few silvers gives you a set of directions that should lead you to
these caves!
} % end of boxed text
You vowed that the first day the snow was thin enough you would try
to find the caves. Today is the day!
\end{document}
%================
--
Michal Jaegermann
Myrias Research Corporation
Edmonton, Alberta, CANADA
mj@myrias.COM
...{uunet,alberta}!myrias!mj
Technical Details
Message-ID:
<622928421.16882@myrias.com>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!uwm.edu!mailrus!cornell!uw-beaver!ubc-cs!alberta!aunro!myrias!mjReferences:
<824@astbe.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!uwm.edu!mailrus!cornell!uw-beaver!ubc-cs!alberta!aunro!myrias!mj From: mj@myrias.com (Michal Jaegermann) Newsgroups: comp.text Subject: Re: Boxing problem with LaTeX Message-ID: <622928421.16882@myrias.com> Date: 27 Sep 89 19:39:30 GMT References: <824@astbe.UUCP> Organization: Myrias Research, Edmonton Lines: 73 In-reply-to: sstern@astbe.UUCP's message of 25 Sep 89 12:03:52 GMT