siunitx列中的空白

问题描述

我正在尝试使用siunitx软件包使用单位格式化数字表格,以使小数点后的数字对齐。

我无法控制siunitx分配给数字显示的空白空间。

这里是一个例子。我希望第一列中的数字与第三列中的数字更靠近右侧,并且我希望第三列中数字的左侧空间较小。 (我知道垂直线很丑,但它们显示的是列宽。)

\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S|r|S|r|}
\multicolumn{2}{c}{Range} & \multicolumn{2}{c}{Readout}  \\
\hline 
10 & mV &   0.000049 & mV  \\
100 & V &   0.00007   & mV \\
\end{tabular} 
\end{document}

enter image description here

编辑 作为此问题的继续,我试图找到一种方法来报告同一列中的数字和单位,并且在它们之间使用单个(或至少统一)的空格。但是同样,空格很难控制。例如,

\begin{tabular}{
S|
S|
S[table-format=1.9]
}
{Range} & {Readout} & {Uncertainty}  \\
\hline 
10 {mV} &   0.000022~{mV}  & 0.000069 {mV}\\
100 {mV} &   -0.00001~{mV}  & 0.00011 {mV}\\
1 {V} &   -0.0000007~{V}  & 0.00000029 V\\
10 {V} &   -0.000007~{V}  & 0.0000029 V\\
100 {V} &   -0.000075~{V}  & 0.000058 V\\
\end{tabular} 

产生这个

enter image description here

在此第一列中,根据尾数的大小在数字后插入空格;在第二列中,数字左侧的空白过多;在第三栏中,数字和单位之间的空格允许一定数量的数字。

此外,似乎有必要在第二列中使用~。没有它,文本将直接与数字连接。如siunitx文档中所述,我曾玩过table-align-text-post-pre,但它们似乎在这里不起作用。我以为他们会的。

解决方法

您可以指定小数点标记之前和之后的位数。语法为table-format=<digits before marker>.<digits after the marker>

\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{|S[table-format=3.0]|r|S[table-format=1.6]|r|}
\multicolumn{2}{c}{Range} & \multicolumn{2}{c}{Readout}  \\
\hline 
10 & mV &   0.000049 & mV  \\
100 & V &   0.00007   & mV \\
\end{tabular} 
\end{document}

enter image description here

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...