Document Classescommand scope

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Berticus
Posts: 8
Joined: Wed Dec 31, 2008 11:37 pm

command scope

Post by Berticus »

How do I create a command that can only be used in a certain environment? Like how \item can only be used in either \enumerate and \itemize.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

command scope

Post by phi »

Define the command in the environment initialization code, then it's only available in the environment:

Code: Select all

\newenvironment{abcdef}{\newcommand*{\ghijkl}{...}}{}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Berticus
Posts: 8
Joined: Wed Dec 31, 2008 11:37 pm

Re: command scope

Post by Berticus »

Hmm... odd. I tried that before and it kept saying that the command was already defined. Works now though.
Post Reply