桑斯玛特

桑斯玛特

我正在创建标准的投影仪演示文稿。此外,我使用 PSTricks 在单独的文件中生成图片。之后,我将包含图片的 pdf 包含在演示文稿中。

不幸的是,beamer 包的字体和 PSTricks 包的字体不同。我不是“字体”方面的专家,但 PSTricks 输出似乎有衬线。

我该如何简化它?我在 PSTricks 中找不到任何调整来获得与 Beamer 中完全相同的字体。我想保留 beamer 的字体并调整 PSTricks 的字体。

多谢!

添加一个最小示例:

@Henri Menke:我认识到您的建议适用于文本,但不适用于数学代码。

\documentclass[dvipsnames,a4paper,oneside]{amsart}
\usepackage[american,ngerman,german]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{pst-pdf}
\usepackage{pstricks, pstricks-add, pst-3dplot, pst-3d, pst-plot, pst-fill, pst-node, pst-eucl}
\newcommand\familydefault{\sfdefault}

\begin{document}

\begin{figure}[ht]
   \centering
   \begin{pspicture}[showgrid = false](0,0)(4,4)
    \rput(2,2){Hello $x$}
   \end{pspicture}
 \end{figure}

\end{document}

输出如下:

在此处输入图片描述

我该如何修复数学代码呢?

答案1

桑斯玛特

使用该软件包可以轻松实现无衬线字体的计算sansmath。为了sansmath能够选择正确的字体,必须加载它无衬线字体(此处为包helvet)。

\documentclass{article}
\usepackage{helvet}
\usepackage{sansmath} % load sansmath after the font
\begin{document}
\sffamily\sansmath
$g$ in math mode

g in text mode
\end{document}

在此处输入图片描述

投影机

documentclassbeamer不使用sansmath包,而是自行执行替换。这些规则在 中定义beamerbasefont.sty。要在自己的文档中使用它们,必须删除一些内部宏并将其复制到序言中。同样,这里必须加载无衬线字体事先的应用替换。

\documentclass{article}
\usepackage{helvet}
% from beamerbasefont.sty
\def\familydefault{\sfdefault}
\def\mathfamilydefault{\sfdefault}
\SetSymbolFont{operators}{normal}{OT1}{cmss}{\mddefault}{n}
\SetSymbolFont{operators}{bold}{OT1}{cmss}{\bfdefault}{n}

\DeclareSymbolFont{numbers}{\encodingdefault}{\mathfamilydefault}{\mddefault}{n}
\DeclareSymbolFont{pureletters}{\encodingdefault}{\mathfamilydefault}{\mddefault}{it}
\SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\rmdefault}{\mddefault}{n}
\DeclareMathAlphabet{\mathbf}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{n}
\DeclareMathAlphabet{\mathsf}{\encodingdefault}{\sfdefault}{\mddefault}{n}
\DeclareMathAlphabet{\mathit}{\encodingdefault}{\mathfamilydefault}{\mddefault}{it}
\DeclareMathAlphabet{\mathtt}{\encodingdefault}{\ttdefault}{\mddefault}{n}
\SetSymbolFont{numbers}{bold}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{n}
\SetSymbolFont{pureletters}{bold}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{it}
\SetMathAlphabet{\mathrm}{bold}{\encodingdefault}{\rmdefault}{\bfdefault}{n}
\SetMathAlphabet{\mathbf}{bold}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{n}
\SetMathAlphabet{\mathsf}{bold}{\encodingdefault}{\sfdefault}{\bfdefault}{n}
\SetMathAlphabet{\mathit}{bold}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{it}
\SetMathAlphabet{\mathtt}{bold}{\encodingdefault}{\ttdefault}{\bfdefault}{n}

\makeatletter
\def\operator@font{\mathgroup\symnumbers}
\makeatother

\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
\DeclareMathSymbol{9}\mathalpha{numbers}{"39}

\DeclareMathSymbol{A}\mathalpha{pureletters}{"41}
\DeclareMathSymbol{B}\mathalpha{pureletters}{"42}
\DeclareMathSymbol{C}\mathalpha{pureletters}{"43}
\DeclareMathSymbol{D}\mathalpha{pureletters}{"44}
\DeclareMathSymbol{E}\mathalpha{pureletters}{"45}
\DeclareMathSymbol{F}\mathalpha{pureletters}{"46}
\DeclareMathSymbol{G}\mathalpha{pureletters}{"47}
\DeclareMathSymbol{H}\mathalpha{pureletters}{"48}
\DeclareMathSymbol{I}\mathalpha{pureletters}{"49}
\DeclareMathSymbol{J}\mathalpha{pureletters}{"4A}
\DeclareMathSymbol{K}\mathalpha{pureletters}{"4B}
\DeclareMathSymbol{L}\mathalpha{pureletters}{"4C}
\DeclareMathSymbol{M}\mathalpha{pureletters}{"4D}
\DeclareMathSymbol{N}\mathalpha{pureletters}{"4E}
\DeclareMathSymbol{O}\mathalpha{pureletters}{"4F}
\DeclareMathSymbol{P}\mathalpha{pureletters}{"50}
\DeclareMathSymbol{Q}\mathalpha{pureletters}{"51}
\DeclareMathSymbol{R}\mathalpha{pureletters}{"52}
\DeclareMathSymbol{S}\mathalpha{pureletters}{"53}
\DeclareMathSymbol{T}\mathalpha{pureletters}{"54}
\DeclareMathSymbol{U}\mathalpha{pureletters}{"55}
\DeclareMathSymbol{V}\mathalpha{pureletters}{"56}
\DeclareMathSymbol{W}\mathalpha{pureletters}{"57}
\DeclareMathSymbol{X}\mathalpha{pureletters}{"58}
\DeclareMathSymbol{Y}\mathalpha{pureletters}{"59}
\DeclareMathSymbol{Z}\mathalpha{pureletters}{"5A}

\DeclareMathSymbol{a}\mathalpha{pureletters}{"61}
\DeclareMathSymbol{b}\mathalpha{pureletters}{"62}
\DeclareMathSymbol{c}\mathalpha{pureletters}{"63}
\DeclareMathSymbol{d}\mathalpha{pureletters}{"64}
\DeclareMathSymbol{e}\mathalpha{pureletters}{"65}
\DeclareMathSymbol{f}\mathalpha{pureletters}{"66}
\DeclareMathSymbol{g}\mathalpha{pureletters}{"67}
\DeclareMathSymbol{h}\mathalpha{pureletters}{"68}
\DeclareMathSymbol{i}\mathalpha{pureletters}{"69}
\DeclareMathSymbol{j}\mathalpha{pureletters}{"6A}
\DeclareMathSymbol{k}\mathalpha{pureletters}{"6B}
\DeclareMathSymbol{l}\mathalpha{pureletters}{"6C}
\DeclareMathSymbol{m}\mathalpha{pureletters}{"6D}
\DeclareMathSymbol{n}\mathalpha{pureletters}{"6E}
\DeclareMathSymbol{o}\mathalpha{pureletters}{"6F}
\DeclareMathSymbol{p}\mathalpha{pureletters}{"70}
\DeclareMathSymbol{q}\mathalpha{pureletters}{"71}
\DeclareMathSymbol{r}\mathalpha{pureletters}{"72}
\DeclareMathSymbol{s}\mathalpha{pureletters}{"73}
\DeclareMathSymbol{t}\mathalpha{pureletters}{"74}
\DeclareMathSymbol{u}\mathalpha{pureletters}{"75}
\DeclareMathSymbol{v}\mathalpha{pureletters}{"76}
\DeclareMathSymbol{w}\mathalpha{pureletters}{"77}
\DeclareMathSymbol{x}\mathalpha{pureletters}{"78}
\DeclareMathSymbol{y}\mathalpha{pureletters}{"79}
\DeclareMathSymbol{z}\mathalpha{pureletters}{"7A}
\begin{document}
$g$ in math mode

g in text mode
\end{document}

在此处输入图片描述

答案2

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage[sfmath]{kpfonts}
\begin{document}
    $g$ in math mode

    g in text mode
\end{document}

在此处输入图片描述

相关内容