Using unicode-math
:
\usepackage{amsmath} % always load before mathspec or unicode-math
\usepackage[math-style=ISO]{unicode-math} % try sans-style=upright
\defaultfontfeatures{Scale=MatchLowercase,Mapping=tex-text}
\setmainfont[Numbers={OldStyle,Proportional},SmallCapsFeatures={LetterSpace=6},%
BoldFont={Myriad Pro Bold},BoldFeatures={LetterSpace=3}]{Minion Pro}
\setsansfont[Numbers={OldStyle,Proportional},LetterSpace=3]{Myriad Pro}
\setmonofont{Crystal}
\setmathfont{xits-math.otf}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Minion Pro}
\setmathfont[range=\mathsf/{num,latin,Latin,greek,Greek}]{Myriad Pro}
\setmathfont[range=\mathbfsf/{num,latin,Latin,greek,Greek}]{Myriad Pro Bold}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]%
{Minion Pro Italic}
\setmathfont[range=\mathsfit/{num,latin,Latin,greek,Greek}]%
{Myriad Pro Italic}
\setmathfont[range=\mathbfsfit/{num,latin,Latin,greek,Greek}]%
{Myriad Pro Bold Italic}
\setmathfont[range=\mathtt->\mathup]{Crystal}
\let\mathbf\mathbfsf
\let\mathbfit\mathbfsfit
\AtBeginDocument{\let\phi\varphi}
(N.B. unicode-math
loads fontspec
, xltxtra
, and xunicode
)
mathbb
, mathscr
, &c. all have sensible defaults with this. If you want, say, serifed mathbb
, you could add \setmathfont[range=\mathbb/{Latin}->\mathup,Scale=MatchUppercase]{Hoefler Text Engraved}
. The /{Latin}
part applies it only to uppercase latin letters.
- Use
BoldFont
and BoldFeatures
with fontspec
. For unicode-math
, I just used \let
commands, although I know there's probably a more elegant way to do this.
- Removing
MnSymbol
frees up a lot of math alphabets, and unicode-math
increases the limit.
- Apparently Ubuntu Mono is bugged; I couldn't use it, so I tested with Crystal. And it works.
EDIT: To use Minion for even more symbols, you could replace the \mathup
line with:
\setmathfont[range={\mathup/{num,latin,Latin,greek,Greek},\question,\exclam,\mathdollar,%
\percent,\ampersand,\lparen,\rparen,\plus,\comma,\period,\mathslash,\mathcolon,%
\semicolon,\less,\equal,\greater,\backslash,\rbrack,\lbrack,\atsign,\vert,\lbrace,%
\rbrace,\times,\div}]{Minion Pro}
For the part entries in the page header I will modify my example from scrpage2: Three “marks” for headings. Note that there must be no unstarred \automark
command after the redefinition of \partmark
because this would reset this definition.
To get serif font in the section titles you can change font element disposition
\setkomafont{disposition}{\normalcolor\bfseries}
or you can use the undocumented option
headings=standardclasses
If also font elements like descriptionlabel
should use the serif font you can set the undocumented option egregdoesnotlikesansseriftitles
which was a result of this question and needs KOMA version 3.20 or newer.
\documentclass[
egregdoesnotlikesansseriftitles,% needs version 3.20 or newer
%headings=standardclasses
]{scrbook}
%\providecommand*\Ifstr{\ifstr}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
%\providecommand*\Ifnumbered{\ifnumbered}% needed up to and including KOMA-Script version 3.27, see https://komascript.de/faq_deprecatedif
\usepackage{scrlayer-scrpage}% activates page style scrheadings automatically
\automark[section]{chapter}
\newmarks\currentpart
\renewcommand\partmark[1]{% after all unstarred \automark commands!
\marks\currentpart{\Ifnumbered{part}{\partname~\thepart\autodot\enskip}{}#1}%
\markboth{}{}%
}
\newcommand\partinheadfoot{\firstmarks\currentpart}
\clearpairofpagestyles
\ohead{\partinheadfoot}
\chead{\leftmark}
\ihead{\Ifstr{\leftmark}{\rightmark}{}{\rightmark}}
\ofoot*{\pagemark}
\renewcommand\partpagestyle{empty}
\usepackage{lipsum}% for dummy text
\begin{document}
\tableofcontents
\part{First Test}
\chapter{A Chapter}
\section{A Section}
\lipsum
\part{Second Test}
\chapter{Only a Chapter}
\lipsum
\part{Third Test}
\section{Only a Section}
\lipsum
\part{Fourth Test}
\lipsum
\begin{description}
\item[Testlabel] Text
\end{description}
\end{document}
If your part, chapter or section titles are to long for the header, you can use option headings=optiontohead
or headings=optiontoheadandtoc
to use a short title in head and the long (or an other) version in TOC. See the explanations for \part[short version ]{heading
etc. in the KOMA-Script documentation section "3.16. Structuring of Documents".
Best Answer
fontspec
plays well withKOMA-Script
. Here’s an example:To change the fonts used in the headings, you need to use
\setkomafont{disposition}{...}
or\addtokomafont{disposition}{...}
. And as lockstep explains here,\normalfont
gives you what’s used by default for the body of the document; in your case, because of the choice you’ve made with\setmainfont
, that’s Minion Pro in the regular weight. If you want Minion Pro in bold weight,\addtokomafont{disposition}{\rmfamily}
gives you what’s used by default for headings (bold sans), except that they’ll no longer use a sans but rather the roman family you’ve chosen.If you want headings in something other than the default bold sans or the main font, use whatever font-switch name you assign to the font with
fontspec
’s\newfontface
command. For example (a perfectly tasteless example),