Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Corollary/Remark

329 views
Skip to first unread message

Jack

unread,
Oct 3, 2012, 8:14:54โ€ฏAM10/3/12
to
What do I write in the preamble, and what command do I write, to get
sections designed to give the pre-formed header 'Remark' and 'Corollary'?
I understand I need \usepackage{amssymb}.
One other thing, how do I get the Fremch circumflex, i.e. the '^' symbol, to
go over an 'o'?

Thanks in advance.


Lee Rudolph

unread,
Oct 3, 2012, 9:41:16โ€ฏAM10/3/12
to
"Jack" <nomai...@hotmail.com> writes:

>What do I write in the preamble, and what command do I write, to get
>sections designed to give the pre-formed header 'Remark' and 'Corollary'?
>I understand I need \usepackage{amssymb}.

No. amssymb (not surprisingly) lets you use AMS symbols. The
"Remark" and "Corollary" environments (which are not "sections"
in any normal use of the term), in AMS form, are available in
the amsthm package. Documentation for amssymb, amsmath, and
related packages (and classes) is available from the AMS website
(and elsewhere, of course), and is well worth reading when using
them.

>One other thing, how do I get the Fremch circumflex, i.e. the '^' symbol, to
>go over an 'o'?

\^{o} or \textasciicirc{o} will do nicely.

Lee Rudolph

Jack

unread,
Oct 3, 2012, 2:28:54โ€ฏPM10/3/12
to

"Lee Rudolph" <lrud...@panix.com> wrote in message
news:k4hf9s$bl9$1...@reader1.panix.com...
> "Jack" <nomai...@hotmail.com> writes:
>
>>What do I write in the preamble, and what command do I write, to get
>>sections designed to give the pre-formed header 'Remark' and 'Corollary'?
>>I understand I need \usepackage{amssymb}.
>
> No. amssymb (not surprisingly) lets you use AMS symbols. The
> "Remark" and "Corollary" environments (which are not "sections"
> in any normal use of the term), in AMS form, are available in
> the amsthm package. Documentation for amssymb, amsmath, and
> related packages (and classes) is available from the AMS website
> (and elsewhere, of course), and is well worth reading when using
> them.


Thanks. I rather fancied this setup, from what I read about the way it
organizes the numbering:

\newtheorem{theorem}{Theorem}[section]
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lemma}[thm]{Lemma}

-- but I got errors:


)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\times.sty"
Package: times 2005/04/12 PSNFSS-v9.2a (SPQR)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyhdr\fancyhdr.sty"
\fancy@headwidth=\skip43
\f@ncyO@elh=\skip44
\f@ncyO@erh=\skip45
\f@ncyO@olh=\skip46
\f@ncyO@orh=\skip47
\f@ncyO@elf=\skip48
\f@ncyO@erf=\skip49
\f@ncyO@olf=\skip50
\f@ncyO@orf=\skip51
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphicx.sty"
Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty"
Package: keyval 1999/03/16 v1.13 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\graphics.sty"
Package: graphics 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\trig.sty"
Package: trig 1999/03/16 v1.09 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\graphics.cfg"
File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
)
Package graphics Info: Driver file: pdftex.def on input line 91.

