我想使用vvarbb
来自的样式黑板粗体字体newpxmath
,但用于eulervm
所有其他数学。不幸的是,似乎eulerpx
不支持该vvarbb
选项。有没有办法newpxmath
只加载黑板粗体字体?
以下是每个设置所含问题的 MWE:
\documentclass[12pt]{article}
% setting 1
\usepackage[vvarbb]{newpxmath}
\usepackage{eulervm}
% setting 2
%\usepackage{eulervm}
%\usepackage[vvarbb]{newpxmath}
% setting 3
%\usepackage{newpxtext}
%\usepackage{eulerpx}
\begin{document}
$\sum a, a\in \mathbb{R}$
\begin{itemize}
\item The \verb|\sum| doesn't display correctly with setting 1
\item The $a$ isn't in \verb|euler| with setting 2
\item The \verb|\mathbb{R}| isn't in the correct sans-serif font with setting 3, and there's no way to specify \verb|vvarbb| in \verb|eulerpx|
\end{itemize}
\end{document}
答案1
我们newpxmath
发现
\DeclareOption{vvarbb}{\px@vvarbbtrue}
寻找\px@vvarbbtrue
我们看到的
% Changed macros which are not limited to a single character, and can include digits, \imath, \jmath
\def\px@@vvbb#1#2\@nil{%
\ifiscseq{#1}{\ifcsdef{px@Bbb\@xp\@gobble\string#1}{\csname px@Bbb\@xp\@gobble\string#1\endcsname}{#1}}{%not a cs
\csname px@Bbb#1\endcsname}
\ifblank{#2}{\relax}{\px@@vvbb #2\@nil}}
\DeclareRobustCommand*{\vvmathbb}[1]{\px@@vvbb#1\@nil}
\ifpx@vvarbb
\let\mathbb\vvmathbb
\else
\ifpx@varbb
\let\mathbb\vmathbb
\else
\ifpx@ams\else\let\mathbb\vmathbb\fi
\fi
\fi
这是什么? 的字母\vvmathbb
不在标准 ASCII 位置,因此代码变为\vvmathbb{A}
,\px@BbbA
其他代码也类似:例如
\DeclareMathSymbol{\px@BbbA}{\mathord}{lettersA}{193}
数字、大写字母和小写字母用\imath
和一起定义\jmath
。此外还有\Gamma
、\gamma
和。\Pi
\pi
好的,目前我们需要看看lettersA
是什么。
\DeclareSymbolFont{lettersA}{U}{npxmia}{m}{it}
\SetSymbolFont{lettersA}{bold}{U}{npxmia}{b}{it}
\DeclareFontSubstitution{U}{npxmia}{m}{it}
在下面的代码中,我使用了一个更强大的处理器来处理 的内容\mathbb
。数字和四个希腊字母不包括在内,但如果需要的话可以包含。
\documentclass{article}
\usepackage{tgpagella}% for Palatino
\usepackage{eulervm}
\makeatletter
% code for vvarbb
\AtBeginDocument{\newcommand{\mathbb}{\vvarbb}}
% the processing macro
\ExplSyntaxOn
\NewDocumentCommand{\vvarbb}{m}
{
\tl_map_function:nN { #1 } \__egreg_vvarbb:n
}
\cs_new_protected:Nn \__egreg_vvarbb:n
{
\token_if_cs:NTF #1
{% the next token is a control sequence
\str_case_e:nnF { \cs_to_str:N #1 }
{
{imath}{\vvarbb@Bbbimath}
{jmath}{\vvarbb@Bbbjmath}
% maybe add Gamma,gamma,Pi,pi
}
{#1}% not defined, just output it
}
{% not a control sequence
\cs_if_exist_use:cF { vvarbb@Bbb#1 } { #1 }
}
}
\ExplSyntaxOff
% define the math font
\DeclareSymbolFont{vvarbb}{U}{npxmia}{m}{it}
\SetSymbolFont{vvarbb}{bold}{U}{npxmia}{b}{it}
\DeclareFontSubstitution{U}{npxmia}{m}{it}
% define the symbols
\DeclareMathSymbol{\vvarbb@BbbA}{\mathord}{vvarbb}{193}
\DeclareMathSymbol{\vvarbb@BbbB}{\mathord}{vvarbb}{194}
\DeclareMathSymbol{\vvarbb@BbbC}{\mathord}{vvarbb}{195}
\DeclareMathSymbol{\vvarbb@BbbD}{\mathord}{vvarbb}{196}
\DeclareMathSymbol{\vvarbb@BbbE}{\mathord}{vvarbb}{197}
\DeclareMathSymbol{\vvarbb@BbbF}{\mathord}{vvarbb}{198}
\DeclareMathSymbol{\vvarbb@BbbG}{\mathord}{vvarbb}{199}
\DeclareMathSymbol{\vvarbb@BbbH}{\mathord}{vvarbb}{200}
\DeclareMathSymbol{\vvarbb@BbbI}{\mathord}{vvarbb}{201}
\DeclareMathSymbol{\vvarbb@BbbJ}{\mathord}{vvarbb}{202}
\DeclareMathSymbol{\vvarbb@BbbK}{\mathord}{vvarbb}{203}
\DeclareMathSymbol{\vvarbb@BbbL}{\mathord}{vvarbb}{204}
\DeclareMathSymbol{\vvarbb@BbbM}{\mathord}{vvarbb}{205}
\DeclareMathSymbol{\vvarbb@BbbN}{\mathord}{vvarbb}{206}
\DeclareMathSymbol{\vvarbb@BbbO}{\mathord}{vvarbb}{207}
\DeclareMathSymbol{\vvarbb@BbbP}{\mathord}{vvarbb}{208}
\DeclareMathSymbol{\vvarbb@BbbQ}{\mathord}{vvarbb}{209}
\DeclareMathSymbol{\vvarbb@BbbR}{\mathord}{vvarbb}{210}
\DeclareMathSymbol{\vvarbb@BbbS}{\mathord}{vvarbb}{211}
\DeclareMathSymbol{\vvarbb@BbbT}{\mathord}{vvarbb}{212}
\DeclareMathSymbol{\vvarbb@BbbU}{\mathord}{vvarbb}{213}
\DeclareMathSymbol{\vvarbb@BbbV}{\mathord}{vvarbb}{214}
\DeclareMathSymbol{\vvarbb@BbbW}{\mathord}{vvarbb}{215}
\DeclareMathSymbol{\vvarbb@BbbX}{\mathord}{vvarbb}{216}
\DeclareMathSymbol{\vvarbb@BbbY}{\mathord}{vvarbb}{217}
\DeclareMathSymbol{\vvarbb@BbbZ}{\mathord}{vvarbb}{218}
\DeclareMathSymbol{\vvarbb@Bbba}{\mathord}{vvarbb}{225}
\DeclareMathSymbol{\vvarbb@Bbbb}{\mathord}{vvarbb}{226}
\DeclareMathSymbol{\vvarbb@Bbbc}{\mathord}{vvarbb}{227}
\DeclareMathSymbol{\vvarbb@Bbbd}{\mathord}{vvarbb}{228}
\DeclareMathSymbol{\vvarbb@Bbbe}{\mathord}{vvarbb}{229}
\DeclareMathSymbol{\vvarbb@Bbbf}{\mathord}{vvarbb}{230}
\DeclareMathSymbol{\vvarbb@Bbbg}{\mathord}{vvarbb}{231}
\DeclareMathSymbol{\vvarbb@Bbbh}{\mathord}{vvarbb}{232}
\DeclareMathSymbol{\vvarbb@Bbbi}{\mathord}{vvarbb}{233}
\DeclareMathSymbol{\vvarbb@Bbbj}{\mathord}{vvarbb}{234}
\DeclareMathSymbol{\vvarbb@Bbbk}{\mathord}{vvarbb}{235}
\DeclareMathSymbol{\vvarbb@Bbbl}{\mathord}{vvarbb}{236}
\DeclareMathSymbol{\vvarbb@Bbbm}{\mathord}{vvarbb}{237}
\DeclareMathSymbol{\vvarbb@Bbbn}{\mathord}{vvarbb}{238}
\DeclareMathSymbol{\vvarbb@Bbbo}{\mathord}{vvarbb}{239}
\DeclareMathSymbol{\vvarbb@Bbbp}{\mathord}{vvarbb}{240}
\DeclareMathSymbol{\vvarbb@Bbbq}{\mathord}{vvarbb}{241}
\DeclareMathSymbol{\vvarbb@Bbbr}{\mathord}{vvarbb}{242}
\DeclareMathSymbol{\vvarbb@Bbbs}{\mathord}{vvarbb}{243}
\DeclareMathSymbol{\vvarbb@Bbbt}{\mathord}{vvarbb}{244}
\DeclareMathSymbol{\vvarbb@Bbbu}{\mathord}{vvarbb}{245}
\DeclareMathSymbol{\vvarbb@Bbbv}{\mathord}{vvarbb}{246}
\DeclareMathSymbol{\vvarbb@Bbbw}{\mathord}{vvarbb}{247}
\DeclareMathSymbol{\vvarbb@Bbbx}{\mathord}{vvarbb}{248}
\DeclareMathSymbol{\vvarbb@Bbby}{\mathord}{vvarbb}{249}
\DeclareMathSymbol{\vvarbb@Bbbz}{\mathord}{vvarbb}{250}
\DeclareMathSymbol{\vvarbb@Bbbimath}{\mathord}{vvarbb}{125}
\DeclareMathSymbol{\vvarbb@Bbbjmath}{\mathord}{vvarbb}{126}
\makeatother
\begin{document}
\[
\sum a, a\in \mathbb{R}
\]
\[
\mathbb{ABCdefi\imath\jmath}
\]
\end{document}