3

I can not understand when siunitx places a point between units. in the examples below, why is there no point between \kilogram and \meter ^ 2 whereas there is one between \newton and \meter?

How to homogenize the writing of units?

PS: I also find that the space between the point and the units is too important, how to reduce it?

% !TeX encoding = utf8
% !TeX spellcheck = fr

% !Tex program = Xelatex + shell-escape

\documentclass%
[%
paper=a4
,fontsize=11pt % common are 10, 11 or 12
,headings=normal
%,parskip
,numbers=noendperiod % 2.3.1 vs 2.3.1. (no dot after the last chapter number)
,twoside=true
,toc=bibliography % Bibliography appears in Table of Contents (without a number)
,toc=listof % List of Figures and List of Tables appear in Table of Contents
,version=last % Use latest version of the KOMA-Script
,enabledeprecatedfontcommands
,div=18
]%
{scrbook}

\usepackage{fontspec}

\usepackage{mathpazo}
\setmainfont
     [ BoldFont       = texgyrepagella-bold.otf ,
       ItalicFont     = texgyrepagella-italic.otf ,
       BoldItalicFont = texgyrepagella-bolditalic.otf ]
     {texgyrepagella-regular.otf}


\usepackage[french]{babel} 

\usepackage{tikz}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,},group-minimum-digits=4,abbreviations}
\sisetup{inter-unit-product=\ensuremath{{}\cdot{}}}

\begin{document}
\SI{100}{\metre\per\second}
\SI{100}{\newton\metre\second\tothe{-2}}
\SI{100}{\newton\metre}
\SI{100}{\kilogram\metre^2}
$\SI{100}{\kilogram\metre\tothe{2}}$
\end{document}
0

3 Answers 3

9

The siunitx package works in two 'modes': one where all units are given as macros, and the second when there is literal material in the unit. In the latter case, formatting is extremely limited: it's simply not possible to do the kind of processing that is doable with macro-based units. When you add ^2 rather than \squared, you are forcing 'literal mode' and the package cannot add inter-unit information.

0
2

So Joseph's solution works when using the macros but I ran into the same problem but while using the 'literal mode'. siunitx also provides a way to add spacing in literal mode by putting a period or tilde in between units. So you can do one of the following options to add spacing:

  • \unit{kg.m^2} or \unit{kg~m^2}
  • \unit{\kilogram\meter\squared}

See section 3.3 of the siunitx documentation.

0

See the Section 4.10 of the documentation for the siunitx package. Just modify the options:

\unit[inter-unit-product = \ensuremath{{}\cdot{}}]{kg.m^2}
2
  • 4
    I'm sure many readers here are like me illiterate in asian languages ... So if your remarks do add value to your answer, please translate into English. Else, a few more words explaining your solution will be appreciated.
    – MS-SPO
    Commented Mar 19 at 7:38
  • 1
    In addition to the language issue, judging by the code snippet, the content seems to already be covered by another answer.
    – schtandard
    Commented Mar 19 at 11:43

You must log in to answer this question.

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