我正在修改我在网上找到的论文模型。它基于 cls 文件(abntex2.cls -https://pt.overleaf.com/latex/templates/modelo-canonico-de-trabalhos-academicos-com-abntex2/ybtpkzkccnnj)和模板(https://github.com/abntex/abntex2/blob/master/doc/latex/abntex2/examples/abntex2-modelo-trabalho-academico.tex)。
hyperref
tex文档的配置是:
\makeatletter
\hypersetup{
%pagebackref=true,
pdftitle={\@title},
pdfauthor={\@author},
pdfsubject={\imprimirpreambulo},
pdfcreator={LaTeX with abnTeX2},
pdfkeywords={abnt}{latex}{abntex}{abntex2}{trabalho acadêmico},
colorlinks=true, % false: boxed links; true: colored links
linkcolor=black, % color of internal links
citecolor=black, % color of links to bibliography
filecolor=black, % color of file links
urlcolor=black,
bookmarksdepth=4
}
\makeatother
(https://wtools.io/paste-code/b6dA)
并且 cls 文件仅在以下行中提及它:\RequirePackage{hyperref}
但是,当我编译文档时,超链接被红色框起来,而不是黑色超链接。这些是文档中唯一提及的超链接和彩色链接,我尝试在文档开头使用,/usepackage[colorlinks=true]
但出现终端错误:
包 inputenc 警告:基于 utf8 的引擎忽略了 inputenc 包。
)(/usr/share/texlive/texmf-dist/tex/latex/tools/indentfirst.sty)(/usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg)(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/luatex.def))(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)))(/usr/share/texlive/texmf-dist/tex/latex/microtype/microtype.sty(/usr/share/texlive/texmf-dist/tex/latex/microtype/microtype-luatex.def)(/usr/share/texlive/texmf-dist/tex/latex/microtype/microtype.cfg))
!LaTeX 错误:包 hyperref 的选项冲突。
如果有人有任何建议并且能够找到该错误,那将会很有帮助。
答案1
Hypersetup 是一个修改包 hyperref 的包。由于您在尝试操作 hyperref 之前没有加载它,因此操作失败。
如果你将其包含\usepackage{hyperref}
在序言中,至少可以消除错误\RequirePackage{hyperref}
。
例如在这个位置:
% Pacotes de citações
% ---
\usepackage{hyperref}
\usepackage[brazilian,hyperpageref]{backref} % Paginas com as citações na bibl
\usepackage[alf]{abntex2cite} % Citações padrão ABNT
请记住,我还没有用你的模板测试过这一点。