cgnieder / acro

acronyms for LaTeX
LaTeX Project Public License v1.3c
40 stars 9 forks source link

Feature request - Error handling of “Acronym not defined” #224

Closed JeT76-ESCP closed 2 years ago

JeT76-ESCP commented 2 years ago

Hi Christian,

I fully integrated my 500+ acronyms in my 900+ pages document.

I use acro package I am happy with... until it has to handle errors. Once acro finds an acronym he's not aware of (often mispelled), it just generates an error that stops the compilation. After 30 minutes and 800 pages already compiled it's frustrating. What am I missing ?

Ulrike Fisher advised me in comment of this post to post a feature request here.

Thank you for this great package. JeT

MWE

\documentclass{book} 

\usepackage{acro} 

\DeclareAcronym{prems}{% 
    short=asset, 
    long= underlying asset, 
}

\DeclareAcronym{deuz}{% 
    short=asset class, 
    long=asset class, 
} 

\DeclareAcronym{troiz}{% 
    short=ASJ, 
    long=actif sous-jacent, 
} 

\begin{document} 

This is the demonstration of the usage of \ac{prem} (mispelling, it should be 'prems')---which is not to be confused with \ac{deuz} or \ac{troiz}. 

\printacronyms 

\end{document}
cgnieder commented 2 years ago

This is a reasonable request.

cgnieder commented 2 years ago

With the next update you can do something like this:

\documentclass{article}
\usepackage{acro}

\DeclareAcronym{prems}{
    short=asset, 
    long= underlying asset
}

\ExplSyntaxOn
\cs_set_protected:Npn \acro_acronym_undefined:n #1
  { \textbf {!#1} \PackageWarning {acro} {`#1' ~ undefined} }
\ExplSyntaxOff

\begin{document}

\ac{prems}

\ac{prem}

\end{document}

which will warn you in the log an the document but not raise any errors.