我有一个 LaTeX 文档,其中包含hyperref
和appendix
包,但无法构建。但如果我关闭其中一个appendix
或所有包,hyperref
一切都会正常。
\documentclass[14pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,russian]{babel}
\usepackage[toc,page,title,titletoc]{appendix}
\usepackage{hyperref}
\begin{document}
\hypersetup{pdftex, colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, urlcolor=blue, pdftitle=, pdfauthor=, pdfsubject=, pdfkeywords=}
\renewcommand{\appendixtocname}{Приложения}
\renewcommand{\appendixpagename}{Приложения}
\renewcommand{\appendixname}{Приложениe}
\tableofcontents
\pagebreak
\section{тест}
\begin{appendices}
\renewcommand{\thesection}{\arabic{section}.}
\section{Тест}
\pagebreak
\section{Схема устройства}
\end{appendices}
\end{document}
生成的错误:
./test.out
! Undefined control sequence.
<argument> \T
2A\CYRP \T 2A\cyrr \T 2A\cyri \T 2A\cyrl \T 2A\cyro \T 2A\cyrz...
有可能将它们一起使用吗?
答案1
相当棘手的问题。罪魁祸首是appendix
它做了一些定义,与 Babel 管理俄语的方式不兼容。
\documentclass[12pt]{article}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage[toc,page,title,titletoc]{appendix}
\usepackage{hyperref,bookmark}
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue,
filecolor=blue,
urlcolor=blue,
% pdftitle=,
% pdfauthor=,
% pdfsubject=,
% pdfkeywords=
}
\renewcommand{\appendixtocname}{Приложения}
\renewcommand{\appendixpagename}{Приложения}
\renewcommand{\appendixname}{Приложние}
\makeatletter
\let\oriAlph\Alph
\let\orialph\alph
\renewcommand{\@resets@pp}{\par
\@ppsavesec
\stepcounter{@pps}
\setcounter{section}{0}%
\if@chapter@pp
\setcounter{chapter}{0}%
\renewcommand\@chapapp{\appendixname}%
\renewcommand\thechapter{\@Alph\c@chapter}%
\else
\setcounter{subsection}{0}%
\renewcommand\thesection{\@Alph\c@section}%
\fi
\if@pphyper
\if@chapter@pp
\renewcommand{\theHchapter}{\theH@pps.\oriAlph{chapter}}%
\else
\renewcommand{\theHsection}{\theH@pps.\oriAlph{section}}%
\fi
\def\Hy@chapapp{appendix}%
\fi
\restoreapp
}
\makeatother
\begin{document}
\tableofcontents
\pagebreak
\section{тест}
\begin{appendices}
\renewcommand{\thesection}{\arabic{section}.}
\section{Тест}
\pagebreak
\section{Схема устройства}
\end{appendices}
\end{document}
注意最好fontenc
在之前加载inputenc
。