8

I use the siunitx-package to format my units. But in electronics, it is sometimes done that the value of a component, say a resistor, is written like

enter image description here

which means 3200 ohm.

Is there a possibility to do this with the siunitx-package, i.e. that following code generates above result? Thanks in advance.

\documentclass{article}

\usepackage{siunitx}

\begin{document}
    \SI{3.2e3}{\ohm}
    % or
    \SI{3.2}{\kilo\ohm}
\end{document}
10
  • 3
    Just curious. Where is that a standard way of writing 3.2kOhm? Commented Mar 25, 2020 at 17:55
  • 1
    It is not used in text, but it can be used in the circuit diagram and my professor is a huge fan of the notation. That's mainly the reason why I want to write it in this style.
    – Mario
    Commented Mar 25, 2020 at 19:23
  • 5
    @Zarko this notation has been standard in electronics for a long time for a good practical reason. When component values are marked on physical objects (circuit boards, the components themselves, etc) in dirty conditions, a small "." can easily become invisible, but larger symbol like a letter is more likely to remain readable. It would create even more chances for mistakes to use one "standard" in printed documents and a different "standard" for markings on the device that the document refers to.
    – alephzero
    Commented Mar 26, 2020 at 9:11
  • 4
    @alephzero's point also applies to circuit diagrams reproduced on old photocopiers, let alone faxed; luckily the error would tend towards a too-large resistor, which is less liekly to cause a dangerous fault than a too-small one. I've just looked at an old ANSI standard for circuit diagrams, from the 60s, and that doesn't use this approach. But it's very common in practice, and we may want to reproduce things as written. Less commonly it's also used with voltages (almost always 3V3 for 3.3~V)
    – Chris H
    Commented Mar 26, 2020 at 9:16
  • 2
    You usually don't see the ohm symbol just the 3k2
    – D Duck
    Commented Mar 26, 2020 at 13:57

2 Answers 2

11

I nominate

\SI[parse-numbers=false]{3k2}{\ohm}

and

\textup{3k2}\,\si{\ohm}

as answers to your question. The \textup directive guarantees that the numbers will be typeset in upright mode even when the expression occurs in italic text.

That said, I can't see what could possibly be wrong with writing

\SI{3.2}{\kilo\ohm}

Finally, if you really want to go for something eye-catching (though definitely also at least mildly eccentric), I could suggest

\SI{32}{\hecto\ohm}

enter image description here

\documentclass{article}
\usepackage{siunitx} % for \si and \SI macros
\begin{document}
\obeylines % just for this example
\SI[parse-numbers=false]{3k2}{\ohm}
\textup{3k2}\,\si{\ohm}
\SI{3.2}{\kilo\ohm}
\SI{32}{\hecto\ohm}
\end{document}
0
6
\documentclass{article}  
\usepackage{siunitx}
\newcommand\kohm[1]{\kohmaux#1\relax}
\def\kohmaux#1.#2\relax{\textup{#1}\SI{#2}[k]{\ohm}}
\begin{document}
\kohm{3.2}
\end{document}

enter image description here

2
  • What is the difference between this approach and \SI[parse-numbers=false]{3k2}{\ohm}? Commented Mar 29, 2020 at 1:09
  • 1
    @N3buchadnezzar I am no expert in siunitx, but it seems to me Mico's approach is to consider the k as part of the number, while this approach treats the k as a pre-unit. But it also means I have to parse and add the leading 3 outside of siunitx (you see it as \textup{#1}` in the defn.) Commented Mar 29, 2020 at 1:34

You must log in to answer this question.

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