("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
File: pdftex.def 2010/09/14 v0.05b Graphics/color for pdfTeX
\Gread@gobject=\count87
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty"
Package: amssymb 2009/06/22 v3.00

("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"
Package: amsfonts 2009/06/22 v3.00 Basic AMSFonts support
\@emptytoks=\toks15
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold'
(Font) U/euf/m/n --> U/euf/b/n on input line 96.
))
("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsmath.sty"
Package: amsmath 2000/07/18 v2.13 AMS math features
\@mathmargin=\skip52

For additional information on amsmath, use the `?' option.
("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amstext.sty"
Package: amstext 2000/06/29 v2.01

("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsgen.sty"
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks16
\ex@=\dimen105
))
("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsbsy.sty"
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen106
)
("C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\amsopn.sty"
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count88
LaTeX Info: Redefining \frac on input line 211.
\uproot@=\count89
\leftroot@=\count90
LaTeX Info: Redefining \overline on input line 307.
\classnum@=\count91
\DOTSCASE@=\count92
LaTeX Info: Redefining \ldots on input line 379.
LaTeX Info: Redefining \dots on input line 382.
LaTeX Info: Redefining \cdots on input line 467.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen107
LaTeX Font Info: Redeclaring font encoding OML on input line 567.
LaTeX Font Info: Redeclaring font encoding OMS on input line 568.
\macc@depth=\count93
\c@MaxMatrixCols=\count94
\dotsspace@=\muskip10
\c@parentequation=\count95
\dspbrk@lvl=\count96
\tag@help=\toks17
\row@=\count97
\column@=\count98
\maxfields@=\count99
\andhelp@=\toks18
\eqnshift@=\dimen108
\alignsep@=\dimen109
\tagshift@=\dimen110
\tagwidth@=\dimen111
\totwidth@=\dimen112
\lineht@=\dimen113
\@envbody=\toks19
\multlinegap=\skip53
\multlinetaggap=\skip54
\mathdisplay@stack=\toks20
LaTeX Info: Redefining \[ on input line 2666.
LaTeX Info: Redefining \] on input line 2667.
)
("C:\Program Files\MiKTeX 2.9\tex\latex\ams\classes\amsthm.sty"
Package: amsthm 2004/08/06 v2.20
\thm@style=\toks21
\thm@bodyfont=\toks22
\thm@headfont=\toks23
\thm@notefont=\toks24
\thm@headpunct=\toks25
\thm@preskip=\skip55
\thm@postskip=\skip56
\thm@headsep=\skip57
\dth@everypar=\toks26
)
\c@theorem=\count100


! LaTeX Error: No counter 'thm' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.14 \newtheorem{cor}[thm]{Corollary}

Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.


! LaTeX Error: No counter 'thm' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.15 \newtheorem{lemma}[thm]{Lemma}

Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.


LaTeX Warning: Unused global option(s):
[geometry].

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 20.
LaTeX Font Info: ... okay on input line 20.
LaTeX Font Info: Try loading font information for OT1+ptm on input line
20.

("C:\Program Files\MiKTeX 2.9\tex\latex\psnfss\ot1ptm.fd"
File: ot1ptm.fd 2001/06/04 font definitions for OT1/ptm.
)
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count101
\scratchdimen=\dimen114
\scratchbox=\box28
\nofMPsegments=\count102
\nofMParguments=\count103
\everyMPshowfont=\toks27
\MPscratchCnt=\count104
\MPscratchDim=\dimen115
\MPnumerator=\count105
\makeMPintoPDFobject=\count106
\everyMPtoPDFconversion=\toks28
)
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <10> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 37.
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <9> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 54.
LaTeX Font Info: Try loading font information for U+msa on input line 55.
("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd"
File: umsa.fd 2009/06/22 v3.00 AMS symbols A
)
LaTeX Font Info: Try loading font information for U+msb on input line 55.

("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd"
File: umsb.fd 2009/06/22 v3.00 AMS symbols B
)
LaTeX Font Info: Font shape `OT1/ptm/bx/n' in size <14.4> not available
(Font) Font shape `OT1/ptm/b/n' tried instead on input line 63.


! LaTeX Error: Environment lemma undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.73 \begin{lemma}
\label{L1} For $r \geq 1$, we have
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.

[1

{C:/Documents and Settings/User/Local Settings/Application
Data/MiKTeX/2.9/pdft
ex/config/pdftex.map}]

! LaTeX Error: \begin{document} ended by \end{lemma}.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.77 \end{lemma}

Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.


! LaTeX Error: Environment cor undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...

l.91 \begin{cor}

Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.

Runaway argument?
{cor
! Paragraph ended before \end was complete.
<to be read again>
\par
l.98

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.


Dan Luecking

unread,
Oct 3, 2012, 4:56:50โ€ฏPM10/3/12
to
On Wed, 3 Oct 2012 19:28:54 +0100, "Jack" <nomai...@hotmail.com>
wrote:

>
>"Lee Rudolph" <lrud...@panix.com> wrote in message
>news:k4hf9s$bl9$1...@reader1.panix.com...
>> "Jack" <nomai...@hotmail.com> writes:
>>
>>>What do I write in the preamble, and what command do I write, to get
>>>sections designed to give the pre-formed header 'Remark' and 'Corollary'?
>>>I understand I need \usepackage{amssymb}.
>>
>> No. amssymb (not surprisingly) lets you use AMS symbols. The
>> "Remark" and "Corollary" environments (which are not "sections"
>> in any normal use of the term), in AMS form, are available in
>> the amsthm package. Documentation for amssymb, amsmath, and
>> related packages (and classes) is available from the AMS website
>> (and elsewhere, of course), and is well worth reading when using
>> them.
>
>
>Thanks. I rather fancied this setup, from what I read about the way it
>organizes the numbering:
>
>\newtheorem{theorem}{Theorem}[section]
>\newtheorem{cor}[thm]{Corollary}

This says you want your "cor" environments numbered in the same
sequence as your "thm" environments. But you have not defined a
"thm" environment, only a "theorem" environment. The result is

>! LaTeX Error: No counter 'thm' defined.

This happens a second time at

>\newtheorem{lemma}[thm]{Lemma}

for the same reason. I don't know what \newtheorem does
when such an error occurs. I suspect it simply abandons
the definition of the "cor" and "lemma" environments.

>LaTeX Warning: Unused global option(s):
> [geometry].

This indicates you wrote something like
\documentclass[geometry]{...}
If you want the geometry package loaded, you need
\usepackage{geometry}

>
>! LaTeX Error: Environment lemma undefined.
>

I would guess this was because of the mistakes in the
\newtheorem{lemma}[thm]{Lemma}

>
>! LaTeX Error: \begin{document} ended by \end{lemma}.

The \end command first compares it's argument to the
current environment. Since the lemma environment was not
properly defined, the current environment is "document",
leading to this error.

>
>! LaTeX Error: Environment cor undefined.

See description of the lemma error above.

>Runaway argument?
>{cor
>! Paragraph ended before \end was complete.


You left off the closing brace to \end{cor}:

>I suspect you've forgotten a `}', causing me to apply this
>control sequence to too much text. How can we recover?
>My plan is to forget the whole thing and hope for the best.


Dan
To reply by email, change LookInSig to luecking

Peter Flynn

unread,
Oct 3, 2012, 4:59:30โ€ฏPM10/3/12
to
On 03/10/12 14:41, Lee Rudolph wrote:> "Jack" <nomai...@hotmail.com>
It would be very useful to those who write the documentation if you
could let us know what you read that *didn't* tell you this. It should
be in all the basic documents and sites, so it would be very helpful to
know if it's missing from some of them.

> \^{o} or \textasciicirc{o} will do nicely.

Or better, \usepackage[utf8x]{inputenc}\usepackage[T1]{fontenc}
at the start, and then you can just type รด

Unless you mean the mathematical "hat", which is \hat o in mat mode.

///Peter

Jack

unread,
Oct 3, 2012, 6:16:07โ€ฏPM10/3/12
to

"Peter Flynn" <pe...@silmaril.ie> wrote in message
news:ad3n9i...@mid.individual.net...
> On 03/10/12 14:41, Lee Rudolph wrote:> "Jack" <nomai...@hotmail.com>
> writes:
>>
>>> What do I write in the preamble, and what command do I write, to
>>> get sections designed to give the pre-formed header 'Remark' and
>>> 'Corollary'? I understand I need \usepackage{amssymb}.
>>
>> No. amssymb (not surprisingly) lets you use AMS symbols. The "Remark"
>> and "Corollary" environments (which are not "sections" in any normal
>> use of the term), in AMS form, are available in the amsthm package.
>> Documentation for amssymb, amsmath, and related packages (and
>> classes) is available from the AMS website (and elsewhere, of
>> course), and is well worth reading when using them.
>>
>>> One other thing, how do I get the Fremch circumflex, i.e. the '^'
>>> symbol, to go over an 'o'?
>
> It would be very useful to those who write the documentation if you
> could let us know what you read that *didn't* tell you this. It should
> be in all the basic documents and sites, so it would be very helpful to
> know if it's missing from some of them.

It might just be me, but you arrive on a page such as this
http://www.math.uiuc.edu/~hildebr/tex/tips-theorems.html
and you don't get the concepts of defining environments spelt out for you in
such terms as would fully explain how one thing is set up as a prerequisite
for another. In other words, it doesn't really give the instructive sequence
that's required. I am at a complete loss when it comes to the logic of
defining environments. It's not so long ago, even, that I didn't know what
on earth was being talked about when the word 'environment' was used by TeX
speakers. In the days of books, you would be expected to look at the index
to find what you wanted, and you'd find the page number and, by leafing
through close-by pages, you could determine how everything fitted together,
albeit sometimes rather an arduous process. But with the 'net you use the
search engine and you arrive virtually in the deep end.

