最小示例:
\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage[full]{textcomp}
\usepackage{mathcomp}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
N → bo.
\end{document}
编译结果如下:
./main.tex:12: Package textcomp Error: Symbol \textrightarrow not provided by
(textcomp) font family phv in TS1 encoding.
(textcomp) Default family used instead.
See the textcomp package documentation for explanation.
Type H <return> for immediate help.
...
l.12 N →
bo.
./main.tex:12: ==> Fatal error occurred, no output PDF file produced!
如果我删除\renewcommand{\familydefault}{\sfdefault}
或\usepackage{helvet}
,它可以正常工作而不会出现任何错误。
如果我删除\usepackage[full]{textcomp}
,那么错误是:
./main.tex:12: Package inputenc Error: Unicode char → (U+2192)
(inputenc) not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.12 N →
bo.
./main.tex:12: ==> Fatal error occurred, no output PDF file produced!
我怎样才能\renewcommand{\familydefault}{\sfdefault}
正常工作?
有关的:
- 在字体系列 ppl TS1 编码中未找到 textcomp \textarrow
- \renewcommand{\familydefault}{\sfdefault} 仅更改粗体字体
- textcomp 与 TS1 字体编码
root@debian9:~# latex --version
pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016/Debian)
kpathsea version 6.2.2
Copyright 2016 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.28; using libpng 1.6.28
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with poppler version 0.48.0
答案1
helvet 字体没有箭头。您可以使用选项将错误更改为警告warn
。然后textcomp
只会向日志添加警告并用另一种字体替换箭头。使用tgheros
代替helvet
更好:
\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage[full,warn]{textcomp}
\usepackage{mathcomp}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
N → bo.
\end{document}
答案2
该helvet
包仅使用原始 Helvetica 提供的字符,这些字符是 PostScript 默认字体的一部分,大多数情况下是通过 Nimbus Sans(URW Clone)提供的。TeX Gyre Heros 是 Nimbus Sans 的扩展,支持文本模式下的右箭头。假设该类实际上与您的问题无关:
\documentclass[12pt,a4paper,english]{article}
\usepackage[utf8]{inputenc}
\usepackage[full]{textcomp}
\usepackage{mathcomp}
\usepackage{tgheros}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
N → bo.
\end{document}
结果:
由于您使用的是 Debian,因此您需要fonts-texgyre
安装。