使用 XeLaTeX 仅嵌入 TrueType 字体

使用 XeLaTeX 仅嵌入 TrueType 字体

背景:我正在撰写论文,根据部门指导,我必须使用 TrueType 字体,并且它们需要嵌入到 PDF 中。

现在,我已设法将所有内容更改为计算机现代 Unicode(CMU)或拉丁现代等宽字体,但输出文件显示 PDF 中嵌入了其他字体类型(类型 1)(并且由于某种原因有很多重复项):

Adobe Acrobat

我的问题是,如何确保只使用 TrueType 字体?我在序言中搜索了这些字体:

\usepackage[paper= letterpaper,left=1.5in,right=1in,top=1.25in,bottom=1.25in]{geometry}
\usepackage{verbatim}
\usepackage{latexsym}
\usepackage{mathchars}
\usepackage{setspace}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage[compact]{titlesec} % removing extra white space with "titlespacing"
\usepackage[labelsep=period]{caption} % adds dots instead of colon
\usepackage[none]{hyphenat} % removes word hyphenating
\usepackage[document]{ragged2e}% no word-wrap justification
\setlength{\RaggedRightParindent}{\parindent}
\usepackage{etoolbox} % to fix the problem caused by above code -- see "AtBeginEnvironment"
\usepackage{txfonts}  % for upright greek letters | use $\betaup$ or $\muup$
\usepackage{bibentry} % for full citation inline
\usepackage{textcomp} % for copyright and other symbols
\usepackage{datetime} % for date
\usepackage{tabto} % for tabbing (see committee.tex)
\usepackage{fontspec} % to import fonts via XeTeX
\setmainfont{CMU Serif} % TrueType font of Computer Modern
\setmonofont{Latin Modern Mono Prop} % Mono TrueType font
\setromanfont{CMU Serif} % TrueType
\setsansfont{CMU Serif} % TrueType
\usepackage{enumitem} % for better item listing and change its spacing
\usepackage{fixltx2e} % for textsubscript{}
\usepackage[natbibapa]{apacite} % for bibliography % use apacite or apalike
\usepackage[nottoc,notlof,notlot]{tocbibind} % to fix bib href jump
\usepackage{hyperref} % for bibliography
\usepackage{setspace} % Allows for \singlespacing and \doublespacing command
\usepackage[super]{nth} % for creating 1st, 2nd, etc. using \nth{1}, \nth{2}
\usepackage{tabu} % for more adjustments for table
\usepackage{tabularx} % for table
\usepackage{placeins} % for table -- add \FloatBarrier before and after begin/end table
\usepackage[flushleft]{threeparttable} % for table
\usepackage{booktabs,caption,fixltx2e} % caption width setup (captionsetup) is further down
\usepackage[space]{grffile} % for spacing in graphics path name
\usepackage{graphicx} % for images - related: use [float] package for placement
\graphicspath{ {/Users/Payam/Google Drive/Thesis/images/} } % image directory
\usepackage{gensymb} % for degree sign \degree
\usepackage[table,xcdraw]{xcolor} % for table

\usepackage{xpatch} % for two spaces after period
\makeatletter % for two spaces after period
\xpatchcmd{\selectfont} % for two spaces after period
  {\pickup@font\font@name} % for two spaces after period
  {\pickup@font\font@name\fontdimen7\font=\fontdimen2\font}
 {}{}
\makeatother % for two spaces after period
\usepackage{tocloft} % changing TOC boldness

