如何table body math part
使用设置唯一不同的字体XeLaTeX
。我的 MWE 是:
\documentclass[a4paper,10pt]{article}
\usepackage[margin=1in, showframe, nomarginpar]{geometry}
\usepackage{chngcntr}
\counterwithin{table}{section}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\usepackage{colortbl}
\usepackage[svgnames]{xcolor}
\usepackage{makecell}
\usepackage{fontspec}
\newfontfamily\tablefont[Color=IndianRed, Numbers={Monospaced,Lining}]{Myriad Pro}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{\setmainfont[Color=SteelBlue, Numbers={Proportional,OldStyle}]{Myriad Pro}}%
\AtBeginEnvironment{tabular}{\arrayrulecolor{LightSteelBlue}\tablefont\fontsize{9}{11}\selectfont\renewcommand{\theadfont}{\bfseries}}%
\title{Paper 1}
\begin{document}
\maketitle
\section{Dati}
\begin{table}[htb!]
\centering
\begin{tabular}{L{2cm}|L{10cm}}
\hline
\thead{Variabili} & \thead{Descrizione} \\
\hline
\thead{$\alpha + \beta$} & \thead{$a+b$}\\
\hline
gdp\_us & GDP USA trimestrale nominale (dal Q1 1947 al Q4 2013), fonte: FRED2\\
\hline
\end{tabular}
\caption{N/A}
\label{tab2.1}
\end{table}
\end{document}
答案1
您可以加载unicode-math
并定义
\setmathfont{Latin Modern Math}
\setmathfont[version=table]{XITS Math}
前者是整个文档中使用的字体,后者是在你的tabular
s 中使用的字体,方法是发出
\mathversion{table}
将字体更改为您喜欢的字体(选择一个具有数学支持的字体...)
平均能量损失
\documentclass[a4paper,10pt]{article}
\usepackage[margin=1in, showframe, nomarginpar]{geometry}
\usepackage{chngcntr}
\counterwithin{table}{section}
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\usepackage{colortbl}
\usepackage[svgnames]{xcolor}
\usepackage{makecell}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[version=table]{XITS Math}
\newfontfamily\tablefont[Color=IndianRed, Numbers={Monospaced,Lining}]{Myriad Pro}
\usepackage{etoolbox}
\AtBeginEnvironment{table}{\setmainfont[Color=SteelBlue, Numbers={Proportional,OldStyle}]{Myriad Pro}}%
\AtBeginEnvironment{tabular}{\arrayrulecolor{LightSteelBlue}\mathversion{table}\tablefont\fontsize{9}{11}\selectfont\renewcommand{\theadfont}{\bfseries}}%
\title{Paper 1}
\begin{document}
\maketitle
\section{Dati}
\begin{table}[htb!]
\centering
\begin{tabular}{L{2cm}|L{10cm}}
\hline
\thead{Variabili} & \thead{Descrizione} \\
\hline
\thead{$\alpha + \beta$} & \thead{$a+b$}\\
\hline
gdp\_us & GDP USA trimestrale nominale (dal Q1 1947 al Q4 2013), fonte: FRED2\\
\hline
\end{tabular}
\caption{N/A}
\label{tab2.1}
\end{table}
Outside the table $\alpha + \beta$
\end{document}
输出