cgnieder / elements

Properties of chemical elements
7 stars 4 forks source link

bug in element #2

Closed MEGRETP closed 7 years ago

MEGRETP commented 7 years ago

Dear Clemens,

I found some small mistakes: 2 on French names for elements (Mo and Lu) and two on main isotopes (Li and Er):

I try to correct them by using:

\setatomisotopes{3}{4,5,6,!7,8,9,10,11,12}
\setatomisotopes{68}{162,163,164,165,!166,167,168,169,170}
\setatomname[Molybdene]{42}{Molybd\`ene}
\setatomname[Lutecium]{71}{Lut\'ecium}

But if I put all four lines before \begin{document}, French name are corrected but main isotope numbers are empty for corrected values.

If I put all four lines after \begin{document}, French name are wrong but main isotope numbers for corrected values are correct.

So I have to put

\setatomisotopes{3}{4,5,6,!7,8,9,10,11,12}
\setatomisotopes{68}{162,163,164,165,!166,167,168,169,170}

before \begin{document} and

\setatomname[Molybdene]{42}{Molybd\`ene}
\setatomname[Lutecium]{71}{Lut\'ecium}

after \begin{document}

Rmk: if \ttfamily, the solution with the 4 lines after \begin{document} works.

Best regards, Patrice

cgnieder commented 7 years ago

I corrected the typos and isotope lists. The isotope lists are defined in the sty file so changing them in the preamble works. The names, however, are set when the language of the document is determined and this happens at begin document.

\usepackage{elements}

\AtBeginDocument{
  \setatomisotopes{3}{4,5,6,!7,8,9,10,11,12}
  \setatomisotopes{68}{162,163,164,165,!166,167,168,169,170}
  \setatomname[Molybdene]{42}{Molybd\`ene}
  \setatomname[Lutecium]{71}{Lut\'ecium}
}

\begin{document}

would have worked.

This is completely independent from using any font or font family so I cannot believe the remark unless you show me a MWE.

cgnieder commented 7 years ago

fixed in commit 2f964d5fbb6e55af99ffd1c7f6742011ec3b233b

MEGRETP commented 7 years ago

Thanks a lot.

Here is a small example of the problem with \ttfamily and babel francais: the first \mainelementisotope is empty.

\documentclass{book} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage[francais]{babel}

\usepackage{elements} \begin{document} \setatomisotopes{3}{4,5,6,!7,8,9,10,11,12}

main isotope: \mainelementisotope{3}

\ttfamily main isotope: \mainelementisotope{3} \end{document}

cgnieder commented 7 years ago

This is much more interesting:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{elements}

\begin{document}

\mainelementisotope{3}

text \mainelementisotope{3}

\end{document}

I am not sure what exactly happens but cause of the problem is that French babel makes ! an active character. Making it other temporarily solves the problem:

\catcode`!=12
\setatomisotopes{3}{4,5,6,!7,8,9,10,11,12}
\catcode`!=13

solves the problem.

MEGRETP commented 7 years ago

Dear Clemens,

Thanks.

Elements has been upgraded on CTAN but the error on the name of element 71

\DeclareAtomName[Lutetium]{71}{Lut\'etium}

is still there. (replace t par c)

It should be:

\DeclareAtomName[Lutecium]{71}{Lut\'ecium}

cgnieder commented 7 years ago

Oh, well… Thanks