![代码](https://linux22.com/image/286572/%E4%BB%A3%E7%A0%81.png)
我正在尝试更改 pstricks 代码中的字体,但无法更改为我想要使用的字体。我宁愿使用其他代码\usefont
。这是我的代码:
\thispagestyle{empty}
\newgeometry{left=0cm,right=0cm,top=0cm,bottom=0cm}
\begin{pspicture}(0cm,29.7cm)
\newsavebox\IBox
\sbox\IBox{\includegraphics[height=29.7cm,width=21cm]{Capa2.eps}}
\psset{unit=1cm}
\rput[lb](-0.63,0){\usebox\IBox}
\rput(9.02,25.7){\usefont{T1}{phv}{b}{n}\fontsize{48pt}{48pt}\color{white}\selectfont $\text{Anotações Sobre o}$}
\rput(8.3,23.7){\usefont{T1}{phv}{b}{n}\fontsize{54pt}{48pt}\color{white}\selectfont $\text{Operador Nabla}$}
\end{pspicture}
我在文档中设置了 Palatino 字体,但 pstricks 中的文本我想使用此处的字体http://www.tug.dk/字体目录/。你们能帮助我吗?
答案1
由于我不确定问题是什么(请参阅原始问题评论中的疑问),我显然不确定这是否能回答问题。但是,我希望它至少会有所帮助,也许至少有助于使问题更加尖锐。
此示例显示了如何在图片中使用两种字体。第一种字体 Zapf Chancery 是直接配置的。我们设置了\zapfstyle
(类似于\itshape
等\bfseries
)和\textzf{}
(类似于\textit{}
等\textbf{}
)。
对于第二个 Brush Script,我们使用提供的包pbsi
。这为我们定义了两个类似的命令,分别为\bsifamily
和\textbsi{}
。
代码
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{pstricks}
\usepackage{graphicx,geometry,amsmath}
\newsavebox\IBox
\sbox\IBox{\includegraphics[height=29.7cm,width=21cm]{example-image-a}}
% Use Zapf Chancery as an example, setting up the relevant font commands for use in the document
\DeclareRobustCommand{\zapfstyle}{% like \itshape etc., this command will hold until an explicit switch or end of group
\fontencoding{T1}%
\fontseries{mb}%
\fontshape{it}%
\fontfamily{pzc}%
\selectfont}
\DeclareTextFontCommand{\textzf}{\zapfstyle}% like \textit{} etc., this command takes an argument and affects only that argument
% brushscr has a package file, pbsi.sty which defines the relevant font commands so use this
\usepackage{pbsi}% defines \bsifamily and \textbsi{}
\begin{document}
\newgeometry{left=0cm,right=0cm,top=0cm,bottom=0cm}
\begin{pspicture}(0cm,29.7cm)
\rput[lb](-0.63,0){\usebox\IBox}
\rput(9.02,25.7){\textcolor{white}{\zapfstyle\Huge Anotações Sobre o}}
\rput(8.3,23.7){\textcolor{white}{\zapfstyle\Huge Operador Nabla}}
\end{pspicture}
\newpage
\begin{pspicture}(0cm,29.7cm)
\psset{unit=1cm}
\rput[lb](-0.63,0){\usebox\IBox}
\rput(9.02,25.7){\color{white}\bsifamily\LARGE Anotações Sobre o}
\rput(8.3,23.7){\color{white}\bsifamily\Huge Operador Nabla}
\end{pspicture}
\end{document}
输出
答案2
phv
是 Helvetica 的字体名称
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{pstricks}
\usepackage{helvet}
\usepackage{graphicx}
\usepackage{geometry}
\begin{document}
\newgeometry{left=0cm,right=0cm,top=0cm,bottom=0cm}
\begin{pspicture}(0cm,29.7cm)
\newsavebox\IBox
\sbox\IBox{\includegraphics[height=29.7cm,width=21cm]{tiger}}
\rput[lb](-0.63,0){\usebox\IBox}
\rput(9.02,25.7){\textcolor{white}{\sffamily\Huge Anotações Sobre o}}
\rput(8.3,23.7){\textcolor{white}{\sffamily\Huge Operador Nabla}}
\end{pspicture}
\end{document}
或者使用特殊字体,例如 Times:
\rput(8.3,23.7){\usefont{T1}{ptm}{b}{it}\selectfont
\textcolor{white}{\sffamily\Huge Operador Nabla}}