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

per in math mode: Improper `at' size (0.0pt), eplaced by 10pt #775

Closed
Reissner opened this issue Jan 22, 2025 · 9 comments
Closed

per in math mode: Improper `at' size (0.0pt), eplaced by 10pt #775

Reissner opened this issue Jan 22, 2025 · 9 comments

Comments

@Reissner
Copy link

Reissner commented Jan 22, 2025

I use siunitx version 28b.
Thus I added the patch https://www.texdev.net/2021/06/30/siunitx-v2-to-v3.

Also I configure with

\usepackage{xfrac}
\usepackage{siunitx}
\sisetup{per-mode=fraction}
\sisetup{fraction-function=\sfrac}

Then all works fine as long as I am in text mode.
Even math modes works frequently, but for example

$[-\qty{11}{\meter\per\second},\qty{11}{\meter\per\second]$

yields an error:

! Improper `at' size (0.0pt), replaced by 10pt. 
<to be read again>
relax

but

$[-\qty{11}{\meter/\second},\qty{11}{\meter/\second]$

works.
It is strange, that in some places even the following works:

$[-{\qty{11}{\meter\per\second}},\qty{11}{\meter\per\second]$
@josephwright
Copy link
Owner

I will need a complete example: for me

\documentclass{article}
\usepackage{xfrac}
\usepackage{siunitx}%[=v2]
\sisetup{per-mode=fraction}
\sisetup{fraction-function=\sfrac}
\begin{document}
$[-\qty{11}{\meter\per\second},\qty{11}{\meter\per\second}]$
\end{document}

works with the latest release, and if I replace \qty by \SI it also works with the final v2 release.

@Reissner
Copy link
Author

Reissner commented Jan 22, 2025

I see.
A quite minimal file I found is the following:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{anyfontsize}
\usepackage{xfrac}
\usepackage{siunitx}
\sisetup{per-mode = fraction}
\sisetup{fraction-function=\sfrac}

\ifdefined\qty\else
  \ifdefined\NewCommandCopy
    \NewCommandCopy\qty\SI
  \else
    \NewDocumentCommand\qty{O{}mm}{\SI[#1]{#2}{#3}}
  \fi
\fi
\ifdefined\unit\else
  \ifdefined\NewCommandCopy
    \NewCommandCopy\unit\si
  \else
    \NewDocumentCommand\unit{O{}m}{\si[#1]{#2}}
  \fi
\fi

\begin{document}
Nevertheless, we suggest a range of $[-\qty{11}{\meter\per\second},\qty{11}{\meter\per\second}]$. 
We could spedify a range $[-\qty{90}{\meter\per\second},\qty{90}{\meter/\second}]$. % <----------- this is the line to fail. 
\end{document}

As you can see, i use lualatex.
Independent of this issue, i want to point out, that i need anyfontsize to avoid warnings.
Maybe you should mention that in your documentation.

I wonder what the O{}mm means.. first I thought it shall be 0{}mm.

As you will see, if you remove the line Nevertheless, ...., the problem disappears.
So there seems an influence between the lines.. very strange.

@josephwright
Copy link
Owner

Aside - you shouldn't be using T1 encoding with LuaTeX.

@josephwright
Copy link
Owner

Your example compile fine with v3 - I have no plans to make changes to the v2 code unless it breaks with core LaTeX changes.

@Reissner
Copy link
Author

So you can reconstruct problem with v2?

By the way? why not T1 with luatex?

@Reissner
Copy link
Author

@josephwright
Copy link
Owner

josephwright commented Jan 22, 2025

So you can reconstruct problem with v2?

Yes, although my feeling is this is an issue outside of siunitx.

By the way? why not T1 with luatex?

LuaTeX is Unicode, and the font slots are therefore wrong for some parts of T1.

@Reissner
Copy link
Author

can you tell me about the meaning of the mysterious {O{}m} in your compatibility definition for v2 users wanting v3 feeling?

@josephwright
Copy link
Owner

can you tell me about the meaning of the mysterious {O{}m} in your compatibility definition for v2 users wanting v3 feeling?

This is standard LaTeX syntax for \NewDocumentCommand:

  • O{} is an optional argument with an empty default value
  • m is a mandatory argument

See texdoc usrguide for example.

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