Package siunitx Error: Found prefix part with no unit Thema ist als GELÖST markiert

Formelsatz für Mathematik, Naturwissenschaften und Technik


AaronK
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 77
Registriert: So 2. Mai 2021, 09:29

Package siunitx Error: Found prefix part with no unit

Beitrag von AaronK »

TexLive 2021 verwendet das Packet sinunits. Ich bekomme folgende Fehlermeldung:

Package siunitx Error: Found prefix part with no unit

{\renewcommand{\arraystretch}{1.1}
\begin{xltabular}{\textwidth}{@{}lrll@{}}\toprule
\textbf{Faktor} & \textbf{Dezimalschreibweise} & \textbf{Name} & \textbf{Zeichen} \\\midrule
\endhead
$10^{-24}$ & 0.000 000 000 000 000 000 000 001 & Yocto & \unit{\yocto\nounit} \\
$10^{-21}$ & 0.000 000 000 000 000 000 001        & Zepto & \unit{\zepto\nounit} \\
$10^{-18}$ & 0.000 000 000 000 000 001               & Atto  & \unit{\atto\nounit} \\
$10^{-15}$ & 0.000 000 000 000 001                      & Femto & \unit{\femto\nounit} \\
$10^{-12}$ & 0.000 000 000 001                             & Pico  & \unit{\pico\nounit} \\
$10^{-9}$  & 0.000 000 001                                     & Nano  & \unit{\nano\nounit} \\
$10^{-6}$  & 0.000 001                                            & Micro & \unit{\micro\nounit} \\
$10^{-3}$  & 0.001                                                   & Milli & \unit{\milli\nounit} \\
$10^{-2}$  & 0.01                                                     & Zenti & \unit{\centi\nounit} \\
$10^{-1}$  & 0.1                                                       & Deci  & \unit{\deci\nounit} \\\midrule
$10^{1}$   & 10                                                        & Deca  & \unit{\deca\nounit} \\
$10^{2}$   & 100                                                     & Hecto & \unit{\hecto\nounit} \\
$10^{3}$   & 1.000                                                  & Kilo  & \unit{\kilo\nounit} \\
$10^{6}$   & 1.000 000                                           & Mega  & \unit{\mega\nounit} \\
$10^{9}$   & 1.000 000 000                                    & Giga  & \unit{\giga\nounit} \\
$10^{12}$  & 1.000 000 000 000                            & Tera  & \unit{\tera\nounit} \\
$10^{15}$  & 1.000 000 000 000 000                     & Peta  & \unit{\peta\nounit} \\
$10^{18}$  & 1.000 000 000 000 000 000             & Exa   & \unit{\exa\nounit} \\
$10^{21}$  & 1.000 000 000 000 000 000 000        & Zetta & \unit{\zetta\nounit} \\
$10^{24}$  & 1.000 000 000 000 000 000 000 000 & Yotta & \unit{\yotta\nounit} \\\bottomrule
\end{xltabular}}

Bei Version 2 funktionierte z.B.

\si{\peta}

Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Re: Package siunitx Error: Found prefix part with no unit

Beitrag von Bartman »

Lies den Abschnitt 9.15 "Demonstrating prefixes" in siunitx.

\documentclass{scrartcl}
\usepackage{array}
\usepackage{booktabs}
\usepackage[locale=DE]{siunitx}
\usepackage{collcell}% Abschnitt 5 "Upgrading from version 2" in der Anleitung von siunitx

\DeclareSIUnit{\noop}{\relax}

\NewDocumentCommand\prefixvalue{m}{%
  \qty[prefix-mode=extract-exponent,print-unity-mantissa=false]{1}{#1\noop}
}

\newcommand{\numfixedexp}[1]{\num[exponent-mode=fixed]{#1}}

\newcolumntype{P}{>{\collectcell\prefixvalue}l<{\endcollectcell}}
\newcolumntype{N}{>{\collectcell\numfixedexp}r<{\endcollectcell}}

\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{
  @{}%
  PNl>{\collectcell\unit}l<{\noop\endcollectcell}
  @{}%
}
\toprule
\multicolumn{1}{@{}l}{\textbf{Faktor}} & 
\multicolumn{1}{l}{\textbf{Dezimalschreibweise}} & 
\textbf{Name} & \textbf{Zeichen} \\
\midrule
\yocto & e-24 & Yokto & \yocto \\
\zepto & e-21 & Zepto & \zepto \\
\atto  & e-18 & Atto  & \atto \\
\femto & e-15 & Femto & \femto \\
\pico  & e-12 & Piko  & \pico \\
\nano  & e-9  & Nano  & \nano \\
\micro & e-6  & Mikro & \micro \\
\milli & e-3  & Milli & \milli \\
\centi & e-2  & Zenti & \centi \\
\deci  & e-1  & Dezi  & \deci \\
\addlinespace% von booktabs
\deca  & e1   & Deka  & \deca \\
\hecto & e2   & Hekto & \hecto \\
\kilo  & e3   & Kilo  & \kilo \\
\mega  & e6   & Mega  & \mega \\
\giga  & e9   & Giga  & \giga \\
\tera  & e12  & Tera  & \tera \\
\peta  & e15  & Peta  & \peta \\
\exa   & e18  & Exa   & \exa \\
\zetta & e21  & Zetta & \zetta \\
\yotta & e24  & Yotta & \yotta \\
\bottomrule
\end{tabular}
\end{center}
\end{document}

Ich habe den Befehl \newcolumntype nur deshalb im Beispiel benutzt, weil der Editor des Forums das Größer-als-Zeichen in der Spaltendefinition beim Erzeugen der Vorschau entfernt, wenn es davor einen Zeilenumbruch gibt.


AaronK
Forum-Fortgeschrittener
Forum-Fortgeschrittener
Beiträge: 77
Registriert: So 2. Mai 2021, 09:29

Re: Package siunitx Error: Found prefix part with no unit

Beitrag von AaronK »

Vielen Dank für die Hilfe. Funktioniert perfekt.

Benutzeravatar
Stefan Kottwitz
Admin
Admin
Beiträge: 2485
Registriert: Di 8. Jul 2008, 00:39
Kontaktdaten:

Re: Package siunitx Error: Found prefix part with no unit

Beitrag von Stefan Kottwitz »

@Bartman: Das mit dem >-Zeichen im Editor ist repariert.

Stefan

Bartman
Forum-Meister
Forum-Meister
Beiträge: 2456
Registriert: Do 16. Jul 2009, 21:41
Wohnort: Hessische Provinz

Re: Package siunitx Error: Found prefix part with no unit

Beitrag von Bartman »

@Stefan Kottwitz Danke.

Antworten