4

I'm currently trying to display diameter dimensions with siunitx.

There is an old discussion with something similar in Trying to use symbols withing the number in the siunitx package. Also, in Automatically spacing the tilde (~) symbol as a prefix number using the `siunitx` package a patch is proposed to typeset number prefixes, though it seems it does not work with the current version of siunitx.

I thought the input-signs option of siunitx could help to handle that kind of situation, but I can't figure how to leverage this.

One could imagine that typing \SI{d10}{\milli\meter} would be output as $\diameter$~\SI{10}{\milli\meter}.

Is it possible to patch siunitx to support this ?

2
  • 2
    Sorry but the diameter symbol isn't part of the value here at all: what's wrong with $\diameter = \qty{10}{\mm}$ or similar?
    – Joseph Wright
    Commented Oct 10, 2023 at 12:31
  • @JosephWright yes, it's not part of the value, but its sort of a number prefix like for $ tex.stackexchange.com/a/81673/141947. There is nothing wrong with what you propose, except the = sign
    – BambOo
    Commented Oct 10, 2023 at 13:08

1 Answer 1

6

Whilst it feels odd to me, if you feel the diameter symbol is 'comparator-like' then

\documentclass{article}
\usepackage{etoolbox}
\usepackage{siunitx}
\usepackage{wasysym}
\robustify\diameter
\sisetup{input-comparators = \diameter}
\begin{document}
$\qty{\diameter10}{\mm}$
\end{document}

would work.

1
  • Thanks, exactly what I wanted !
    – BambOo
    Commented Oct 10, 2023 at 16:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .