转换为 Xelatex

转换为 Xelatex

我有一个文档想使用 Xelatex 进行转换。根据信息这里,我查看了文件并做了一些更改。但是,虽然它会输出新的 PDF,但转换无法获取任何文本格式,例如大胆的

在我的 Makefile 中,我只是将 Xelatex 指向源文件 - 例如make foo.pdf

preamble.sty

\ProvidesPackage{preamble}

\PassOptionsToPackage{hyphens}{url}
\usepackage[xelatex]{hyperref}
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
    }
\urlstyle{same}
\usepackage[margin=1.905cm]{geometry}
\usepackage{fontspec}
\usepackage{mathptmx}
\usepackage{ulem}
\usepackage[none]{hyphenat} % This style needs to be in the repo, It's not in BasicTex
\usepackage{enumitem} % This style needs to be in the repo, It's not in BasicTex
\pagenumbering{gobble}
\def\myauthor{Christopher M. Finazzo}
\def\mycopyright{2018}
\endinput

代码

\documentclass[letterpaper,11pt]{article}
\usepackage{preamble}
\begin{document}
\begin{center}
\textbf
{\small{CHRISTOPHER M. FINAZZO}} \\
\end{center}
\begin{raggedleft}
\noindent {973.906.0496}
\end{raggedleft}
\hfill \hfill {[email protected]}\\
\begin{raggedright}
{http://www.linkedin.com/in/chrisfinazzo}
\end{raggedright}
\begin{center}
\textbf
{PROFESSIONAL OBJECTIVE}
\end{center}
\begin{center}
Communications Analyst
\end{center}
\noindent
\begin{center}
\textbf{PREFERRED FUNCTIONS}
\end{center}
\begin{center}
\begin{tabular}{lll}
Marketing Communications & Internal Communications & Client Communications\\
\end{tabular}
\end{center}
\begin{center}
\textbf{POSITIONING STATEMENT}\\
\end{center}
\begin{raggedright}
Results driven individual with a passion for conveying complex ideas to technical and nontechnical audiences in a way that is accurate, clear, and concise. Proven ability to create audience appropriate messages with a range of authoring tools. Strong verbal and written communication skills as well as the ability to multitask, set priorities, and meet deadlines.\\
\end{raggedright}
\begin{center}
\textbf{COMPETENCIES}
\end{center}
\begin{center}
\begin{tabular}{lll}
\textbf{Writing \& Editing} & \textbf{Authoring Tools} & \textbf{Project Management}\\
AP \& APA Style & HTML, CSS, \& SASS & Requirements Gathering\\
Research Skills & Content Management Systems & Estimating Project Scope\\
Creating a Written Narrative & Social Media & Audience Analysis\\
\end{tabular}
\end{center}
\begin{center}
\textbf{TARGET MARKET CHARACTERISTICS}
\end{center}
\textbf{Geographic Location:} New York Metro area, Should be commutable via public transit.\\
\textbf{Industry or Type of Organization:} Communications, Financial Services, Insurance, Technology\\
\textbf{Size of Organization:} Medium to Large\\
\textbf{Organizational Culture:}\\
Values employees\\
Encourages employee autonomy and individual initiative\\
Provides opportunities for personal and professional growth\\
Leveraging technology to engage with target audiences\\
\begin{center}
\textbf{TARGET LIST}
\end{center}
\begin{center}
\begin{tabular}{ll}
\textbf{Financial Services/Insurance} & \textbf{Communications/Tech/Other}\\
ACE Insurance Group & Bloomberg\\
AIG & Columbia University\\
American Express & Coyne Public Relations\\
Bank of America & Discovery Communications\\
BlackRock & Edelman\\
BNY Mellon & Facebook\\
Chubb & Google\\
Citigroup & HP\\
Goldman Sachs & IBM\\
JPMorgan Chase & Microsoft\\
Liberty Mutual & The New York Times\\
Morgan Stanley & NYU\\
New York Life & Rapp\\
Prudential & PwC\\
Travelers & The Star Ledger\\
UBS & Unilever\\
\end{tabular}
\end{center}
\end{document}

我错过了什么?

答案1

这是可以解决您的问题的(真实的)最小示例。

\documentclass{article}

\usepackage{fontspec}
%\usepackage{mathptmx} % don't use this package with XeLaTeX
\setmainfont{TeX Gyre Termes}
\begin{document}
\textbf{Some text}
\end{document}

独立地,不要将xelatex选项传递给hyperref

代码输出

答案2

你得到

LaTeX Font Warning: Font shape `TU/ptm/m/n' undefined
(Font)              using `TU/lmr/m/n' instead on input line 23.

LaTeX Font Warning: Font shape `TU/ptm/bx/n' undefined
(Font)              using `TU/ptm/m/n' instead on input line 25.

这意味着您将不会得到 Times,而是 Latin Modern,没有字体形状或系列变化。

错误正在加载mathptmx。如果您想要 Times,有几种选择,具体取决于您的设置。如果您只有 BasicTeX,那就别想了:它没有大多数有用的东西。不过 Mac OS X 提供了 OpenType Times 字体。

我修复了几个错误;主要是包加载和环境名称:不要分别使用\begin{raggedleft}\begin{raggedright},而是\begin{flushright}\begin{flushleft}

另请参阅我添加的评论。

\documentclass[letterpaper,11pt]{article}

\usepackage[margin=1.905cm]{geometry}
\usepackage{fontspec}
\usepackage{ulem}

%\usepackage[none]{hyphenat} % Loading this is a recipe for bad typography
\usepackage{enumitem}
\usepackage[hyphens]{url}
\urlstyle{same}
\usepackage{hyperref} % no xelatex nor xetex option; it should be loaded last
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
    }

