🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10662

how to define a LaTeX environment with an *optional* argument?

#10662
From: Timothy Finin
Date: Fri, 22 Jan 1993 21:08
18 lines
1117 bytes
Is there a way to define an environment in LaTeX that takes a single
optional argument?  I have the following definition for an environment
boxed which puts a box around arbitrary text (using fancybox.sty,
which is quite nice).  It takes a single argument which is the width
of the box.

  \newsavebox{\mybox}

  \newenvironment{boxed}[1]%
      {\beginsbox{\mybox}\begin{minipage}{#1}%
       }%
      {\end{minipage}\endsbox
        \setlength{\fboxsep}{8pt}%
        \centerline{\fbox{\usebox{\mybox}}}}

I would like to have the argument to boxed be optional and default to,
say \defaultBoxWidth.  Is there a way to do this within LaTeX, or does
one have to define this directly in TeX?
Technical Details
Message-ID: <1jpnnsINN5el@retriever.cs.umbc.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!news.umbc.edu!nobody

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!news.umbc.edu!nobody
From: finin@cs.umbc.edu (Timothy Finin)
Newsgroups: comp.text.tex
Subject: how to define a LaTeX environment with an *optional* argument?
Date: 22 Jan 1993 16:08:12 -0500
Organization: Computer Science, University of Maryland Baltimore County
Lines: 19
Message-ID: <1jpnnsINN5el@retriever.cs.umbc.edu>
NNTP-Posting-Host: retriever.cs.umbc.edu