我已在此处加载字体:
\usepackage[T1]{fontenc}
\usepackage[light]{iwona}
\usepackage{baskervald}
fancy
我正在尝试在标题中设置某种类型斜体:
\fancyhead[L]{\fontfamily{iwona}\selectfont \Large{\textcolor{AFRed}{\{ analysis first \}}}\\
\fontfamily{baskervald}\selectfont \scriptsize{\textcolor{AFBlack}{\ \ \ \ \ solutions through science}}}}
我尝试过\textit{}
,\itshape
但都没有成功。有什么建议吗?
对问题的新评论:
以下是我的文档的完整序言(除了我如何设置标题页)。这反映了 cfr 的一些建议。
\documentclass[12pt]{article}
\usepackage{geometry} % to override default page geometry
\usepackage{graphics} % needed to insert graphics other than PS
\usepackage[T1]{fontenc}
\graphicspath{{graphics/}} % where to look for graphics files
\usepackage{fancyhdr} % to manipulate what goes in the page header and footer
\usepackage{color} % color in the document, other than graphics
\usepackage[absolute]{textpos} % put text at a precise position on the page
\usepackage[multiple]{footmisc} % multiple foot styles
\usepackage{lipsum} % generate random text for demonstration
\setlength{\topmargin}{-1cm}
\setlength{\headsep}{1cm}
\setlength{\headsep}{1cm} % defining the separation between the header and the main body
\setlength{\textheight}{21.2cm} % total height of text in main body
\setlength{\textwidth}{16cm} % total width of text in main body
\setlength{\TPHorizModule}{30mm} % this defines the units use in the text block command
\setlength{\TPVertModule}{\TPHorizModule}
\newcommand{\cth}{\small CTH~} % command to typeset computer code CTH in smaller font
\newcommand{\cale}{\small CALE~} % command to typeset computer code CALE in smaller font
\newcommand{\theAFTitle}{} % define the \theAFTitle command
\newcommand{\theclient}{} % define the \theclient command
\newcommand{\theReportDate}{} % define the \theReportDate command
\newcommand{\thedisclaimer}{} % define the \thedisclaimer command
\newcommand{\theTechnical}{} % define the \theTechnical command
\newcommand{\theBusiness}{} % define the \theBusiness command
\newcommand{\AFTitle}[1]{%
\renewcommand{\theAFTitle}{#1}
}
\newcommand{\client}[1]{%
\renewcommand{\theclient}{#1}
}
\newcommand{\ReportDate}[1]{%
\renewcommand{\theReportDate}{#1}
}
\newcommand{\disclaimer}[1]{%
\renewcommand{\thedisclaimer}{#1}
}
\newcommand{\Technical}[1]{%
\renewcommand{\theTechnical}{#1}
}
\newcommand{\Business}[1]{%
\renewcommand{\theBusiness}{#1}
}
\definecolor{AFRed}{RGB}{102,0,0}
\definecolor{AFBlack}{RGB}{63,63,63}
\fancypagestyle{fancyAF}{%
\fancyhf{}
\newsavebox{\AFHead}
\newlength{\AFHeadwidth}
\settowidth{\AFHeadwidth}{\fontfamily{iwona} \selectfont
\Large{\textcolor{AFRed}{\{ analysis first \}}}}
\sbox{\AFHead}{%
\parbox{\AFHeadwidth}{
\center
\fontfamily{iwona}\selectfont \Large{\textcolor{AFRed}{\{ analysis first \}}} \\
\fontfamily{baskervald}\selectfont \itshape \scriptsize{\textcolor{AFBlack}{solultions through science}}}
}
\fancyhead[L]{\usebox{\AFHead}}
\fancyfoot[C]{\thepage}
}
\renewcommand{\maketitle}{%
\clearpage
\pagestyle{fancyAF}
\mbox{}
\begin{textblock}{5.5}(1.1667,2.0)
\noindent{\textsf{\bf{\LARGE{\theAFTitle}}}}
\end{textblock}
\begin{textblock}{7}(1.1667,3.25)
\noindent{\textsf{\Large{Analysis First \\ 48 Webster Circle \\ Granville, OH 43023}}}
\end{textblock}
\begin{textblock}{7}(1.1667,4.25)
\noindent{\textsf{\Large{To: \\ \theclient}}}
\end{textblock}
\begin{textblock}{2}(1.1667,5.0)
\noindent{\textsf{\large{\theReportDate}}}
\end{textblock}
\begin{textblock}{2}(1.1667,5.5)
\noindent{\textsf{\bf Technical Contact:} \\ \theTechnical}
\end{textblock}
% \begin{textblock}{2}(4.0,5.5)
% \noindent{\textsf{\bf Management Contact:} \\ \theBusiness}
% \end{textblock}
\begin{textblock}{5.5}(0.8333,6.5)
\noindent{\thedisclaimer}
\end{textblock}
\newpage
}
\begin{document}
\AFTitle{White Paper}
\client{XYZ Corporation}
\ReportDate{December 2013}
\Technical{Dr. Michael Fisher \\ Director \\ (740) 587-0506 \\ [email protected]}
\Business{}
\disclaimer{This proposal or quotation includes data that shall not be disclosed outside the government and shall not be duplicated, used, or disclosed-in whole or in part-for any purpose other than to evaluate this proposal or quotation. If, however, a contract is awarded to this offeror or quoter as a result of-or in connection with-the submission of this data, the government shall have the right to duplicate, use, or disclose the data to the extent provided in the resulting contract. This restriction does not limit the government's right to use information contained in this data if it is obtained from another source without restriction. The data subject to this restriction are contained in all pages of this proposal.}
\maketitle
\section{Background}
\lipsum
\section{Objective}
\lipsum[1-3]
\section{Technical}
\lipsum[10-20]
\section{Key Personnel, Program Schedule, and ROM Costs}
\lipsum[1-2]
\end{document}
答案1
字体系列的名称通常不是字体的名称。这意味着您不能将字体的名称放入命令中\fontfamily{}
并期望它能正常工作。如果您查看输出,当 LaTeX 无法找到您请求的字体时,您会看到来自 LaTeX 的投诉。
我不确定你的文档的整体结构,但你确实不应该以这种方式定义标题。例如,强制使用空格\ \
就不是一种好方法。
您在序言中展示的内容也是有问题的。加载行iwona
实际上没有做任何事情,因为baskervald
包会覆盖对字体配置所做的更改iwona
。也就是说,首先iwona
将默认罗马系列设置为轻量级的 Iwona。然后baskervald
将默认罗马系列设置为非花体 Baskervald。因此您无法加载iwona
并获得基本相同的结果。
还要注意,在同一文档中使用两种衬线字体通常都是印刷上令人厌恶的,除非您真的知道自己在做什么,否则应该避免使用。(我认为,如果您使用 Zapf Chancery 之类的字体来制作花哨的标题,情况可能会有所不同,因为它看起来并不完全像“另一种衬线”,因为它是如此不同。但 Iwona 和 Baskervald 并非如此。)
但是,本网站并不强制要求印刷品味。因此,出于 TeX SE 的目的,可以描述设计规范的技术解决方案,而不管美学考虑如何。因此,尽管我绝对建议不要使用这种方法,但您可以这样做。
\documentclass[a4paper]{article}
\usepackage[headheight=26pt]{geometry}% LaTeX reports that the headheight must be at least 25.something pt to accommodate the header
\usepackage[T1]{fontenc}
\usepackage{baskervald}% don't load iwona as well as it is not doing anything
\usepackage{fancyhdr}
\usepackage{kantlipsum}% just for testing
\pagestyle{fancy}
\fancyhf{}
\begin{document}
% set up the header after the start of the document so we get the right fonts and stuff automatically
\newsavebox{\frightfulhead}
\newlength{\frightfulwidth}
\settowidth{\frightfulwidth}{\fontfamily{iwona}\selectfont\Large\{ analysis first \}}% measure the required width
\sbox{\frightfulhead}{% put the contents of the header in a box
\parbox{\frightfulwidth}{% multiple lines so we'll use a \parbox with the width measured above
\raggedleft% set everything flush right
{\fontfamily{iwona}\selectfont\Large {\{ analysis first \}}\\}% the curly brackets limit the scope of the font selection command
\itshape solutions through science}}% so this line returns to the default family i.e. baskervald
\fancyhead[L]{\usebox{\frightfulhead}}% install the header
\kant[1-2]% dummy text
\end{document}
更新
如果你不想任何一个伊沃纳或者Baskervald 作为默认衬线,最好的策略是不加载iwona
或baskervald
直接选择字体。但是,您需要使用正确的家族名称,因此我们需要弄清楚正确的家族名称是什么。
对于 Baskervald 来说,文档解释定义了两个字体系列,ybv
和ybvw
。第 6 页告诉我们前者是标准的非花体系列。所以这就是我们要选择的字体系列。文档还告诉我们我们需要编码,T1
因为这是软件包支持的。
对于 Iwona 来说,文档告诉我们哪些编码可用(这T1
似乎又是一个不错的选择),但字体系列的名称不太清楚。在相关的latex 目录,我们可以从麦粒肿文件或者我们可以观察到有四个文件定义T1
编码中的系列:t1iwona.fd
、和。因此四个系列名称分别为t1iwonal.fd
、和。很可能是标准系列,其他的是变体。您可以从包文件或(可能)文档中找出差异。[我猜版本是“精简版”,可能是“精简版” ,但这些只是猜测。]t1iwonac.fd
t1iwonalc.fd
iwona
iwonal
iwonac
iwonalc
iwona
l
c
有了这些发现,我们就可以在不加载软件包的情况下使用这些字体,而默认的罗马字体系列不会受到干扰:
\documentclass[a4paper]{article}
\usepackage[headheight=26pt]{geometry}% LaTeX reports that the headheight must be at least 25.something pt to accommodate the header
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\usepackage{kantlipsum}% just for testing
\DeclareRobustCommand{\iwonafam}{%
\fontencoding{T1}%
\fontfamily{iwona}%
\selectfont}
\DeclareTextFontCommand{\textiwona}{\iwonafam}
\DeclareRobustCommand{\baskervaldfam}{%
\fontencoding{T1}%
\fontfamily{ybv}%
\selectfont}
\DeclareTextFontCommand{\textbaskervald}{\baskervaldfam}
\pagestyle{fancy}
\fancyhf{}
\begin{document}
% set up the header after the start of the document so we get the right fonts and stuff automatically
\newsavebox{\frightfulhead}
\newlength{\frightfulwidth}
\settowidth{\frightfulwidth}{\fontfamily{iwona}\selectfont\Large\{ analysis first \}}% measure the required width
\sbox{\frightfulhead}{% put the contents of the header in a box
\parbox{\frightfulwidth}{% multiple lines so we'll use a \parbox with the width measured above
\raggedleft% set everything flush right
\textiwona{\Large {\{ analysis first \}}\\}% the curly brackets limit the scope of the font selection command
\textbaskervald{\itshape solutions through science}}}% so this line returns to the default family i.e. baskervald
\fancyhead[L]{\usebox{\frightfulhead}}% install the header
\kant[1-2]% dummy text
\end{document}