Received: from webgate.proteosys.de (mail.proteosys-ag.com [62.225.9.49]) by lucy.proteosys (8.11.0/8.9.3/SuSE Linux 8.9.3-0.1) with ESMTP id f0T868706580 for ; Mon, 29 Jan 2001 09:06:08 +0100 Received: by webgate.proteosys.de (8.11.0/8.11.0) with ESMTP id f0T86q721614 . for ; Mon, 29 Jan 2001 09:06:52 +0100 Received: from mail.Uni-Mainz.DE (mailserver1.zdv.Uni-Mainz.DE [134.93.8.30]) by mailgate1.zdv.Uni-Mainz.DE (8.11.0/8.10.2) with ESMTP id f0T866M13591 for ; Mon, 29 Jan 2001 09:06:06 +0100 (MET) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C089CA.55AA5800" Received: from mailgate2.zdv.Uni-Mainz.DE (mailgate2.zdv.Uni-Mainz.DE [134.93.8.57]) by mail.Uni-Mainz.DE (8.9.3/8.9.3) with ESMTP id JAA04552 for ; Mon, 29 Jan 2001 09:06:06 +0100 (MET) Received: from mail.listserv.gmd.de (mail.listserv.gmd.de [192.88.97.5]) by mailgate2.zdv.Uni-Mainz.DE (8.11.0/8.10.2) with ESMTP id f0T862714468 for ; Mon, 29 Jan 2001 09:06:02 +0100 (MET) X-MimeOLE: Produced By Microsoft Exchange V6.5 Received: from mail.listserv.gmd.de (192.88.97.5) by mail.listserv.gmd.de (LSMTP for OpenVMS v1.1a) with SMTP id <7.29685A7F@mail.listserv.gmd.de>; Mon, 29 Jan 2001 9:06:00 +0100 Received: from RELAY.URZ.UNI-HEIDELBERG.DE by RELAY.URZ.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 1.8b) with spool id 483810 for LATEX-L@RELAY.URZ.UNI-HEIDELBERG.DE; Mon, 29 Jan 2001 09:05:59 +0100 Received: from ix.urz.uni-heidelberg.de (mail.urz.uni-heidelberg.de [129.206.119.234]) by relay.urz.uni-heidelberg.de (8.8.8/8.8.8) with ESMTP id JAA27187 for ; Mon, 29 Jan 2001 09:05:57 +0100 (MET) Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by ix.urz.uni-heidelberg.de (8.8.8/8.8.8) with ESMTP id JAA12928 for ; Mon, 29 Jan 2001 09:05:57 +0100 Received: from moutvdom00.kundenserver.de (moutvdom00.kundenserver.de [195.20.224.149]) by relay.uni-heidelberg.de (8.10.2+Sun/8.10.2) with ESMTP id f0T85uY00574 for ; Mon, 29 Jan 2001 09:05:56 +0100 (MET) Received: from [195.20.224.208] (helo=mrvdom01.schlund.de) by moutvdom00.kundenserver.de with esmtp (Exim 2.12 #2) id 14N9K0-0001rP-00 for LATEX-L@urz.uni-heidelberg.de; Mon, 29 Jan 2001 09:05:56 +0100 Received: from manz-3e364872.pool.mediaways.net ([62.54.72.114] helo=istrati.zdv.uni-mainz.de) by mrvdom01.schlund.de with esmtp (Exim 2.12 #2) id 14N9Jw-0002kg-00 for LATEX-L@URZ.UNI-HEIDELBERG.DE; Mon, 29 Jan 2001 09:05:52 +0100 Received: (from latex3@localhost) by istrati.zdv.uni-mainz.de (8.9.3/8.9.3/SuSE Linux 8.9.3-0.1) id JAA21826; Mon, 29 Jan 2001 09:03:18 +0100 In-Reply-To: References: Return-Path: X-Mailer: VM 6.75 under Emacs 20.4.1 X-Authentication-Warning: istrati.zdv.uni-mainz.de: latex3 set sender to frank@mittelbach-online.de using -f Content-class: urn:content-classes:message Subject: Re: Templates Date: Mon, 29 Jan 2001 09:03:17 +0100 Message-ID: <14965.9157.631021.803002@istrati.zdv.uni-mainz.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Frank Mittelbach" Sender: "Mailing list for the LaTeX3 project" To: "Multiple recipients of list LATEX-L" Reply-To: "Mailing list for the LaTeX3 project" Status: R X-Status: X-Keywords: X-UID: 3654 This is a multi-part message in MIME format. ------_=_NextPart_001_01C089CA.55AA5800 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Lars, > 1. The order of parameter assignments. > > I haven't seen anything in the documentation about in which order the = code > for the various keys get executed, but in the implementation it looks = as if > they are executed in the order they are listed. i guess this is something for David to comment on, my memory is a bit = hazy the very first drafts of the template interface (where there was still something like DeclareCommandInstance and other stuff) we tried to be = able to use key values inside an instance for specifying the values of other = keys, eg baselineskip =3D 12pt, topskip =3D 10pt, textheight =3D \baselineskip * 49 + \topskip, but first of all we never came up with a good way to reference keys on = the right hand side and then there was the problem this concept only worked = for certain key types and (forgotten what) and ... so basically that idea was abandomed again, though there might be some = traces left in the code I fear. As it looks right now it seems to like this: - default values are executed first order of specification at template level (unless overwritten) - instance values executed thereafter and in order of specification at instance level this is from looking at the following example: \RequirePackage{template} \RequirePackage{trace} \DeclareTemplateType{xxx}{0} \def\MultiSelection{\MultiSelectionError} %\def\foo{bar} %\traceon \DeclareTemplate{xxx}{test}{0} { xkey=3Dn [\foo] \xkey, ykey=3Dn [\Delayevaluation\foo] \ykey, zkey=3Dn \zkey, last=3Dn [last] \lastkey } { \DoParameterAssignments abc } \ShowTemplate{xxx}{test} \DeclareInstance{xxx}{bar}{test} { zkey =3D foo, xkey =3D baz } \DeclareInstance{xxx}{baz}{test} { last =3D first, zkey =3D foo } \ShowInstance{xxx}{bar} \ShowInstance{xxx}{baz} ---------------------------------------------- which gives: (./template-test.tex LaTeX2e <2000/06/01> Babel and hyphenation patterns for english, french, german, = ngerman, du mylang, nohyphenation, loaded. (./template.sty (./ldcsetup.sty = (/cdrom/texmf/tex/latex/graphics/keyval.sty) (/usr/local/texmf/tex/latex/tools/calc.sty))) (./trace.sty) ******* Template: xxx/test ******* * * Defaults: * \TPD>/xxx/test=3Dmacro:->\KV@xxx/test@last {\def \lastkey = {last}}\KV@xxx/test@yk ey {\def \ykey {\Delayevaluation \foo }}\KV@xxx/test@xkey {\def \xkey = {\foo } } * * Restrictions: * \TPR>/xxx/test=3D\relax * * Body: * > \TP>/xxx/test=3D\long macro: -> \DoParameterAssignments abc . \TP>/xxx/test l.22 \ShowTemplate{xxx}{test} ? ******* Instance: <>xxx/bar ******* * > \<>xxx/bar=3Dmacro: ->\TP@assignments {\def \ykey {\Delayevaluation \foo }\def \lastkey = {last}\de f \zkey {foo}\def \xkey {baz}}\TP>/xxx/test . \<>xxx/bar l.36 \ShowInstance{xxx}{bar} ? ******* Instance: <>xxx/baz ******* * > \<>xxx/baz=3Dmacro: ->\TP@assignments {\def \xkey {\foo }\def \ykey {\Delayevaluation \foo = }\def \lastkey {first}\def \zkey {foo}}\TP>/xxx/test . \<>xxx/baz l.37 \ShowInstance{xxx}{baz} ? x ------------------------------------------------------------- > It would be nice if this > could be put in writing since you sometimes need one assignment to be > carried out before another (my concrete example of this is that an = instance > key gets used in code for an `s' key). perhaps the above semantics could be made a formal specification though = it would need to be checked whether this is true for all key types. As I = said my recollection is that in the end the feeling was that we can't rely on = order of specification (though even that would need formal specification) > 2. The nature of the `n' key type > > Are `n' keys evaluated (expanded) at declaration-time or not? = template.dtx > is actually contradicting itself on this matter: in Section 1 it says = `n' > is the same thing as `f0', but in Subsection 3.1 there is an example = using > \DelayEvaluation in the default for a type `n' key to avoid > declaration-time evaluation. As far as I can tell the implementation = takes > a third position as it parses a \MultiSelection but otherwise leaves = the > code unevaluated. section 3.1 is rubbish and perhaps due to a bug that i just noticed = trying the code. the code indeed looks for \MultiSelection but since MultiSelection = is an undefined csname the test via \expandafter\ifx\@car dies a horrible = death if you do key =3Dn [\foo] \key and \foo is undefined (since that is then =3D to \MultiSelection) this is why the above sample code eactually \def's \MultiSelection have to run to earn some bread and butter (more on that tonight) frank ------_=_NextPart_001_01C089CA.55AA5800 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Re: Templates

Lars,

 > 1. The order of parameter = assignments.
 >
 > I haven't seen anything in the = documentation about in which order the code
 > for the various keys get executed, but in = the implementation it looks as if
 > they are executed in the order they are = listed.

i guess this is something for David to comment on, my = memory is a bit hazy

the very first drafts of the template interface (where = there was still
something like DeclareCommandInstance and other = stuff) we tried to be able to
use key values inside an instance for specifying the = values of other keys, eg

 baselineskip =3D 12pt,
 topskip      =3D = 10pt,
 textheight   =3D \baselineskip * 49 + = \topskip,

but first of all we never came up with a good way to = reference keys on the
right hand side and then there was the problem this = concept only worked for
certain key types and (forgotten what) and ...

so basically that idea was abandomed again, though = there might be some traces
left in the code I fear.

As it looks right now it seems to like this:

 - default values are executed first order of = specification at template
   level (unless overwritten)
 - instance values executed thereafter and in = order of specification
   at instance level

this is from looking at the following example:

\RequirePackage{template}
\RequirePackage{trace}

\DeclareTemplateType{xxx}{0}

\def\MultiSelection{\MultiSelectionError}
%\def\foo{bar}

%\traceon

\DeclareTemplate{xxx}{test}{0}
 {
  xkey=3Dn [\foo] \xkey,
  ykey=3Dn [\Delayevaluation\foo] \ykey,
  zkey=3Dn \zkey,
  last=3Dn [last] \lastkey
 }
 {
   \DoParameterAssignments
   abc
 }
\ShowTemplate{xxx}{test}


\DeclareInstance{xxx}{bar}{test}
 {
  zkey =3D foo,
  xkey =3D baz
 }
\DeclareInstance{xxx}{baz}{test}
 {
  last =3D first,
  zkey =3D foo
 }

\ShowInstance{xxx}{bar}
\ShowInstance{xxx}{baz}
----------------------------------------------

which gives:

(./template-test.tex
LaTeX2e <2000/06/01>
Babel <v3.6Z> and hyphenation patterns for = english, french, german, ngerman, du
mylang, nohyphenation, loaded.
(./template.sty (./ldcsetup.sty = (/cdrom/texmf/tex/latex/graphics/keyval.sty)
(/usr/local/texmf/tex/latex/tools/calc.sty))) = (./trace.sty)
******* Template: xxx/test *******
*
* Defaults:
*
\TPD>/xxx/test=3Dmacro:->\KV@xxx/test@last = {\def  \lastkey {last}}\KV@xxx/test@yk
ey {\def  \ykey {\Delayevaluation \foo = }}\KV@xxx/test@xkey {\def  \xkey {\foo }
}
*
* Restrictions:
*
\TPR>/xxx/test=3D\relax
*
* Body:
*
> \TP>/xxx/test=3D\long macro:
-> \DoParameterAssignments abc .
<recently read> \TP>/xxx/test

l.22 \ShowTemplate{xxx}{test}

?
******* Instance: <>xxx/bar *******
*
> \<>xxx/bar=3Dmacro:
->\TP@assignments {\def  \ykey = {\Delayevaluation \foo }\def  \lastkey {last}\de
f \zkey {foo}\def  \xkey {baz}}\TP>/xxx/test = .
<recently read> \<>xxx/bar

l.36 \ShowInstance{xxx}{bar}

?
******* Instance: <>xxx/baz *******
*
> \<>xxx/baz=3Dmacro:
->\TP@assignments {\def  \xkey {\foo = }\def  \ykey {\Delayevaluation \foo }\def
 \lastkey {first}\def \zkey = {foo}}\TP>/xxx/test .
<recently read> \<>xxx/baz

l.37 \ShowInstance{xxx}{baz}

? x

-------------------------------------------------------------

 > It would be nice if this
 > could be put in writing since you = sometimes need one assignment to be
 > carried out before another (my concrete = example of this is that an instance
 > key gets used in code for an `s' = key).

perhaps the above semantics could be made a formal = specification though it
would need to be checked whether this is true for all = key types. As I said my
recollection is that in the end the feeling was that = we can't rely on order
of specification (though even that would need formal = specification)


 > 2. The nature of the `n' key type
 >
 > Are `n' keys evaluated (expanded) at = declaration-time or not? template.dtx
 > is actually contradicting itself on this = matter: in Section 1 it says `n'
 > is the same thing as `f0', but in = Subsection 3.1 there is an example using
 > \DelayEvaluation in the default for a type = `n' key to avoid
 > declaration-time evaluation. As far as I = can tell the implementation takes
 > a third position as it parses a = \MultiSelection but otherwise leaves the
 > code unevaluated.

section 3.1 is rubbish and perhaps due to a bug that i = just noticed trying the
code. the code indeed looks for \MultiSelection but = since MultiSelection is an
undefined csname the test via \expandafter\ifx\@car = dies a horrible death if
you do

  key =3Dn [\foo] \key

and \foo is undefined (since that is then =3D to = \MultiSelection)

this is why the above sample code eactually \def's = \MultiSelection

have to run to earn some bread and butter (more on = that tonight)

frank

------_=_NextPart_001_01C089CA.55AA5800--