BTW I've now got rid of my errors -- thanks people -- but I wasn't expecting
my corollary to come out written in italics.

Cheers.



Paul Vojta

unread,
Oct 4, 2012, 2:30:30โ€ฏAM10/4/12
to
In article <GO2bs.178241$512.1...@fx28.am4>,
Jack <nomai...@hotmail.com> wrote:
>
>"Peter Flynn" <pe...@silmaril.ie> wrote in message
>news:ad3n9i...@mid.individual.net...

[snip]

>> It would be very useful to those who write the documentation if you
>> could let us know what you read that *didn't* tell you this. It should
>> be in all the basic documents and sites, so it would be very helpful to
>> know if it's missing from some of them.
>
>It might just be me, but you arrive on a page such as this
>http://www.math.uiuc.edu/~hildebr/tex/tips-theorems.html
>and you don't get the concepts of defining environments spelt out for you in
>such terms as would fully explain how one thing is set up as a prerequisite
>for another. In other words, it doesn't really give the instructive sequence
>that's required.

It says, "See Gratzer's book for details."

--Paul Vojta, vo...@math.berkeley.edu

Jack

unread,
Oct 4, 2012, 7:14:35โ€ฏAM10/4/12
to
How do I unitalicize the corollary?
Also, is there any way I can perfectly centre the page numbers when using
the Geometry usepackage? I notice they're a bit off.


Dan Luecking

unread,
Oct 4, 2012, 2:22:29โ€ฏPM10/4/12
to
On Thu, 4 Oct 2012 12:14:35 +0100, "Jack" <nomai...@hotmail.com>
wrote:

>How do I unitalicize the corollary?
>Also, is there any way I can perfectly centre the page numbers when using
>the Geometry usepackage? I notice they're a bit off.
>

The amsthm package allows you to define and set a style for
any \newtheorem-defined environment. Documentation is in
amsthmdoc.pdf, which your TeX system should give you access
to. In TeX Live, I run "texdoc amsthm".

The default style is "plain" unless you change it. There are
two other styles predefined ("definition" and "remark"), and
a command, \newtheoremstyle, for making others. It would
appear you would like something just like "plain" but without
the italic body text.

The parameters for the "plain" theorem style are not easy to
find out, but think it is defined with the equivalent of the
following (there are 9 arguments):

\newtheoremstyle{plain}
{\topsep}% space above
{\topsep}% same space below
{\itshape}% font command for the body
{}% indentation (none)
{\bfseries}% font command for the heading
{.}% punctuation after the heading
{5pt plus 1pt minus 1pt}% space after head: 5pt +/- 1pt
{}%

You would want to define a new style by issuing a command
like the following:

\newtheoremstyle{notplain}
{\topsep}
{\topsep}
{\upshape}% upright instead of italic
{}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}

then switch to this style before you define cor:

\theoremstyle{notplain}
\newtheorem{cor}[thm]{Corollary}


Caveat: the predefines "plain" style is not defined using
the above command, so I have deduced the equivalent values
from the code in amsthm.sty and one simple test document.
I could have made a mistake.

Peter Flynn

unread,
Oct 4, 2012, 3:21:20โ€ฏPM10/4/12
to
On 03/10/12 23:16, Jack wrote:> "Peter Flynn" <pe...@silmaril.ie> wrote
in message
>> It would be very useful to those who write the documentation if
>> you could let us know what you read that *didn't* tell you this. It
>> should be in all the basic documents and sites, so it would be very
>> helpful to know if it's missing from some of them.
>
> It might just be me, but you arrive on a page such as this
> http://www.math.uiuc.edu/~hildebr/tex/tips-theorems.html and you
> don't get the concepts of defining environments spelt out for you in
> such terms as would fully explain how one thing is set up as a
> prerequisite for another.

That's because that page is a part of a much larger site at
http://www.math.uiuc.edu/~hildebr/tex (just remove the last token from
the previous URI) which is devoted to people using LaTeX to write their
documents, rather than to prople who need to redefine thing or write
their own macros and environments. Very useful pointer, thanks.

> In other words, it doesn't really give the
> instructive sequence that's required.

Right. It's aimed at a completely different audience.

> I am at a complete loss when it
> comes to the logic of defining environments.

