latex3 / tagging-project

Issues related to the tagging project
https://latex3.github.io/tagging-project/
LaTeX Project Public License v1.3c
35 stars 14 forks source link

block module: item-outside-list error is not correctly setup #35

Closed u-fischer closed 3 months ago

u-fischer commented 10 months ago

If one use an \item outside a list one get the error message

! Undefined control sequence.
<argument> \__block_item_instance:n 

If one define the command

\DocumentMetadata{testphase={block}}
\documentclass{article}
\begin{document}

\ExplSyntaxOn
\def\__block_item_instance:n{}
\ExplSyntaxOff

\item 

\end{document}

the message changes to

! LaTeX Error: Unknown message 'item-in-nonlist' for module '__block'.
car222222 commented 10 months ago

That final message is very strangely worded!

But something like that should be the principal message.

FrankMittelbach commented 10 months ago

@car222222 It is not strangely worded, it is just not the message you expect seeing. The above LaTeX error says that some L3 layer message is not found (probably misnamed), it is not saying anything about \item in the wrong place.

car222222 commented 10 months ago

Yes, OK. I see now why it looks strange. Maybe it is OK for what it is.

u-fischer commented 10 months ago

@FrankMittelbach I would suggest to change the test and message to

      \cs_if_free:NTF \@@_item_instance:n %%FMi?
        %{ \msg_error:nnn { @@ } { item-in-nonlist } { \item[{#1}] } }
        { 
          \@latex@error{Lonely~\string\item--perhaps~a~missing~
           list~environment}\@ehc
        }   

This would give the standard error:

! LaTeX Error: Lonely \item--perhaps a missing list environment.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.181 \item x
             xx

OK?

car222222 commented 10 months ago

That suggested message, whilst very amusing, is somewhat too vague . . . or not?

u-fischer commented 10 months ago

That is the standard message you get since 30 years or so. I simply copied it from latex.ltx.

car222222 commented 10 months ago

OK with me!

FrankMittelbach commented 3 months ago

That suggested message, whilst very amusing, is somewhat too vague . . . or not?

actually you might be the one who invented it :-) or I or David at the time matching perhaps a missing \item with a smile

davidcarlisle commented 3 months ago

That suggested message, whilst very amusing, is somewhat too vague . . . or not?

actually you might be the one who invented it :-) or I or David at the time matching perhaps a missing \item with a smile

or Rainer:-)

% \changes{LaTeX2.09}{1991/11/04}
%         {(RmS) added default definition for \cs{makelabel},
%               to produce an error message.}
FrankMittelbach commented 3 months ago

or Rainer ... but we have all been guilty of agreeing to this message (and I still think it is a nice and matching one).

car222222 commented 3 months ago

No guilt needed!