表格中的等宽线条数字,数学、tikz 图片或普通文本中的比例线条或旧式数字

表格中的等宽线条数字,数学、tikz 图片或普通文本中的比例线条或旧式数字

我正在尝试设置一个文本,其中在表格(等)monospaced lining中使用图形、图片和环境中的图形以及整个普通文本中的图形。tabularslongtableproportional liningtikzmathproportional oldstyle

之前也曾有人问过类似的问题这个问题

然而,我对这些答案并不满意,因为它们对我来说并不完美。这就是为什么我想再次就我观察到的具体问题提出这个问题。

目前,我在标题中使用以下代码:

    \usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
      \makeatletter
        \AtBeginDocument{\libertineOsF}
      \makeatother 

这或多或少完成了任务。但是,请注意11句子末尾的。两个数字之间的字距太大了。看起来可能不多,但我觉得这很烦人。

示例 a(正确的表格,令人厌烦的内嵌图形): 在此处输入图片描述

这是另一个例子,看起来11正确,但是我在表格中没有monospaced数字(即,表格中的数字不再对齐):

示例 b(不正确的表格,内嵌图形是可以的): 在此处输入图片描述

我尝试了上面帖子中提出的所有解决方案。然而,没有什么帮助。

更新:

解决方案应确保table of content不受更改的影响。Piet van Oostrum 提出的当前解决方案既更改了章节/节号,也更改了页码(最初章节/节号是monospaced oldstyle图片,而页码是monospaced lining图片)。


以下是 MWE:

例一:

\documentclass[a4paper,
           11pt]{scrbook} 

           \usepackage{libertine}
           \usepackage{siunitx}
           \sisetup{
              group-digits=true,        
              group-minimum-digits=4,  
              add-integer-zero=false,
              detect-all = true,
              mode=math
        }

        \usepackage[british]{babel} 
        \usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
          \makeatletter
            \AtBeginDocument{\libertineOsF}
          \makeatother 


\begin{document}

 \begin{center}
 \begin{tabular}{S[table-format=4.0] S[table-format=0.2]}
 \hline
 {Big number} & {Small number} \\ \hline
 1711 & .22 \\
 3333 & .11 \\ \hline
 \end{tabular} 
 \end{center}

This is just some meaningless text where I want to show you, what is going on (see Figure~3; $p < .33$). Really, this text does not mean anything. Nevertheless, it is useful and contains probably more than 55 letters. Here you see the annoying fact with some of the figures: 11.

\end{document}

示例 b:

\documentclass[a4paper,
           11pt]{scrbook} 

           \usepackage{libertine}
           \usepackage{siunitx}
           \sisetup{
              group-digits=true,        
              group-minimum-digits=4,  
              add-integer-zero=false,
              detect-all = true,
              mode=math
        }

        \usepackage[british]{babel} 

        \usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
          \makeatletter
            \AtBeginDocument{\def\libertine@figurealign{}\libertineOsF}
          \makeatother 


\begin{document}

 \begin{center}
 \begin{tabular}{S[table-format=4.0] S[table-format=0.2]}
 \hline
 {Big number} & {Small number} \\ \hline
 1711 & .22 \\
 3333 & .11 \\ \hline
 \end{tabular} 
 \end{center}

This is just some meaningless text where I want to show you, what is going on (see Figure 3; $p < .33$). Really, this text does not mean anything. Nevertheless, it is useful and contains probably more than 55 letters. Here you see the annoying fact with some of the figures: 11.


\end{document}

这可能也是一个好问题:如何提出已经提出但尚未完全回答的问题,尽管它被标记为“已回答”?

答案1

您引用的解决方案如下:

\makeatletter
\AtBeginDocument{\def\libertine@figurealign{}\libertineOsF}
\newcommand\libertineTabular{\def\libertine@figurealign{T}\libertineLF}
\makeatother

然后它在环境\libertineTabular之前使用tabular。这也适用于你的情况。

\begin{center}\libertineTabular
 \begin{tabular}{S[table-format=4.0] S[table-format=0.2]}

您还可以使用该etoolbox包使其自动化:

\documentclass[a4paper, 11pt]{scrbook} 

\usepackage{libertine}
\usepackage{siunitx}
\sisetup{
  group-digits=true,        
  group-minimum-digits=4,  
  add-integer-zero=false,
  detect-all = true,
  mode=math
}

\usepackage[british]{babel} 
\usepackage[cmintegrals, cmbraces, libertine]{newtxmath}
\makeatletter
\AtBeginDocument{\def\libertine@figurealign{}\libertineOsF}
\newcommand\libertineTabular{\def\libertine@figurealign{T}\libertineLF}
\makeatother
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{\libertineTabular}

\begin{document}

 \begin{center}
 \begin{tabular}{S[table-format=4.0] S[table-format=0.2]}
 \hline
 {Big number} & {Small number} \\ \hline
 1711 & .22 \\
 3333 & .11 \\ \hline
 \end{tabular} 
 \end{center}

This is just some meaningless text where I want to show you, what is going on (see Figure~3; $p < .33$). Really, this text does not mean anything. Nevertheless, it is useful and contains probably more than 55 letters. Here you see the annoying fact with some of the figures: 11.

\end{document}

结果

相关内容