siunitx icon indicating copy to clipboard operation
siunitx copied to clipboard

Help user to define some styles...

Open polgab opened this issue 8 years ago • 0 comments

The following document shows how to define the \SIdefstyle macro to help user to define styles.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[french]{babel}
\usepackage{siunitx}

\ExplSyntaxOn
\NewDocumentCommand\SIdefstyle{ m m }{
  \keys_define:nn { siunitx } {
    #1 .meta:n = {#2}
  }
}
\ExplSyntaxOff

% the FRwithsep style
\SIdefstyle{FRwithsep}{
  locale=FR,
  group-digits=integer,
  inter-unit-separator={{}\cdot{}},
  group-minimum-digits=5,
}

% the UKwithoutsep style
\SIdefstyle{UKwithoutsep}{
  locale=UK,
  inter-unit-separator={},
  group-digits=true,
  group-minimum-digits=4,
}


\begin{document}
\textsc{Planck} constant is:

$h = \SI[FRwithsep]{6626.07004e-37}{\kilo\gram\square\metre\per\second}$

$h = \SI[UKwithousep]{6626.07004e-37}{\kilo\gram\square\metre\per\second}$
\end{document}

polgab avatar Feb 13 '18 12:02 polgab