不含襯線數學的 Xelatex Calibri

不含襯線數學的 Xelatex Calibri

我必須用 Calibri 寫一份文件。此後請找到我的最小範例。問題是當我包含一些數學時,設計看起來「醜陋」。

有沒有辦法將襯線數學字體和數字更改為看起來接近 Calibri 的 SANS-SERIF?

  \documentclass[11pt]{article}
    \usepackage{fontspec}
    \usepackage{xltxtra}
    \usepackage{lipsum}
    \setmainfont[Mapping=tex-text]{Calibri}
    \begin{document}


 \begin{table}
\begin{center}
\begin{tabular}{l c }
\hline
            & Model 1 \\
\hline
(Intercept) & $10.9983^{***}$ \\
            & $(0.0420)$      \\
a  & $0.0040^{**}$   \\
            & $(0.0016)$      \\
b         & $0.0053^{***}$  \\
            & $(0.0012)$      \\
c & $0.0052^{***}$  \\
            & $(0.0001)$      \\
\hline
R$^2$       & 0.9317          \\
Adj. R$^2$  & 0.9309          \\
Num. obs.   & 243             \\
\hline
\multicolumn{2}{l}{\scriptsize{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}
\end{center}
\end{table}

Loremipsumdolorsitamet,consectetueradipiscingelit. Utpuruselit,ves?bu-
lum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam
arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula
augueeuneque.  

 \[
 \bar{x} = \frac{x_1+x_2+\cdots +x_n}{n}
 \]

\end{document}

在此輸入影像描述

答案1

使用unicode-math

\documentclass[11pt]{article}
\usepackage{unicode-math}
\usepackage{lipsum}
\setmainfont[Mapping=tex-text]{Calibri}
\setmathfont{XITS Math}% for the symbols
\setmathfont[range=\mathup]{Calibri}
\setmathfont[range=\mathit]{Calibri-Italic}
\begin{document}

\begin{table}
\centering
\begin{tabular}{l c }
\hline
            & Model 1 \\
\hline
(Intercept) & $10.9983^{***}$ \\
            & $(0.0420)$      \\
a  & $0.0040^{**}$   \\
            & $(0.0016)$      \\
b         & $0.0053^{***}$  \\
            & $(0.0012)$      \\
c & $0.0052^{***}$  \\
            & $(0.0001)$      \\
\hline
R$^2$       & 0.9317          \\
Adj. R$^2$  & 0.9309          \\
Num. obs.   & 243             \\
\hline
\multicolumn{2}{l}{\scriptsize{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}}
\end{tabular}
\caption{Statistical models}\label{table:coefficients}
\end{table}

Loremipsumdolorsitamet,consectetueradipiscingelit. Utpuruselit,ves?bu-
lum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam
arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula
augueeuneque.  

 \[
 \bar{x} = \frac{x_1+x_2+\cdots +x_n}{n}
 \]

\end{document}

在此輸入影像描述

答案2

沒有可用的 Unicode 無襯線數學字型。如果您的文件僅少量使用數學,那麼mathspec會有所幫助。

我使用 TeX Gyre Heros,因為我沒有 Calibri。

\documentclass[11pt]{article}

\usepackage{mathspec}

\usepackage{lipsum}

\setmainfont[Ligatures=TeX]{TeX Gyre Heros}
\setmathsfont(Digits,Latin,Greek){TeX Gyre Heros}

\begin{document}

\begin{table}
\centering

\begin{tabular}{l c }
\hline
            & Model 1 \\
\hline
(Intercept) & $10.9983^{***}$ \\
            & $(0.0420)$      \\
a  & $0.0040^{**}$   \\
            & $(0.0016)$      \\
b         & $0.0053^{***}$  \\
            & $(0.0012)$      \\
c & $0.0052^{***}$  \\
            & $(0.0001)$      \\
\hline
R$^2$       & $0.9317$          \\
Adj. R$^2$  & $0.9309$          \\
Num. obs.   & $243$             \\
\hline
\multicolumn{2}{l}{\scriptsize{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}

\end{table}

\lipsum*[2]
\[
\bar{x} = \frac{x_1+x_2+\cdots +x_n}{n}
\]

\end{document}

請注意文檔的一些變更:不載入xltxtra;不要center在裡面使用table;切勿在顯示的方程式前留下空白行。

在此輸入影像描述

排版表格的更好方法可能是使用siunitxand booktabs

\documentclass[11pt]{article}

\usepackage{mathspec}
\usepackage{siunitx}
\usepackage{booktabs}

\usepackage{lipsum}

\setmainfont[Ligatures=TeX]{TeX Gyre Heros}
\setmathsfont(Digits,Latin,Greek){TeX Gyre Heros}

\begin{document}

\begin{table}
\newcommand\tnote[1]{${}^{#1}$}
\centering

\begin{tabular}{
  l
  S[table-format=2.4,
    table-space-text-post=\tnote{***},
   ]
}
\toprule
            & {Model 1} \\
\midrule
(Intercept) & 10.9983\tnote{***}      \\
\addlinespace[-.4ex]
            & {\footnotesize(0.0420)} \\
a           & 0.0040\tnote{**}        \\
\addlinespace[-.4ex]
            & {\footnotesize(0.0016)} \\
b           & 0.0053\tnote{***}       \\
\addlinespace[-.4ex]
            & {\footnotesize(0.0012)} \\
c           & 0.0052\tnote{***}       \\
\addlinespace[-.4ex]
            & {\footnotesize(0.0001)} \\
\midrule
R$^2$       & 0.9317             \\
Adj. R$^2$  & 0.9309             \\
Num. obs.   & {243}              \\
\bottomrule
\multicolumn{2}{l}{\scriptsize{\textsuperscript{***}$p<0.01$, 
  \textsuperscript{**}$p<0.05$, 
  \textsuperscript{*}$p<0.1$}}
\end{tabular}
\caption{Statistical models}
\label{table:coefficients}

\end{table}

\lipsum*[2]
\[
\bar{x} = \frac{x_1+x_2+\cdots +x_n}{n}
\]

\end{document}

在此輸入影像描述

相關內容