\usepackage{color} % for color text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \let\oldtextbf\textbf % changes all bolod text color to red
 \renewcommand{\textbf}[1]{\textcolor{red}{\oldtextbf{#1}}} % changes bold text color to red
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Remove the two lines above after userpackage{color} before submitting  %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Removing extra space
\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}

%%% This is for shortauthor references
\defcitealias{CDC2012}{CDC, 2012}
\defcitealias{CDCfasd}{CDC, 2014}
\defcitealias{NIHalcohol}{NIH, 2015}
\defcitealias{NIHcpt1}{NIH, 2014}
\defcitealias{DoHaHS2014}{HSS, 2014}

% Removes bolded TOC entries
\renewcommand\cftchapfont{\mdseries}
\renewcommand\cftchappagefont{\mdseries}

% centers table tex vertically when use "m"
\renewcommand\tabularxcolumn[1]{>{\Centering}m{#1}}

\input{blocked.sty}
\input{uhead.sty}
\input{boxit.sty}
\input{icthesis.sty}

\newcommand{\ipc}{{\sf ipc}}

\newcommand{\Prob}{\bbbp}
\newcommand{\Real}{\bbbr}
\newcommand{\real}{\Real}
\newcommand{\Int}{\bbbz}
\newcommand{\Nat}{\bbbn}

\newcommand{\NN}{{\sf I\kern-0.14emN}}   % Natural numbers
\newcommand{\ZZ}{{\sf Z\kern-0.45emZ}}   % Integers
\newcommand{\QQQ}{{\sf C\kern-0.48emQ}}   % Rational numbers
\newcommand{\RR}{{\sf I\kern-0.14emR}}   % Real numbers
\newcommand{\KK}{{\cal K}}
\newcommand{\OO}{{\cal O}}
\newcommand{\AAA}{{\bf A}}
\newcommand{\HH}{{\bf H}}
\newcommand{\II}{{\bf I}}
\newcommand{\LL}{{\bf L}}
\newcommand{\PP}{{\bf P}}
\newcommand{\PPprime}{{\bf P'}}
\newcommand{\QQ}{{\bf Q}}
\newcommand{\UU}{{\bf U}}
\newcommand{\UUprime}{{\bf U'}}
\newcommand{\zzero}{{\bf 0}}
\newcommand{\ppi}{\mbox{\boldmath $\pi$}}
\newcommand{\aalph}{\mbox{\boldmath $\alpha$}}
\newcommand{\bb}{{\bf b}}
\newcommand{\ee}{{\bf e}}
\newcommand{\mmu}{\mbox{\boldmath $\mu$}}
\newcommand{\vv}{{\bf v}}
\newcommand{\xx}{{\bf x}}
\newcommand{\yy}{{\bf y}}
\newcommand{\zz}{{\bf z}}
\newcommand{\oomeg}{\mbox{\boldmath $\omega$}}
\newcommand{\res}{{\bf res}}
\newcommand{\cchi}{{\mbox{\raisebox{.4ex}{$\chi$}}}}
%\newcommand{\cchi}{{\cal X}}
%\newcommand{\cchi}{\mbox{\Large $\chi$}}

% Logical operators and symbols
\newcommand{\imply}{\Rightarrow}
\newcommand{\bimply}{\Leftrightarrow}
\newcommand{\union}{\cup}
\newcommand{\intersect}{\cap}
\newcommand{\boolor}{\vee}
\newcommand{\booland}{\wedge}
\newcommand{\boolimply}{\imply}
\newcommand{\boolbimply}{\bimply}
\newcommand{\boolnot}{\neg}
\newcommand{\boolsat}{\!\models}
\newcommand{\boolnsat}{\!\not\models}


\newcommand{\op}[1]{\mathrm{#1}}
\newcommand{\s}[1]{\ensuremath{\mathcal #1}}

% Properly styled differentiation and integration operators
\newcommand{\diff}[1]{\mathrm{\frac{d}{d\mathit{#1}}}}
\newcommand{\diffII}[1]{\mathrm{\frac{d^2}{d\mathit{#1}^2}}}
\newcommand{\intg}[4]{\int_{#3}^{#4} #1 \, \mathrm{d}#2}
\newcommand{\intgd}[4]{\int\!\!\!\!\int_{#4} #1 \, \mathrm{d}#2 \, \mathrm{d}#3}

% Large () brackets on different lines of an eqnarray environment
\newcommand{\Leftbrace}[1]{\left(\raisebox{0mm}[#1][#1]{}\right.}
\newcommand{\Rightbrace}[1]{\left.\raisebox{0mm}[#1][#1]{}\right)}

% Funky symobols for footnotes
\newcommand{\symbolfootnote}{\renewcommand{\thefootnote}{\fnsymbol{footnote}}}
% now add \symbolfootnote to the beginning of the document...

\newcommand{\normallinespacing}{\renewcommand{\baselinestretch}{1.5} \normalsize}
\newcommand{\mediumlinespacing}{\renewcommand{\baselinestretch}{1.2} \normalsize}
\newcommand{\narrowlinespacing}{\renewcommand{\baselinestretch}{1.0} \normalsize}
\newcommand{\bump}{\noalign{\vspace*{\doublerulesep}}}
\newcommand{\cell}{\multicolumn{1}{}{}}
\newcommand{\spann}{\mbox{span}}
\newcommand{\diagg}{\mbox{diag}}
\newcommand{\modd}{\mbox{mod}}
\newcommand{\minn}{\mbox{min}}
\newcommand{\andd}{\mbox{and}}
\newcommand{\forr}{\mbox{for}}
\newcommand{\EE}{\mbox{E}}

\newcommand{\deff}{\stackrel{\mathrm{def}}{=}}
\newcommand{\syncc}{~\stackrel{\textstyle \rhd\kern-0.57em\lhd}{\scriptstyle L}~}

\def\coop{\mbox{\large $\rhd\!\!\!\lhd$}}
\newcommand{\sync}[1]{\raisebox{-1.0ex}{$\;\stackrel{\coop}{\scriptscriptstyle
#1}\,$}}

\newtheorem{definition}{Definition}[chapter]
\newtheorem{theorem}{Theorem}[chapter]

\newcommand{\Figref}[1]{Figure~\ref{#1}}
\newcommand{\fig}[3]{
\begin{figure}[!ht]
\begin{center}
\scalebox{#3}{\includegraphics{figs/#1.ps}}
\vspace{-0.1in}
\caption[ ]{\label{#1} #2}
\end{center}
\end{figure}
}

\newcommand{\figtwo}[8]{
\begin{figure}
\parbox[b]{#4 \textwidth}{
\begin{center}
\scalebox{#3}{\includegraphics{figs/#1.ps}}
\vspace{-0.1in}
\caption{\label{#1}#2}
\end{center}
}
\hfill
\parbox[b]{#8 \textwidth}{
\begin{center}
\scalebox{#7}{\includegraphics{figs/#5.ps}}
\vspace{-0.1in}
\caption{\label{#5}#6}
\end{center}
}
\end{figure}
}

但我什么也没看到。

我正在使用 XeLaTeX 并且在序言中有以下代码:

\usepackage{fontspec} % to import fonts via XeTeX
\setmainfont{CMU Serif} % TrueType font of Computer Modern
\setromanfont{CMU Serif} % Roman TrueType
\setsansfont{CMU Serif} % Sans TrueType
\setmonofont{Latin Modern Mono Prop} % Mono TrueType font

其他注意事项:我使用 EPS 文件(在 Illustrator 中编辑)来嵌入我的图表,但我确保那里使用的字体也是 TrueType:

Adobe Illustrator

更新:只是想更新这篇文章,以防其他人遇到同样的问题。我按照@cfr的建议,去掉了CMR、、和。此外,正如@Sverre在下面的评论中提到的,罪魁祸首之一是我在文档中使用的图像。它们是EPS文件,Illustrator将字体嵌入其中。因此,为了解决这个问题,我遵循Nimbusrtxmitxmiatxsy本指南并将我的图像转换成轮廓。

现在我只嵌入了这些 TT 字体:

在此处输入图片描述

答案1

这是您的序言的精简版,其中包含一些评论以及拉丁现代数学和拉丁现代的最低限度设置:

\documentclass[letterpaper]{article}
\usepackage[left=1.5in,right=1in,top=1.25in,bottom=1.25in]{geometry}

\usepackage{fontspec}% to import fonts via XeTeX
% better to use Latin Modern across the board than mix with CMU, I think - LM is the default
\setmonofont{Latin Modern Mono Prop} % Mono TrueType font
\usepackage{unicode-math}

%% The following packages will all introduce type1 fonts:
% \usepackage{latexsym}
% \usepackage{txfonts}  % for upright greek letters | use $\betaup$ or $\muup$
% \usepackage{gensymb} % for degree sign \degree

%% These seem prima facie problematic based on name alone but I've no idea what is in them so can't say for sure
% \usepackage{mathchars}
% \input{icthesis.sty}

%% These are potentially problematic but I've no idea how they are defined
% \newcommand{\Prob}{\bbbp}
% \newcommand{\Real}{\bbbr}
% \newcommand{\real}{\Real}
% \newcommand{\Int}{\bbbz}
% \newcommand{\Nat}{\bbbn}

%% Do NOT use \sf, \bf, \cal etc. in LaTeX documents - these switches are long deprecated

\begin{document}
  Some text $some maths \mathcal{ab} \mathrm{roman} \mathbb{blackboard}$

\textcopyright
\end{document}

请注意,对于这种配置来说,这textcomp并不是必需的。\textcopyright

对于 Asana,添加

\setmathfont{Asana Math}

这将使用.ttc

您需要非常小心所使用的符号和脚本,以确保不会出现任何 type1 字体。

我会认真要求他们澄清这一要求。如果他们的意思是他们想要坚持使用可缩放字体,那么这是完全合理的,而且实现起来要容易得多。

如果他们真的不想要可扩展性,正如他们所声称的那样,那么他们可能根本不允许使用文字处理器准备的提交。在这种情况下,他们也不可能想要 True Type。在这种情况下,您需要强制 TeX 仅使用 MetaFont 源字体。这些字体在知名的 PDF 查看软件中缩放效果非常糟糕。

相关内容