事实上,我所处的情况比问题所暗示的要复杂一些。我需要排版一份包含各种重音字符的文档,并希望为此提供一些连字支持。我知道我需要T1
为此进行字体编码。不幸的是,我必须默认使用位图字体,这很丑陋……我可以强制使用 Computer Modern 吗?还是没有其他办法?在后一种情况下,您会建议使用哪种矢量字体?我对或解决方案T1
不太感兴趣。XeTeX
LuaTeX
答案1
我强烈建议使用 Latin Modern 字体,而不是 CM。请参阅帖子:拉丁现代与 cm-super?
如果您还想在 pdf 文件中拥有 UTF8 编码映射(用于复制粘贴和可访问性),您可以在序言中添加一些行,假设您使用的是 pdfTeX(pdfLaTeX)。
下面是我准备的最小代码另一篇帖子向您展示如何做到这一点:
\documentclass[]{article}
%PdfTeX settings for a correct UTF 8 Mapping
%------------------------------------------------------
\usepackage{ifpdf}
\ifpdf \input{glyphtounicode.tex} %Part of modern distribution
%%%\input{glyphtounicode-cmr.tex} %Additionnal glyph: You must grab it from pdfx package
\pdfgentounicode=1
\else %Place here the settings for other compilator
\fi
%Encoding + cmap (to get proper UTF8 mapping)
%------------------------------------------------------
\usepackage{cmap}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%NB: CHANGE lmodern AND fourier TO SEE THE PROBLEM OF MISSING UNICODE CHARACTERS
% You can see this on Acrobat Pro with acessibility checking or simply by copy-pasting the content.
% Of course copy paste is not perfect in both case but it is better with lmodern
%------------------------------------------------------
\usepackage{lmodern}
%%\usepackage{fourier}
%AMS Math + UTF8 mapping of ams symbols
%------------------------------------------------------
\usepackage{amsmath}
\usepackage{amssymb} % I load it after Fourier else I have more incorrect utf8 mapping (with \geqslant for example)
%Correct UTF8 mapping for ams fonts
\ifdefined\pdffontattr% \ifdefined is part of the e-TeX extension, which is part of any modern LaTeX compiler.
\immediate\pdfobj stream file {umsa.cmap}
{\usefont{U}{msa}{m}{n}\pdffontattr\font{/ToUnicode \the\pdflastobj\space 0 R}}
\immediate\pdfobj stream file {umsb.cmap}
{\usefont{U}{msb}{m}{n}\pdffontattr\font{/ToUnicode \the\pdflastobj\space 0 R}}
\fi
%Start document
%------------------------------------------------------
\begin{document}
All these examples work fine with Latin Modern but not with Fourier Font (and Palatino and maybe others).
\bigskip
Issue with mapsto : ${\mathcal F} : \boldsymbol{\eta} \in {\mathbb{R}}^{np}\ \mapsto {\mathcal F}\left(\boldsymbol{\eta} \right)\in \mathbb{R}$
\bigskip
Issue with sqrt : $\sqrt{X}$
\bigskip
Issue with parenthesis : $X \geqslant \left(\frac{1}{2}\right)^2$
\bigskip
Issue with sum : $\sum_{n=0}^\infty X^n$
\end{document}