Search found 11 matches

by kreil
Mon Jul 28, 2008 10:24 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Re: Full context variable depth references to list labels?

Yes, that looks good, thanks!

The reason I need support for different depths is that I am struggling with a large, structured document, that I am desparately trying to get into some *readable* order. At the same time, I need to preserve the structure, while allowing references from the outside (a ...
by kreil
Mon Jul 28, 2008 9:16 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Re: Full context variable depth references to list labels?

Ah, ok, so I can either

1) use the version with an explicitly \savedlabel
2) use the version with \@currentlabel, as long as I don't nest our environment in other environments that used refstepcounter (which is actually, quite likely)
or
3) use a version that directly probes the section levels ...
by kreil
Mon Jul 28, 2008 8:34 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Dear Ted,

Here's a better one: \usepackage{enumitem}
\newlist{legal}{enumerate}{10}
\makeatletter
\setlist[legal]{label*=\arabic*.,ref=\csname the\enit@prevlabel\endcsname\arabic*.}
\newcommand{\thelegal}{\ifnum\value{subsection}=0\thesection\else\thesubsection\fi-}
\makeatother I think that ought ...
by kreil
Mon Jul 28, 2008 8:25 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Nice :-)

So how do I similarly redefine my \label command so that all labels (say, also equations) get their full section-context on citation?

As I said, the direct

Code: Select all

\def\mylabel#1{\cc\label#1}
did not seem to work.

Best wishes,
David.
by kreil
Mon Jul 28, 2008 7:52 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Re: Full context variable depth references to list labels?

Cool! Such an elegant solution.

I didn't realize that other label setting environments (like equation) would not disturb \@currentlabel :-)

Many thanks again for your kind help,

David.
by kreil
Mon Jul 28, 2008 7:28 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Hey, this is getting quite neat! :-)

Yes, your new solution is even better! I still need the "\sc" though because otherwise I'd get labels like "3.0" if I move the "legal" list a level up or such.

So the below is basically your latest version with the \sc trick -- or do you know a more direct way ...
by kreil
Mon Jul 28, 2008 6:54 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Perfect! :-)

Many thanks, I don't know what I got wrong when I first tried. The below does exactly what I want (even semi-automatically picks up the section level).

Thanks a lot again for your help!

All the best,
David.


\documentclass{article}

\usepackage{enumitem}
\newlist{legal}{enumerate ...
by kreil
Mon Jul 28, 2008 5:46 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Dear Ted,

Yes, that looks nice! I tried your approach ...


First, in the preamble: \usepackage{enumitem}
\newlist{legal}{enumerate}{10}
\makeatletter
\setlist[legal]{label*=\arabic*.,ref=\csname the\enit@prevlabel\endcsname\arabic*.}
\makeatother Then you can do \begin{legal}[ref=\thesubsection ...
by kreil
Mon Jul 28, 2008 4:42 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Full context variable depth references to list labels?

Dear Ted!

Many thanks for your comments. The problem is that unless I manually construct a combined label, I cannot easily combine section and enumerate labels.

My best bet so far has been the following:


\usepackage{enumitem}

\makeatletter
\def\sc{\protected@edef\savedlabel{\@currentlabel ...
by kreil
Mon Jul 28, 2008 2:50 pm
Forum: General
Topic: Full context variable depth references to list labels?
Replies: 24
Views: 21561

Re: Full context variable depth references to list labels?

I have read more of the LaTeX source (am I going in the wrong direction there?) and it seems that \@currentlabel holds exactly what I need. I'd now love to save this before starting an enumerate list and prepend it to the item labels.

I had hoped that

\def\savecounter{\protected@edef\savedlabel ...