I am writing my thesis using (among others) the KOMA-script and fontspec packages. I would like to select the default sans serif font (and add some font features) for my tables. I know how to do this by manually selecting the font for each table (I add \sffamily\addfontfeature{Numbers=Uppercase,Monospaced}), but I would prefer to do this for the whole document in the preamble. KOMA-script allows me to select specific fonts for captions using \addtokomafont{…}{…}, but I cannot find a way to do this for the actual tabular data in the tables. Is there a way?
Below is a minimal working example.
\documentclass{scrartcl}
\usepackage{fontspec}
\usepackage{tabularx}
\usepackage{tgpagella, tgadventor}
\setmainfont[Ligatures=TeX, Numbers=Lowercase]{texgyrepagella-regular.otf}
\setsansfont[Ligatures=TeX, Numbers=Uppercase]{texgyreadventor-regular.otf}
\begin{document}
test, 1, 2, 3, 5, 7, 9, $1, 2, 3, 5, 7, 9$.
\begin{table}
\begin{tabularx}{.25\linewidth}{lc}
& Test \\
a & 1, 5 \\
b & 2, 7 \\
c & 3, 9 \\
\end{tabularx}
\end{table}
\end{document}
\floatevery{table}{\sffamily\addfontfeature{Numbers=Uppercase,Monospaced}}from thefloatpackage can do what you want. – LaRiFaRi Mar 05 '15 at 13:31float, which is kind of a big whacky hammer compared to KOMAyou can useetoolbox` and append your font setup to the table-environment, maybe. Please provide a minimal working example to reduce guesswork on our side. – Johannes_B Mar 06 '15 at 16:12