2

When I do \msg_new:nnnn { module } { errorname } { explenation } and then \msg_warning { module } { errorname } i get Package module Warning:. How can I get it to say Class module Warning: or LaTeX Warning: instead? I tried using LaTeX instead of module which seems to have worked for the error, but nbot for the warning. I also tried class instead of module, but that did not really work.

Here is a MWE:

% Get rid of warnings for filecontents:
\RequirePackage{silence}
\WarningFilter[filecontents]{latex}{Writing or overwriting}
\WarningFilter[filecontents]{latex}{You have requested document class}
\ActivateWarningFilters[filecontents]

% Create class:
\begin{filecontents}[overwrite]{myclass.cls}
    \NeedsTeXFormat{LaTeX2e}
    \ProvidesClass{Code/CV}[2022/06/06 Curriculum Vitae]
    \LoadClass[a4paper]{article}
    
    % Class warning/error:
    \ExplSyntaxOn
    \msg_new:nnn { Class } { class warning } { this~is~some~class~warning }
    \msg_new:nnn { Class } { class error } { this~is~some~class~error }
    
    \msg_error:nn { Class } { class error }
    \msg_warning:nn { Class } { class warning }
    \ExplSyntaxOff
    
    \endinput
\end{filecontents}

\documentclass{myclass}

% Create Package:
\begin{filecontents}[overwrite]{mypack.sty}
    % Package warning/error:
    \ExplSyntaxOn
    \msg_new:nnn { mypack } { mypack error } { this~is~some~package~error.}
    \msg_new:nnn { mypack } { mypack warning } { this~is~some~package~warning.}
    
    \msg_warning:nn { mypack } { mypack warning }
    \msg_error:nn { mypack } { mypack error }
    \ExplSyntaxOff
    
    \endinput
\end{filecontents}

\usepackage{mypack}


\begin{document}

% LaTeX3 warning/error:
\ExplSyntaxOn
    \msg_new:nnn { LaTeX } { LaTeX error } { this~is~some~LaTeX~error}
    \msg_new:nnn { LaTeX } { LaTeX warning } { this~is~some~LaTeX~error}
    
    \msg_error:nn { LaTeX } { LaTeX error }
    \msg_warning:nn { LaTeX } { LaTeX warning}
\ExplSyntaxOff

This is a PDF

\end{document}

enter image description here

For some reason, the LaTeX3 warning does not show up and the class error and warnings are not right. What is the problem here? I want it to say Class myclass error: like the command \ClassError{myclass}{ }{ } does. What is it I'm doing wrong here?

1
  • 1
    not related but you shouldn't silence filecontents like that. I would get quite angryif a class would do that. Nov 27, 2022 at 13:49

1 Answer 1

2

The l3msg module contains a global property list for this mapping. Simply add your class to that property list:

\prop_gput:Nnn \g_msg_module_type_prop { mythingy } { Class }
5
  • Thanks. Worked for the errors, but now only the package warning shows up. The document warning and LaTeX3 warning does not show up.
    – Vebjorn
    Nov 27, 2022 at 13:52
  • @Vebjorn I can't reproduce that, for me, simply putting an additional line in your myclass.cls with \prop_gput:Nnn \g_msg_module_type_prop { Class } { Class } works and all the errors and warnings show up.
    – Skillmon
    Nov 27, 2022 at 13:54
  • Maybe it has something to do with me using Overleaf? It seems the warnings show up in the raw log, but not where the other warnings and errors show up...
    – Vebjorn
    Nov 27, 2022 at 13:56
  • 1
    @Vebjorn then report that to Overleaf (if their message filter doesn't work correctly that is very concerning!)
    – Skillmon
    Nov 27, 2022 at 14:05
  • 1
    Yes, Overleaf's log parser is partially broken. I've reported this and sent in a fix, but the fix hasn't been activated yet. Nov 27, 2022 at 14:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .