Skip to content
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

\ifnumber and (outdated) copied code from KOMA-Script #6

Open
komascript opened this issue Feb 17, 2022 · 1 comment
Open

\ifnumber and (outdated) copied code from KOMA-Script #6

komascript opened this issue Feb 17, 2022 · 1 comment

Comments

@komascript
Copy link

About 20 years ago Harald Harders copied some code from KOMA-Script, namely \ifnumber, \test@number, \gobble@till@next. Inside the definitions babelbib still uses \scr@next. Maybe it would be a good idea to change the prefix \scr@ to a babelbib specific prefix.

I've already renamed KOMA-Script's \gobble@till@next years ago. So this shouldn't be a problem, but e.g., package volumes does use the same macro name, because Frank Küster also copied code from KOMA-Script.

Until today the definition of \test@number was a problem, because if babelbib is loaded before scrbase there would be an error because of the already defined command. However, I have changed this today, using another macro name.

One problem with \ifnumber is: The LaTeX Team recommend to use \if… only for TeX like syntax: \if… … \else …\fi, but not for commands with arguments. They recommend to use either \If… or \If…TF or \…if…. Because of this, I've renamed the original \ifnumber in scrbase to \Ifnumber. The old \ifnumber currently outputs a warning, that it is deprecated. Currently there is a special treatment to avoid this warning, if babelbib is loaded. But maybe it would be a good idea to also rename it, e.g., to \btx@ifnumerical as already shown as margin note in the manual and already found in the index (but not yet defined).

A second problem with \ifnumber in babelbib is: The old code still used in babelbib does not work correctly with empty argument. Try:

\documentclass[english]{article}
\usepackage{babel}
\usepackage{babelbib}

\begin{document}
1234 is \ifnumber{1234}{}{not} a number.

ABCD is \ifnumber{ABCD}{}{not} a number.

The empty string is \ifnumber{}{}{not} a number.% results in an error
\end{document}

The improved definition of scrbase does work correctly:

\documentclass{article}
\usepackage{scrbase}

\begin{document}
1234 is \ifnumber{1234}{}{not} a number.

ABCD is \ifnumber{ABCD}{}{not} a number.

The empty string is \ifnumber{}{}{not} a number.
\end{document}
@norbusan
Copy link
Member

Hi @komascript
thanks a lot for all the suggestions. I have tried following your advice and renamed \src@next to \btx@next and rename \ifnumber to \btxifnumber. I opted against \btx@ifnumerical since it is used in the test document and might be useful for normal documents.

What I haven't look into is the scrbase definition of ifnumber, maybe I copy it over.

The changes are for now in this branch: https://github.com/TeX-Live/babelbib/tree/rename-src-next

I will do some testing later on. If you have further suggestions, please let me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants