
我不明白為什麼我不能使這個 tabularray 環境中的標題行成為小型大寫字母(似乎在我添加 後就會發生row{2} = {font = \bfseries, cmd = \textrm},
,但我無法通過添加row{1} = {cmd = \textsc},
.
我只是知道我正在做一些愚蠢的事情......特別是因為我實際上無法在不包含pythontex
包的情況下正確編譯它......這對我來說毫無意義。
\documentclass{article}
\usepackage{pythontex}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[margin = 0.5in]{geometry}
\usepackage{tabularray}
\begin{document}
% timeperiod calculations
\begin{tblr}[T]{
colspec = {Q[c,m] *{4}{Q[c,m,$]}},
column{1} = {2-Z}{font = \bfseries},
row{odd} = {azure9},
row{2} = {font = \bfseries, cmd = \textrm},
hline{1,Z} = {2pt},
}
% header
\SetCell[c=5]{c} \textsc{Why am I not Small Caps?} \\
\hline
&
who &
cares &
not &
me \\
tab &
\mathrm{10\ \frac{units}{time}} &
\mathrm{7\ units} &
\mathrm{1\ unit \cdot 2\ units} &
\mathrm{10\ unit^2} \\
\end{tblr}
\end{document}
編輯:澄清一下,我知道電腦現代字體中沒有粗體小型大寫字母。這就是為什麼我嘗試不將粗體應用於第一行。
據我了解,我應該將第一列從第二行開始加粗,並將第二行完全加粗。我不明白我將在哪裡應用粗體到我的標題。
使用\normalfont \textsc{Why am I not Small Caps?}
使其正常顯示;我只是不明白為什麼。
編輯#2:所以@Clara 的評論確實有效;但我想也許我仍然需要了解正在發生的事情。因為,我認為這可能與我在嘗試執行這些複雜的格式化前導碼時在其他地方遇到的錯誤相同。
答案1
答案2
正如 @DavidCarlisle 在他的文章中指出的回答,電腦現代文字字體系列不包括粗體/小型大寫字母組合。
補救措施?使用能夠提供所需粗細/形狀組合的字型。newtxtext
和包newpxtext
分別提供 Times Roman 和 Palatino 克隆,是具有這種組合的字體包的範例。
\documentclass{article}
\usepackage{pythontex}
%\usepackage{amsmath} % amsmath is loaded automatically by mathtools
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[margin = 0.5in]{geometry}
\usepackage{tabularray}
\usepackage{newtxtext,newtxmath} % or: \usepackage{newpxtext,newpxmath}
\begin{document}
% timeperiod calculations
\begin{tblr}[T]{
colspec = {Q[c,m] *{4}{Q[c,m,$]}},
column{1} = {2-Z}{font = \bfseries},
row{odd} = {azure9},
row{2} = {font = \bfseries, cmd = \textrm},
hline{1,Z} = {2pt},
}
% header
\SetCell[c=5]{c} \textsc{Why am I not Small Caps?} \\
\hline
&
who &
cares &
not &
me \\
tab &
\mathrm{10\ \frac{units}{time}} &
\mathrm{7\ units} &
\mathrm{1\ unit \cdot 2\ units} &
\mathrm{10\ unit^2} \\
\end{tblr}
\end{document}