%\pagenumbering{gobble} % never ever use this, particularly with hyperref
\pagestyle{empty} % this is good

\setmainfont{Times New Roman}

\newcommand\myauthor{Christopher M. Finazzo} % not \def
\newcommand\mycopyright{2018}

\begin{document}

\begin{center}
\bfseries\small CHRISTOPHER M. FINAZZO
\end{center}

\begin{flushright}
973.906.0496\\
\end{flushright}

\begin{flushleft}
[email protected]\\
http://www.linkedin.com/in/chrisfinazzo
\end{flushleft}

\begin{center}
\textbf{PROFESSIONAL OBJECTIVE} \\
Communications Analyst
\end{center}

\begin{center}
\textbf{PREFERRED FUNCTIONS} \\
\begin{tabular}[t]{lll}
Marketing Communications & Internal Communications & Client Communications\\
\end{tabular} \\[1ex]
\end{center}

\begin{flushleft}
{\centering\textbf{POSITIONING STATEMENT}\\}
Results driven individual with a passion for conveying complex 
ideas to technical and nontechnical audiences in a way that is 
accurate, clear, and concise. Proven ability to create audience 
appropriate messages with a range of authoring tools. Strong 
verbal and written communication skills as well as the ability 
to multitask, set priorities, and meet deadlines.
\end{flushleft}

\begin{center}
\textbf{COMPETENCIES} \\
\begin{tabular}[t]{lll}
\textbf{Writing \& Editing} & \textbf{Authoring Tools} & \textbf{Project Management}\\
AP \& APA Style & HTML, CSS, \& SASS & Requirements Gathering\\
Research Skills & Content Management Systems & Estimating Project Scope\\
Creating a Written Narrative & Social Media & Audience Analysis\\
\end{tabular}
\end{center}

\begin{flushleft}
{\centering\textbf{TARGET MARKET CHARACTERISTICS}\\}
\textbf{Geographic Location:} New York Metro area, Should be commutable via public transit.\\
\textbf{Industry or Type of Organization:} Communications, Financial Services, Insurance, Technology\\
\textbf{Size of Organization:} Medium to Large\\
\textbf{Organizational Culture:}\\
Values employees\\
Encourages employee autonomy and individual initiative\\
Provides opportunities for personal and professional growth\\
Leveraging technology to engage with target audiences
\end{flushleft}

\begin{center}
\textbf{TARGET LIST} \\
\begin{tabular}[t]{ll}
\textbf{Financial Services/Insurance} & \textbf{Communications/Tech/Other}\\
ACE Insurance Group & Bloomberg\\
AIG & Columbia University\\
American Express & Coyne Public Relations\\
Bank of America & Discovery Communications\\
BlackRock & Edelman\\
BNY Mellon & Facebook\\
Chubb & Google\\
Citigroup & HP\\
Goldman Sachs & IBM\\
JPMorgan Chase & Microsoft\\
Liberty Mutual & The New York Times\\
Morgan Stanley & NYU\\
New York Life & Rapp\\
Prudential & PwC\\
Travelers & The Star Ledger\\
UBS & Unilever\\
\end{tabular}
\end{center}

\end{document}

在此处输入图片描述

但是排版很不平衡。

相关内容