Code Monkey home page Code Monkey logo

Comments (10)

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


The MWE

#!latex

\documentclass{article}
\usepackage{acro}
\begin{document}

\ac{foo}

\end{document}

gives in the log

#!latex

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! acro error: "undefined"
! 
! You've requested acronym `foo' but it seems that it was never defined!
! 
! See the acro documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.5 \ac{foo}

so actually all information obout the mispelling and the input line where the error happens are there.

But if you like you can do something like the following:

#!latex

\documentclass{article}
\usepackage{acro}

\ExplSyntaxOn
\bool_new:N \l_acro_warned_bool
\cs_set_protected:Npn \acro_defined:n #1
  {
    \bool_if:nTF
      {
        !\l_acro_warned_bool &&
        !\prop_if_in_p:Nn \l__acro_short_prop {#1}
      }
      {
        \msg_warning:nnn {acro} {undefined} {#1}
        \textbf {[#1]}
        \bool_set_true:N \l_acro_warned_bool
      }
      { \bool_set_false:N \l_acro_warned_bool }
  }
\ExplSyntaxOff

\begin{document}

\ac{foo}

\end{document}

Now you'll get in the log:

#!latex


*************************************************
* acro warning: "undefined"
* 
* You've requested acronym `foo' but it seems that it was never defined!
*************************************************

which unfortunately means that the corresponding line is not recorded.

It would be possible to change that, too:

#!latex

\documentclass{article}
\usepackage{acro}

\ExplSyntaxOn
\bool_new:N \l_acro_warned_bool

\msg_set:nnn {acro} {undefined}
  {
    You've~requested~acronym~`#1'~\msg_line_context: \c_space_tl
    but~you~ apparently~haven't~defined~it,~yet!~
    Maybe~you've~mispelled~it?
  }

\cs_set_protected:Npn \acro_defined:n #1
  {
    \bool_if:nTF
      {
        !\l_acro_warned_bool &&
        !\prop_if_in_p:Nn \l__acro_short_prop {#1}
      }
      {
        \msg_warning:nnn {acro} {undefined} {#1}
        \textbf {[#1]}
        \bool_set_true:N \l_acro_warned_bool
      }
      { \bool_set_false:N \l_acro_warned_bool }
  }
\ExplSyntaxOff

\begin{document}

\ac{foo}

\end{document}

gives:

#!latex


*************************************************
* acro warning: "undefined"
* 
* You've requested acronym `foo' on line 32 but you apparently haven't defined
* it, yet! Maybe you've mispelled it?
*************************************************

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by moreen (Bitbucket: moreen, GitHub: moreen).


Thank you for your fast answer.

When I use the lower code-fragment Texniccenter will only write a warning "undefined".

I think the problem is, that you are not using a standard format. For example the amsmath-package i use writes a warning like this:

#!

Package amsmath Warning: Foreign command \atop;
(amsmath)                \frac or \genfrac should be used instead
(amsmath)                 on input line 97.

This whole message is printed very nicely in one line. No other package I use print any stars around their messages.

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


This is no »problem« really, just a question of convenience and what you're used to. Warnings or errors like the amsmath one are produced by LaTeX2e's \PackageError and \PackageWarning macros. acro however is written in expl3, the programming layer for a (yet to come) LaTeX3 and uses its messaging module. You'll get the same kind of warnings by other packages as well such as siunitx or xparse or any other package written in expl3.

The issue that TeXnicCenter cannot parse those kind of messages is unrelated and not something a package author should need to bother with. Personally I've never used TeXnicCenter. I always take a look at the corresponding log-file of a LaTeX compilation and there the expl3-messages are a lot easier spotted than the »traditional« ones.

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by moreen (Bitbucket: moreen, GitHub: moreen).


Ok, thank you. If it is a new format I will write a request for TeXnicCenter.

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by moreen (Bitbucket: moreen, GitHub: moreen).


I have made some tests for creating an appropriate report for the texniccenter community and found, that with this code:

#!latex

\documentclass{article}
\usepackage{acro}
\begin{document}

\ac{foo}

\end{document}

Texniccenter together with Miktex creates two entries in the log:

#!latex

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! acro error: "undefined"
! 
! You've requested acronym `foo' but it seems that it was never defined!
! 
! See the acro documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.5 \ac{foo}
            
|'''''''''''''''''''''''''''''''''''''''''''''''
| You've requested acronym `foo' on line 5 but you apperantly haven't defined
| it, yet! Maybe you've mispelled it?
|...............................................


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! acro error: "undefined"
! 
! You've requested acronym `foo' but it seems that it was never defined!
! 
! See the acro documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.5 \ac{foo}
            
|'''''''''''''''''''''''''''''''''''''''''''''''
| You've requested acronym `foo' on line 5 but you apperantly haven't defined
| it, yet! Maybe you've mispelled it?
|...............................................

And according to my dictionary
"apperantly" should be "apparently"
and
"mispelled" should be "misspelled"

When I change it to a warning it is just one report:

#!latex

*************************************************
* acro warning: "undefined"
* 
* You've requested acronym `foo' on line 47 but you apparently haven't defined
* it, yet! Maybe you've mispelled it?
*************************************************

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


Thanks, I'll correct the typos.

I noticed as well that the error is thrown twice and will correct this in the next version.

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by moreen (Bitbucket: moreen, GitHub: moreen).


Cool, thank you. Looking forward to a new version. :-)

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


v1.6 will only issue one error/warning and will have the option messages=loud|silent which allows to turn all error messages into warnings (and at the same time all warnings into info messages)

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


resolved in commit d628ba8

from acro.

cgnieder avatar cgnieder commented on August 15, 2024

Original comment by Clemens Niederberger (Bitbucket: cgnieder, GitHub: cgnieder).


Removing version: 1.5 (automated comment)

from acro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.