LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Proportional 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, 3 Jun 2014 08:47:57 +0930
Content-Type:
text/plain
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.

Cheers,
Will

ATOM RSS1 RSS2