GeneralCustom Label Definition Environment that gets referenced

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
spetey
Posts: 1
Joined: Wed Jun 15, 2011 2:33 am

Custom Label Definition Environment that gets referenced

Post by spetey »

Hi folks. I've used LaTeX for many years, but I'm a newbie to the forum. I'm no LaTeX expert, but my needs are normally modest, so the last time I posted for help was in the newsfeed days ...

Back then, I requested a way to custom-label a displayed element, and then refer back to that element using a \ref that gives the custom label, as in:
Consider example (E):
(E) An example of what I was talking about.
(E) clearly illustrates principle (P) ...
(This kind of thing is useful in "analytic" philosophy.)

Back then I was given this environment, which I understood very poorly but which has served me well in my preamble since then:

Code: Select all

\makeatletter
\newcommand{\displabel}[1]{(#1)\hfill}
\newenvironment{disp}
 {\begin{list}{}%
   {\renewcommand{\makelabel}{\displabel}%
    \let\olditem=\item%
    \renewcommand*{\item}[1][]{%<<add test for empty arg (ifmtarg.sty)
       \protected@edef\@currentlabel{(##1)}%
       \olditem[##1]}
    \setlength{\leftmargin}{.5in}
    \setlength{\rightmargin}{.5in}}}%
 {\end{list}}
\makeatother 
Now, a decade later, I have run into the problem that this environment does not allow me to nest an enumeration environment. What I would ideally like now is a theorem-like "definition" environment that will allow text like this:
Consider Definition (D):
Definition D: A creature is a dromedary just in case
  1. it has humps
  2. it is ill-tempered
  3. it spits.
Clearly (D) is inadequate as a definition, as it applies to many a mother-in-law.
Note I do not want a Roman enumeration - I want to be able to label these mnemonically, instead; as 'D' for 'dromedary' and then 'L' for llama. (What? Aids to memory? Must not be a math paper.)

I have pored over the web and The LaTeX Companion, and toyed with variations for hours, but come up short - and my paper is due all too soon. Any assistance - even references for places to go to understand this '\protected@edef\@currentlabel{(##1)}' business - would be appreciated.

Thanks!
Steve

Recommended reading 2024:

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

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

Post Reply