\newenvironment{name}{stuff needed to set it up}{stuff needed to end it}

> It's not so long ago,
> even, that I didn't know what on earth was being talked about when
> the word 'environment' was used by TeX speakers. In the days of
> books, you would be expected to look at the index to find what you
> wanted,

You still can, if you buy any of the many books about LaTeX which cover
that. But I'm afraid if you really want the detail of how to program
LaTeX, you need to get the LaTeX Companion, 2nd ed.

> and you'd find the page number and, by leafing through
> close-by pages, you could determine how everything fitted together,
> albeit sometimes rather an arduous process. But with the 'net you use
> the search engine and you arrive virtually in the deep end.

Alternatively you stumble across my online book at
http://latex.silmaril.ie/formattinginformation/ which starts with the
index :-) But that too is a book aimed at people using LaTeX to write
documents, not people defining their own (although there is a very short
section at the end which deals with this). Environments are at least
defined and described at
http://latex.silmaril.ie/formattinginformation/basics.html#environment

> BTW I've now got rid of my errors -- thanks people -- but I wasn't
> expecting my corollary to come out written in italics.

No-one expects the Spanish Inquisit...oops, sorry, wrong script.

Dan has explained this, which I didn't know, not being a math user.

///Peter

Jack

unread,
Oct 4, 2012, 6:17:31โ€ฏPM10/4/12
to
>
> \newenvironment{name}{stuff needed to set it up}{stuff needed to end it}
>

Thanks but what about the stuff they put in square brackets?


Robin Fairbairns

unread,
Oct 5, 2012, 5:20:30โ€ฏAM10/5/12
to
"Jack" <nomai...@hotmail.com> writes:

>[quoting peter]
>> \newenvironment{name}{stuff needed to set it up}{stuff needed to end it}
>
> Thanks but what about the stuff they put in square brackets?

environments take arguments just like commands do, so with

\newenvironment{name}[2][foo]{stuff-b}{stuff-e}

you would be able to access optional argument #1 (default foo) and
mandatory argument #2, within "stuff-b". if you want to process either
of the arguments in the body of the environment, or in "stuff-e", you
need to define a macro to hold them in "stuff-b".

i'll stick a note in the faq (in the "what is ..." area) about
environments, when i get around to updating it. (there's *lots* i need
to do before a new release, but i can at least write that addition
pretty quickly.
--
Robin Fairbairns, Cambridge
sorry about all this posting. i'll go back to sleep in a bit.

Peter Flynn

unread,
Oct 5, 2012, 6:26:04โ€ฏPM10/5/12
to
On 04/10/12 23:17, Jack wrote:
>>
>> \newenvironment{name}{stuff needed to set it up}{stuff needed to end it}
>
> Thanks but what about the stuff they put in square brackets?

You're getting in pretty deep here. You can have compulsory arguments
and optional arguments to both commands and environments. The simplest
form is the command with one compulsory argument:

\newcommand{\foreign}[1]{\emph{#1}}

This requires that \foreign be followed by one thing in curly braces
(because it's compulsory), and that will be used as the argument of
\emph. You can have up to nine of these, eg

\newcommand{\something}[9]{which does this #1 and then maybe #6 this
and perhaps #8 this and so on...}

Environments can have an identical construct:

\newenvironment{name}[1]{set up #1}{stuff needed to end it}

A limitation is that the #1, #2 etc can only be referred to in the setup
half of the environment definition. Some additional programming is
needed if you want to carry the argument value across the text content
of the environment and do something with it in the closing half.

Then there are optional arguments. You tell LaTeX that they are optional
by providing a default value, which is what gets used if the author does
*not* provide a value:

\newenvironment{name}[1][\TeX]{An environment for #1}{end stuff}

If the user types \begin{name} then #1 will be \TeX. If they type
\begin{name}[Word] then the value of #1 will be Word. You can specify
one compulsory and one optional like this:

\newenvironment{name}[2][\TeX]{An #2 environment for #1}{end stuff}

where the first default is always the default for the *first* argument.
In theory you can have lots of optional arguments but it gets very
messy: the xargs package provides a much neater way to specify very
complex command arguments.

The confusing bit is that *all* argument patterns are *specified* using
square brackets, but only *optional* arguments are *used* by giving them
in square brackets: compulsory arguments must go in curly braces regardless.

///Peter
0 new messages