-
-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set template keys docu #1614
base: develop
Are you sure you want to change the base?
Set template keys docu #1614
Conversation
more exactly there is one usage in |
|
Maybe it should be called |
I thought that the fact this says 'template keys' suggested it would only handle known ones - but again no objection to a change. |
why would it? It could be a wrapper for |
I don't quite like |
Nothing really tells that it should only be used in the template code and it would be hard to get that into the name (which is why that is explicitly documented now) but using "Known" helps when reading code where it is in the right place, then you immediately see why it could get keys that do not fit for that particular template without ding harm and it fits with the underlying command which is |
yes how unknown keys are handled is certainly a question that would come to my mind, and it would fit better the definition as the underlying command is |
It would be nice, but rather hard, if even possible, to implement. For example, the key/vals to |
I have now updated and extended the documentation as well as moved the empty test inside the command, so I think it is ready for another review. What remains open is the csname. Are we good with |
I didn't mean a general tracking. |
ok, back to the drawing board then. what about this?
It would be for sure a breaking change, but I guess not a bad one. |
one would have to check the block code and adapt the uses there but beside this this looks fine imho. |
sure, the block code is already adapted as part of the PR (but it needs a corresponding change then) |
@FrankMittelbach I've already removed the usage in keytheorems and use |
ah, so much the better, then there is no usage of the current command other than in latex-lab, makes life easy. Btw, what to you think of the new docs and the suggested change/extension? |
I like the documentation changes. I'm not sure I fully understand the discussion about known/unknown keys, but I'm not a fan of the lack of error when an unknown key is passed to, say, |
The problem is that as @FrankMittelbach has indicated, you might need several templates for a complex case like this. So how do you decide where to issue a warning? We really don't want users to have to work out which template is which for setting keys - we looked at prefixing all keys, and it doesn't make a good interface. |
Not that I have much to say about this, but if this should only be used inside template code how about something like |
…keys (checking) --- WIP
I have now a first implementation for checkingg all user-supplied keys to block environments. a) it can be handled (but not yet cleanly, I'm missing some support interfaces) |
@FrankMittelbach @josephwright |
Using "This" in the name would help with identifying where it should be, but assuming it is in the right place, the important info for somebody reading the code is whether it only deals with known, keys (and ignores the rest) or whether it handles everything in its argument (and complains if it finds some unknown ones). and putting in "Known" as well makes the name really horrible in my eyes. Thus I think it is better to find a name that it good for somebody reading the code and document where to put it for those writing the code, hence my current names. |
… be a good choice compared to \SetKnownTemplateKeys
# Conflicts: # base/changes.txt
I think it is ready enough for your review (otherwise you might find it got merged) The only open question for me is whether or not top fully dop |
I think we could probably drop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite a lot here by now.
@@ -517,7 +594,7 @@ | |||
% is the same as creating an instance using \cs{DeclareInstance} | |||
% and immediately using it with \cs{UseInstance}, but without the | |||
% instance having any further existence. It is therefore useful where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It ==> This command
where ==> if OR when
{#1} | ||
\UnusedTemplateKeys | ||
% \end{macrocode} | ||
% After this instance has been processed any remaining unused keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. . . processed, any . . .
\UnusedTemplateKeys | ||
% \end{macrocode} | ||
% After this instance has been processed any remaining unused keys | ||
% are in \cs{UnusedTemplateKeys} and we can continue with that as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is "that" ??
% long as we do not call an instance that does unused key | ||
% processing but we don't pass our keys on, so have to same its | ||
% current value for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot follow this at all!!
"same" is not adverb!
Maybe should have been "save" ??
{#1} | ||
\l_@@_unused_blockenv_keys_tl | ||
% \end{macrocode} | ||
% Again the instance may has processed a few keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
????
% \cs{item} which is implemented through an \texttt{item} | ||
% template. This way, one can specify one-off settings to all items | ||
% of a single whole list (on the environment level), as well as to | ||
% individual items within a list (by specifying them in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Betterment
. . . within that list . . .
% optional argument of an \cs{item}). With | ||
% \cs{SetKnownTemplateKeys} and \cs{SetTemplateKeys} working | ||
% together, it is possible to provide this flexibility and still | ||
% alert the user if one of their keys is misspelled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
if ==> when
% | ||
% On the other hand you may want to allow for | ||
% \enquote{misspellings} without generating an error or a | ||
% warning. For example, if you define an template that only accepts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a template (not an)
Better:
. . . that accepts only a few keys
% \enquote{misspellings} without generating an error or a | ||
% warning. For example, if you define an template that only accepts | ||
% few keys, you might just want to ignore anything specified in the | ||
% source if you use this template in place of a different one, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ==> when
% The \cs{SetKnownTemplateKeys} and \cs{SetTemplateKeys} commands | ||
% are only supported within the code of a template; using them | ||
% elsewhere has unpredictable results. If they are used together | ||
% with \cs{AssignTemplateKeys} then this command should come first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear:
Which should come first?
Thanks for waiting! |
Not sure what was meant here: whether or not top fully dop \SetTemplateKeys Maybe it should read : |
Internal housekeeping
Status of pull request
Checklist of required changes before merge will be approved
\changes
entries in source includedchanges.txt
updatedltnewsX.tex
(and/orlatexchanges.tex
) updatedOne thing to consider: change name from
\SetTemplateKeys
to\OverwriteTemplateKeys
, which seems to me sits better with\AssignTemplateKeys
(as it is theny clear what the order would be). It is not used in texmf (other than in latex-lab) so that could be a breaking change without problems.