经过多次搜索,我找到了如何为lmodern
和进行相当好的 UTF8 映射(在 Acrobat Pro 可访问性检查中不会产生不良结果) amsfonts
。 所需的代码在下面的最小示例中(也许你们中的一些人可能感兴趣,所以我对其进行了一点评论)。
但是现在,我决定将我的字体更改为包中的字体fourier
,并且我遇到了一些困难,无法弄清楚如何使用这种字体在输出 pdf 中获得正确的 UTF8 编码。
通常我应该添加如下命令:
\pdfglyphtounicode{<IdentifierSymbol>}{<UTF8Code>}
但我不知道在哪里可以找到我所调用的<IdentifierSymbol>
和<UTF8Code>
。我做了很多测试,但没有成功。
我将非常感谢您的帮助。
以下是使用 Fourier 字体而不是 Latin Modern 字体时 UTF8 映射的差异的最小示例。您可以通过复制粘贴内容或通过辅助功能检查(如果您有 Acrobat Pro)来查看差异。
\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}
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}