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
Classes messages claimed to be "Package" messages #887
Comments
It is, but you have to tell it explicitly by adding the type of your file to \prop_gput:Nnn \g_msg_module_type_prop { myclass } { Class } and optionally its name to \prop_gput:Nnn \g_msg_module_name_prop { myclass } { My~Nice~Class } then you get a warning like:
Maybe MWE: \begin{filecontents*}[overwrite]{myclass.cls}
\ProvidesExplClass
{myclass}
{2021/04/26}
{0.1}
{
My Nice Class
}
\NeedsTeXFormat{LaTeX2e}
\LoadClass { article }
%
\prop_gput:Nnn \g_msg_module_type_prop { myclass } { Class }
\prop_gput:Nnn \g_msg_module_name_prop { myclass } { My~Nice~Class }
\msg_new:nnn {myclass} {Foo} {Bar}
\msg_warning:nn {myclass} {Foo}
\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{myclass}
\begin{document}
\end{document} |
Would be nice! 😄 |
There's no particular relationship between That's before the whole 'really classes shouldn't use |
I don't see why.
I don't understand what's the idea that doesn't quite work. |
In
Classes really should be about formatting/style/etc., not functionality. The latter should be added by packages, which ideally would be independent of the classes they are used with. The current situation is not ideal, and early on the |
The class I'm currently working on should insert a graphic on the first page of the document... if this graphic is found and otherwise should display an admonition (in addition to a warning in the log file). Is it design or functionality? |
I've fixed the issue at hand by moving the documentation of @dbitouze While you're asking a good question on design vs code, I don't think this issue is the right place. Perhaps it could make sense to post a question on stackexchange and have one of the team members answer there? Or a question on the LaTeX-L mailing list. I don't really know. |
Done. |
AFAICS, the MCE in the OP still writes:
even with
|
@dbitouze have you applied
The "fixed" in Bruno's message was to move the documentation earlier to make it clear that such a line needs adding not that such a ine is no longer needed. |
Hum, no, sorry for the misunderstanding.
Too bad: I thought (and hoped) the fix didn't require anymore any action from the class author 😄 Is it planned? |
As @josephwright explained there is no automatically detectable connection between a prefix used and a class or package name. This is not really different from the old 2e method of explicitly saying So using "myclass" is just a string passed to the msg system and while we humans might think seeing "class" in the name means it is a class the msg system can't make that deduction (and it may be wrong anyway). This is why action from the class author is needed and was needed in the past where you wrote |
We could plausibly keep track when \ProvidesExplClass is called and
\g_msg_module_type_prop has not been modified between the start and end of the
file (probably only warn if \msg_new:nnnn has been called).
It doesn't sound too ugly, and it could avoid this easy mistake.
|
we could, but it is a runtime cost for every document while the error is a class error that manifests itself with wrong (but harmless ) output and is easily corrected once and for all. So I'm not really in favor of slowing down processing with runtime checks. If at all it should go into the check option. I know this runtime costs are all tiny by itself but overll they add up. |
As shown by the following MCE, classes messages are claimed to be "Package" messages:
writes:
Shouldn't the
l3msg
module be able to distinguish between\ProvidesExplClass
and\ProvidesExplPackage
?The text was updated successfully, but these errors were encountered: