LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

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

Print Reply
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
Content-Type: text/plain; charset=windows-1252
Date: Tue, 3 Jun 2014 08:47:57 +0930
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Will Robertson <[log in to unmask]>
Message-ID: <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Transfer-Encoding: 8bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (59 lines)
Hi Joseph,

I think the name and the functionality are sensible.

On 3 Jun 2014, at 12:47 am, Joseph Wright <[log in to unmask]> wrote:

> However, there are cases where you'd like to 'preset' the key every
> time. Currently, that would require
>    \cs_new_protected:Npn \foo #1#2 % #1 = keys
>      {
>        \keys_set:nn { mymod }
>          {
>            key-a = new-value ,
>            #1
>          }
> but that is not that efficient and also not that clear.
> An alternative approach is to provide a method to 'preset' keys from
> within the key system, something like
>  \keys_define:nn { mymod }
>    {
>      key-a .tl_set:N = \l_mya_tl ,
>      key-a .preset:n = value
>     ...
>    }
> where the presetting can avoid having to parse the keys each time it's
> run (cf. what happens in template).

The first case is what I do in fontspec (but thereís lots I do in fontspec that I probably shouldn't).
I suspect that Iíd need to play around with some interfaces to figure out how this would change things.
Thinking along these lines:

>    \cs_new_protected:Npn \foo #1#2 % #1 = keys
>      {
>        \keys_define:nn { mymod }
>          {
>            key-a .preset:n = new-value ,
>          }
>       \keys_set:nn { mymod }
>          {
>            #1
>          }

One thing that becomes a bit harder is unsetting the preset; if I then need to run \keys_set:nn again the preset would either need to be grouped or explicitly disabled.

(E.g., when setting Letters=SmallCaps for the small caps font before moving on to another font shape.)

So at least in my use case, and only thinking very briefly about it, Iím not sure if this interface would be a advantage for fontspec ó but thatís not to say that itís not a bad idea, nor either that fontspec couldn't be re-jigged to be a bit more sensible in such matters.