LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Will Robertson <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 18 Aug 2009 16:09:35 +0930
Content-Type:
text/plain
Parts/Attachments:
text/plain (90 lines)
Hi Joseph,

I've spent a little time reading again over template.dtx and the most  
recent version of template-alt.dtx. I think I understand what both  
packages are attempting :)

On 18/08/2009, at 2:05 AM, Joseph Wright wrote:

> First, thanks very much for the engagement with the "xparse" thread.
> Lots of useful and illuminating feedback. The next item on the list to
> be sorted is the template package/concept.

I agree; I believe that xparse+template, as mentioned by Lars long ago  
in his TUB article, are a powerful way forward and it would be great  
to start using them!

> The idea of template is that it lets you separate out design from  
> code,
> and to pre-set various parts of the design so that they do not have to
> be evaluated at every use.  I'm still not clear on the
> \DeclareTemplateType concept, so I'll go with what I can understand.  
> (If
> anyone can show where this extra division is useful, please do tell.)

I think \DeclareTemplateType is simply a formalism to show that any  
templates you define of this type will all conform to the same  
arguments and perform related activities.

You could get away without it (in theory) and simply write  
\DeclareTemplate with the template and templatename, but I guess it's  
nice have the introductory \DeclareTemplateType to show your  
intentions of what document-level elements are being defined.

[snip]

> \DeclareInstance { chapter } { division } {

As a minor point, I prefer ordering collections/templates/instances  
from general to specific. (More on collections down the page.)  
template.sty would have you write
     \DeclareInstance { division } { chapter } {
instead. But no matter :)

> At present, there are various bells and whistles to this in  
> template, of
> which only some are implemented in template-alt as I don't follow  
> all of
> them. So there are various questions:
> - Does this broadly make sense to other people?
> - Does the current interface provide enough flexibility?

Firstly, yes, I think it does make sense.
Secondly, I think that template's "collections" might be a very useful  
addition to template-alt (i.e., not worth dropping from the original  
template). Here's an example to illustrate how I think I understand  
them:

Lets say your document divisions are \chapter which internally call  
\UseInstance{chapter}{division}. In the frontmatter of your document,  
you may wish to use a different chapter design (no numbering or  
whatever). But it's better to have a separate instance for this than a  
switch inside the template itself.

In template you'd write something like:

\DeclareCollectionInstance{frontmatter}{division}{std}{chapter}{
   number=false
}
\DeclareCollectionInstance{frontmatter}{division}{std}{section}{
   number=false
}

So you can have \frontmatter call
     \UseCollection{division}{frontmatter}
and then all your chapters and sections would be unnumbered.

This is a bad example because you'd probably do section inheritance  
more explicitly (with a \secnumdepth analogy in the template, I  
suppose) but that's the basic idea of collections. I think :)

The author of template.dtx says that the order of the two arguments in  
\UseCollection is unintuitive, and I agree. I'd rather be able to  
write something like
     \UseCollection{frontmatter}{division,pagestyle}
to adjust multiple templates at once. And this follows from "general  
to specific" as mentioned above.

Must run; running late to meet someone!
Will

ATOM RSS1 RSS2