
我遇到一個問題,如果我從 PDF(使用 XeLaTeX 生成)複製單詞,其中複製的文本包含隨機希臘字符。
\documentclass[12pt,a4paper,english]{report}
% setup encoding
\usepackage[utf8]{inputenc}
%set language
\usepackage[british,english]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern,cmap}
%setup font
\usepackage{fontspec}
\setmainfont{Calibri}
\begin{document}
{\large A dissertation submitted in partial fulfilment of\\
the requirements for the degree of\\}
\end{document}
(為了簡單起見,我省略了文字)。
為上述內容產生 PDF 並複製正文,得到以下字串:
A dissertaƟon submiƩed in parƟal fulĮlment of the requirements for the degree of
如果我刪除字體包含,複製貼上工作正常,所以我有理由相信這是我如何使用字體的問題?任何人有任何想法
答案1
不要將inputenc
、lmodern
、cmap
和fontenc
與 XeLaTeX 或 LuaLaTeX 一起使用。但除此之外,還有連字的問題。它們未正確對應到 XeLaTeX 的 unicode 條目。使用 LuaLaTeX 它可以工作:
\documentclass[12pt,a4paper,english]{report}
\usepackage[british,english]{babel}
\usepackage{fontspec}
\setmainfont{Calibri.ttf}
\begin{document}
{\large A dissertation submitted in partial fulfilment of\\
the requirements for the degree of\par}
\end{document}
XeLaTeX:
一篇論文