Skip to content
Snippets Groups Projects
siunitx-PTB.sty 2.5 KiB
Newer Older
% Rolf Niepraschk, PTB, Rolf.Niepraschk@ptb.de

Rolf Niepraschk's avatar
Rolf Niepraschk committed
\ProvidesPackage{siunitx-PTB}[2018/05/28 v0.1c Additions to `siunitx'' (PTB/RN)]
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\RequirePackage{amsmath,siunitx}

\providecommand*\vl@tempa{}
\providecommand*\vl@tempb{}
\providecommand*\vl@tempc{}
\providecommand*\vl@tempd{}
\providecommand*\vl@tempe{}
\DeclareSIUnit\torr{Torr}
\DeclareSIUnit\mbar{\milli bar}
\DeclareSIUnit\bar{bar}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\DeclareSIUnit\sccm{sccm}% Standard Cubic Centimeters per Minute

%%%\AtBeginDocument{%
\sisetup{%
  %%%,exponent-product = \ensuremath { \cdot }     % wird per "locale" gesetzt
  %%%,inter-unit-product = \ensuremath{{}\cdot{}}  % wird per "locale" gesetzt
  %,output-exponent-marker=\text{E}
%  ,table-alignment = center
  %%%,table-number-alignment = center
  %%%,table-text-alignment = center
%  ,table-align-exponent = true
%  ,table-parse-only = true % ?!
%  ,table-format = +1.3e+1
  %%%,table-figures-integer = 1
  %%%,table-figures-decimal = 3
  %%%,table-figures-exponent = 2
  %%%,input-uncertainty-signs = +-
  %%%,output-open-uncertainty =
  %%%,output-close-uncertainty =
  %%,separate-uncertainty = true
  ,bracket-numbers = true
  %,per-mode = symbol
  ,per-mode = reciprocal
  %,per-mode=symbol-or-fraction
  ,mode = text % !!!
  ,tight-spacing = false
  ,separate-uncertainty
  %%%,inter-unit-product = \ensuremath{{}\cdot{}}
  % weil default ( {}^{\circ} ) manchmal problematisch ("firamath"!?) 
  ,text-degree = \textdegree
  ,math-degree = \textdegree  
  ,math-celsius = \textdegree\text{C}
  ,text-celsius = \textdegree\text{C}
}%     

%%%}
\AtBeginDocument{
  \sisetup{%
    ,inter-unit-product=\ensuremath{{}\cdot{}}
  }%
}

\RequirePackage{trimspaces}

\let\ke@orig@SI=\SI
\renewcommand*\SI[2][]{% tolerant gegenüber "?" statt Zahl
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  \def\vl@tempa{#1}%
  \edef\vl@tempb{\trim@spaces{#2}}%
  \ks@SI@i
}
\newcommand*\ks@SI@i[2][]{%
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  \def\vl@tempc{?}%
  \ifx\vl@tempb\vl@tempc
    \ensuremath{\textbf{??}}\,\si[#1]{#2}%
  \else
Rolf Niepraschk's avatar
Rolf Niepraschk committed
    \edef\vl@tempe{\noexpand\ke@orig@SI[\vl@tempa]{\vl@tempb}[#1]{#2}}%
    \vl@tempe
  \fi
}
\let\ke@orig@num=\num
\renewcommand*\num[1]{% tolerant gegenüber "?" statt Zahl
Rolf Niepraschk's avatar
Rolf Niepraschk committed
  \edef\vl@tempb{\trim@spaces{#1}}%
  \def\vl@tempc{?}%
  \ifx\vl@tempb\vl@tempc
    \ensuremath{\textbf{??}}%
  \else
    \ke@orig@num{#1}%
  \fi
}

\RequirePackage{iflang}
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\AtBeginDocument{%
  \IfLanguageName{ngerman}{
    \sisetup{locale=DE}
  }{%
    \sisetup{locale=UK}
  }
Rolf Niepraschk's avatar
Rolf Niepraschk committed
\addto\extrasgerman{\sisetup{locale=DE}} 
\addto\extrasngerman{\sisetup{locale=DE}} 
\addto\extrasenglish{\sisetup{locale=US}}