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
Condense Mail Headers

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

Print Reply
Sender:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 18 Aug 2009 21:24:28 +0100
Reply-To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Subject:
MIME-Version:
1.0
Content-Transfer-Encoding:
7bit
In-Reply-To:
Content-Type:
text/plain; charset=ISO-8859-1
From:
Joseph Wright <[log in to unmask]>
Parts/Attachments:
text/plain (113 lines)
Will Robertson wrote:
> 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!

Totally agree, hence wanting to get them to the point that they are
stable enough for real use.  I'd hope we are basically there with
xparse, and in many ways the interface part of template is not actually
so difficult.

>> 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.

As I say,  I see what it does but not why at a conceptual level.  The
nearest I can get is something like:

Type:     Explanatory-note
Template: Footnote
Instance: Numbered-per-page

Is that how the concept is supposed to work?  What then happens with
something like parts of a document

Type:     Document-part
Template: Document-division
Instance: Section

Isn't this simply redundant information?

>> \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 :)

It's not so minor. This is one thing that needs to be agree: I wrote my
examples without actually checking the code, I admit!

> 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). 

Not dropped as such. I wanted to understand certain parts of template,
an once I did I'd got other things to do. Plus I wanted to see what
everyone feels is useful before putting too much effort in.

> 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 :)

My understanding also. Again, I'm not sure that the template type helps
much. (Another reason I did not get around to sorting out collections in
template-alt just yet.)

> 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.

So issues that arise so far:

1) Order of template divisions.  Will suggests (and I'd agree) general
to specific:

type -> template -> instance

which should be consistent over all template functions.

2) Exact structure for type/template boundary (I still don't get it!)

3) I'm not sure the Collection name is very clear: I'll see what happens
when I look at template-alt again.
-- 
Joseph Wright

ATOM RSS1 RSS2