Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!udel!brahms.udel.edu!anita From: anita@brahms.udel.edu (Anita Marie Hoover) Newsgroups: comp.text.tex Subject: Re: boxing verbatim in latex Message-ID: <21433@brahms.udel.edu> Date: 16 May 91 14:31:56 GMT References: Distribution: comp.text.tex Organization: University of Delaware Lines: 61 In article lubkt@spectrum.CC.Lehigh.EDU (Binod K. Taterway) writes: => =>I want to place a box around the verbatim environment. Unfortunately, =>when I do the following, => => [stuff deleted] => => if my left margin is here .. =>+-----------------------------------------------------------------------+ =>| I want the boxed environment like this. | =>+-----------------------------------------------------------------------+ => any clues? => Just to point out that you must make sure that the text inside the verbatim environment does not exceed the defined width. Here is an example file. It defines a new environment called ``boxverbatim''. It calculates the width by subtracting the space between columns (in this case, the beginning and ending extra space) and the width of the rule. Try it out and see if this helps. ------------------ boxedverb.tex -------------------------- \documentstyle {article} \newlength{\verbboxwidth} \setlength{\verbboxwidth}{\textwidth} \addtolength{\verbboxwidth}{-2\arrayrulewidth} \addtolength{\verbboxwidth}{-2\tabcolsep} \newenvironment{boxverbatim}% {\begin{flushleft}% \begin{tabular}{|l|}\hline% \\% \begin{minipage}{\verbboxwidth}}% {\vspace*{.5\baselineskip}% \end{minipage}% \\\hline% \end{tabular}% \end{flushleft}} \begin{document} A paragraph before we try to box some verbatim text. It is quite easy, especially if you use the tools provided with \LaTeX. \begin{boxverbatim} \begin{verbatim} \begin{description} \item [Attributive Predicate:] {\em The electron has both a mass and a charge.} \item [Renaming Predicate:] {\em The negative electrode is called the cathode.} \item [Conclusion Predicate:] {\em From the experiment, it was concluded that the electron had a charge that was negative.} \end{description} \begin{equation} x = y + z \end{equation} \end{verbatim} \end{boxverbatim} A paragraph after we try to box some verbatim text. It is quite easy, especially if you use the tools provided with \LaTeX. \end{document}