当我加载 时hyperref
,命令 \textprime{}(来自包flexisym
)会导致错误LaTeX Error: Command \textprime unavailable in encoding TU.
,而没有 时却可以正常工作hyperref
。是否有修复/解决方法,或者它们完全不兼容?
这是 .tex 文件:
\documentclass{report}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=15mm,
right=20mm,
bottom=15mm
}
\usepackage{microtype}
\usepackage{textalpha}
\usepackage[english]{babel}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{titlesec}
\titleformat{\chapter}
{\huge\color{YellowGreen}}{\thechapter.}{1em}{}
\titleformat{\section}
{\LARGE\color{ProcessBlue}}{\thesection.}{1em}{}
\titleformat{\subsection}
{\large\color{WildStrawberry}}{\thesubsection.}{1em}{}
\titleformat{\subsubsection}
{\normalsize\color{YellowOrange}}{\thesubsubsection.}{1em}{}
\usepackage{amsmath}
\usepackage{mathspec}
\setmainfont{SetoFontMod}[
%Path=./fonts/setofont-mod,
%Extension=.ttf,
UprightFont=*,
BoldFont=*,
BoldFeatures={FakeBold=3},
ItalicFont=*,
ItalicFeatures={FakeSlant=0.3},
BoldItalicFont=*,
BoldItalicFeatures={FakeBold=3,FakeSlant=0.3},
]
\setmathsfont(Digits,Latin,Greek,Special){SetoFont}
\usepackage{graphicx}
\usepackage{flexisym}
\usepackage{hyperref}
\title{\Huge\color{MidnightBlue}\underline{TITLE}}
\date{}
\newcommand{\highlightcolor}{magenta}
\newcommand{\highlight}[1]{{\color{\highlightcolor}#1}}
\newcommand{\myfig}[2]{\begin{figure}[h]\centering\includegraphics[scale=#2]{#1}\end{figure}}
\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}
\tableofcontents
\chapter{Test}
5\textprime{}
\end{document}
以及完整的错误日志:
Rc files read:
NONE
Latexmk: This is Latexmk, John Collins, 17 Mar. 2022. Version 4.77, version: 4.77.
Latexmk: applying rule 'xelatex'...
Rule 'xelatex': File changes, etc:
Changed files, or newly in use since previous run(s):
/home/arnob99/Documents/university/bio/bio_notes/lectures/gene_expression/00_main.tex
Rule 'xelatex': The following rules & subrules became out-of-date:
xelatex
------------
Run number 1 of rule 'xelatex'
------------
------------
Running 'xelatex -no-pdf -synctex=1 -interaction=nonstopmode -file-line-error -recorder "/home/arnob99/Documents/university/bio/bio_notes/lectures/gene_expression/00_main.tex"'
------------
This is XeTeX, Version 3.141592653-2.6-0.999994 (TeX Live 2022/Arch Linux) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(/home/arnob99/Documents/university/bio/bio_notes/lectures/gene_expression/00_main.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-04-10> (/usr/share/texmf-dist/tex/latex/base/report.cls
Document Class: report 2021/10/04 v1.4n Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo)) (/usr/share/texmf-dist/tex/latex/geometry/geometry.sty (/usr/share/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texmf-dist/tex/generic/iftex/ifvtex.sty (/usr/share/texmf-dist/tex/generic/iftex/iftex.sty)))
Package geometry Warning: Over-specification in `h'-direction.
`width' (483.69684pt) is ignored.
Package geometry Warning: Over-specification in `v'-direction.
`height' (731.23582pt) is ignored.
(/usr/share/texmf-dist/tex/latex/microtype/microtype.sty (/usr/share/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/share/texmf-dist/tex/latex/microtype/microtype-xetex.def) (/usr/share/texmf-dist/tex/latex/microtype/microtype.cfg)) (/usr/share/texmf-dist/tex/latex/greek-fontenc/textalpha.sty (/usr/share/texmf-dist/tex/latex/greek-fontenc/tuenc-greek.def (/usr/share/texmf-dist/tex/latex/greek-fontenc/greek-fontenc.def))) (/usr/share/texmf-dist/tex/generic/babel/babel.sty (/usr/share/texmf-dist/tex/generic/babel/xebabel.def (/usr/share/texmf-dist/tex/generic/babel/txtbabel.def)) (/usr/share/texmf-dist/tex/generic/babel-english/english.ldf)) (/usr/share/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/share/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/share/texmf-dist/tex/latex/graphics-def/xetex.def) (/usr/share/texmf-dist/tex/latex/graphics/dvipsnam.def)) (/usr/share/texmf-dist/tex/latex/titlesec/titlesec.sty) (/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf-dist/tex/xelatex/mathspec/mathspec.sty (/usr/share/texmf-dist/tex/generic/iftex/ifxetex.sty) (/usr/share/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/share/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/share/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/share/texmf-dist/tex/latex/l3backend/l3backend-xetex.def))) (/usr/share/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/share/texmf-dist/tex/latex/base/fontenc.sty) (/usr/share/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/share/texmf-dist/tex/latex/xkeyval/xkeyval.sty (/usr/share/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/share/texmf-dist/tex/generic/xkeyval/xkvutils.tex)))) (/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texmf-dist/tex/latex/graphics/graphics.sty (/usr/share/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg))) (/usr/share/texmf-dist/tex/latex/breqn/flexisym.sty (/usr/share/texmf-dist/tex/latex/breqn/cmbase.sym) (/usr/share/texmf-dist/tex/latex/breqn/mathstyle.sty)) (/usr/share/texmf-dist/tex/latex/hyperref/hyperref.sty (/usr/share/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/share/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (/usr/share/texmf-dist/tex/generic/infwarerr/infwarerr.sty)) (/usr/share/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty) (/usr/share/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty) (/usr/share/texmf-dist/tex/generic/pdfescape/pdfescape.sty) (/usr/share/texmf-dist/tex/latex/hycolor/hycolor.sty) (/usr/share/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty) (/usr/share/texmf-dist/tex/latex/auxhook/auxhook.sty) (/usr/share/texmf-dist/tex/latex/kvoptions/kvoptions.sty) (/usr/share/texmf-dist/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf-dist/tex/generic/intcalc/intcalc.sty) (/usr/share/texmf-dist/tex/generic/etexcmds/etexcmds.sty) (/usr/share/texmf-dist/tex/latex/hyperref/puenc.def (/usr/share/texmf-dist/tex/latex/hyperref/puenc-greekbasic.def)) (/usr/share/texmf-dist/tex/latex/url/url.sty) (/usr/share/texmf-dist/tex/generic/bitset/bitset.sty (/usr/share/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty)) (/usr/share/texmf-dist/tex/latex/base/atbegshi-ltx.sty)) (/usr/share/texmf-dist/tex/latex/hyperref/hxetex.def (/usr/share/texmf-dist/tex/generic/stringenc/stringenc.sty) (/usr/share/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty (/usr/share/texmf-dist/tex/latex/base/atveryend-ltx.sty) (/usr/share/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty))) (./00_main.aux) (/usr/share/texmf-dist/tex/latex/base/ts1cmr.fd)
*geometry* driver: auto-detecting
*geometry* detected driver: xetex
(/usr/share/texmf-dist/tex/latex/greek-fontenc/puenc-greek.def (/usr/share/texmf-dist/tex/latex/greek-fontenc/greek-fontenc.def)) (/usr/share/texmf-dist/tex/latex/hyperref/nameref.sty (/usr/share/texmf-dist/tex/latex/refcount/refcount.sty) (/usr/share/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty))
Package hyperref Warning: Rerun to get /PageLabels entry.
(/usr/share/texmf-dist/tex/latex/microtype/mt-cmr.cfg)
LaTeX Font Warning: Font shape `TU/SetoFont(0)/m/it' undefined
(Font) using `TU/SetoFont(0)/m/n' instead on input line 58.
LaTeX Warning: No \author given.
[1] [1]
Chapter 1.
/home/arnob99/Documents/university/bio/bio_notes/lectures/gene_expression/00_main.tex:64: LaTeX Error: Command \textprime unavailable in encoding TU.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.64 5\textprime
{}
[2] (./00_main.aux)
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
Package rerunfilecheck Warning: File `00_main.out' has changed.
(rerunfilecheck) Rerun to get outlines right
(rerunfilecheck) or use package `bookmark'.
)
(see the transcript file for additional information)
Output written on 00_main.xdv (3 pages, 2592 bytes).
SyncTeX written on 00_main.synctex.gz.
Transcript written on 00_main.log.
Latexmk: If appropriate, the -f option can be used to get latexmk
to try to force complete processing.
Latexmk: Getting log file '00_main.log'
Latexmk: Examining '00_main.fls'
Latexmk: Examining '00_main.log'
Latexmk: References changed.
Latexmk: References changed.
Latexmk: Log file says output to '00_main.xdv'
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
xelatex: Command for 'xelatex' gave return code 1
Refer to '00_main.log' for details
答案1
\textprime
包中的定义与通过标准 NFSS 命令定义它并将其用于书签的包中flexisym
的定义不兼容。\textprime
hyperref
显示问题的最小示例:
\documentclass{article}
\usepackage{flexisym}
\usepackage{hyperref}
\begin{document}
5\textprime
\end{document}
flexisym
通过使用for的定义来修复,\DeclareTextCommandDefault
使其与 兼容hyperref
:
\documentclass{article}
\usepackage{flexisym}
\usepackage{letltxmacro}
\LetLtxMacro\FlexiSymTextPrime\textprime
\DeclareTextCommandDefault{\textprime}{\FlexiSymTextPrime}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{3\textprime}
5\textprime
\end{document}