Closed BBBYmBYYY closed 1 year ago
问题已解决。本模板的附录命令定义形式为
\def\appendix{
\if@firstappendix
\setcounter{chapter}{0}%
\setcounter{section}{0}%
\renewcommand\@chapapp{Appendix}
\typeout{....\AppendicesTotal...}
\ifnum\AppendicesTotal=1
\renewcommand\chaptername{\appendixnamenonumber}
\else
\renewcommand\chaptername{\appendixname}
\fi
\@firstappendixfalse
\fi
\chapter}%
因此,常规的\appendix形式无效。而应该将\appendix作为类似于\chapter命令的形式来使用,它至少需要一个参数,形如\appendix{Appendix Test}.
使用该命令后能够正常生成附录。但现在的模板经测试存在以下两个问题:
\appendixnonumber
和\appendixname
修改为\appendixnamenonumber\Alph{chapter}
来实现附录编号.\renewcommand\theequation{\Alph{chapter}\arabic{equation}}
\renewcommand{\theTheorem}{\Alph{chapter}\arabic{Theorem}}
\renewcommand{\thefigure}{\Alph{chapter}\arabic{figure}}
\renewcommand{\thetable}{\Alph{chapter}\arabic{table}}
我也做过类似的修改,但是这样会导致附录部分书签对应的跳转页码不正确,请问你是否碰到了同样的问题?
我也做过类似的修改,但是这样会导致附录部分书签对应的跳转页码不正确,请问你是否碰到了同样的问题?
不太明确你指的什么,如果你说的是正文引用"附录A"的超链接不能跳转到对应位置的话,我现在也有这样的问题。但是这个并不是硬性的格式要求,所以我没管
今天也遇到了这个问题,我已经解决掉并且测试成功了。
其原因是因为chapter被重新计数为0了,导致索引跳转错误(如从目录点击却跳转到第一章,对应内容也是会被跳转到第一章)。
我的解决方法是在在NKThesis.sty
里修改一些内容:
appendixstart
(或者喜欢的名字,后面保持一致就好),用来标记附录编号,加在第二个\if@NKT@English
的前一行:
\newcounter{appendixstart}
\appendixstart
来为附录编号,而不是\chapter
。将第二个\if@NKT@English
对应内容修改为:
\if@NKT@English
\def\chaptername{Chapter \arabic{chapter}}
\def\thesection{\arabic{chapter}.\arabic{section}}
\def\thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\def\appendixname{Appendix \Alph{appendixstart}}
\def\contentsname{CONTENTS}
\def\appendixnamenonumber{Appendix}
\def\nkrefname{References}
\def\tablename{Table}
\def\figurename{Figure}
\def\NKT@proof{Proof}
\else
\def\chaptername{第\CJKnumber{\arabic{chapter}}章}
\def\thesection{第\CJKnumber{\arabic{section}}节}
\def\thesubsection{\arabic{chapter}.\arabic{section}.\arabic{subsection}}
\def\appendixname{附录\Alph{appendixstart}}
\def\contentsname{目录}
\def\appendixnamenonumber{附录}
\def\nkrefname{参考文献}
\def\tablename{表}
\def\figurename{图}
\def\NKT@proof{证明}
\fi
\appendix
的模板,包括章节计数、公式图表编号等等。注意不能重设\chapter
(否则会导致书签跳转错误,因为这里的内容会被链接到第一章,包括目录也是),利用\appendixstart
对标题进行编号。\def\appendix
对应内容修改为:
\def\appendix{
\if@firstappendix
\setcounter{appendixstart}{0}
% \setcounter{chapter}{0}%
\setcounter{section}{0}%
\setcounter{equation}{0}%
\renewcommand\@chapapp{Appendix}
\typeout{....\AppendicesTotal...}
\ifnum\AppendicesTotal=1
\renewcommand\chaptername{\appendixnamenonumber}
\renewcommand{\theequation}{\Alph{appendixstart}.\arabic{equation}}
\renewcommand{\thefigure}{\Alph{appendixstart}.\arabic{figure}}
\renewcommand{\thetable}{\Alph{appendixstart}.\arabic{table}}
\else
\renewcommand\chaptername{\appendixname}
\renewcommand{\theequation}{\Alph{appendixstart}.\arabic{equation}}
\renewcommand{\thefigure}{\Alph{appendixstart}.\arabic{figure}}
\renewcommand{\thetable}{\Alph{appendixstart}.\arabic{table}}
\fi
\@firstappendixfalse
\fi
\stepcounter{appendixstart}
\chapter}%
\AppendicesTotal
的统计方式(不更改的话,会导致绪论、...、总结都会被算作附录的数量),使用\theappendixstart
而不是\thechapter
计算。即第二个\AtEndDocument
对应部分更改为:
\AtEndDocument{
\if@firstappendix
\else
% \immediate\write\@auxout{\string\AppendicesNumber{\thechapter}}
\immediate\write\@auxout{\string\AppendicesNumber{\theappendixstart}}
\fi}
经过上述步骤更改即可,我在自己的论文上测试是没有问题的。
/appendix命令编译出错 “Paragraph ended before \@chapter was complete.”
以下是模板内tex目录下appendices文件内进行的测试。
% !TeX root = ../main.tex % -- coding: utf-8 --
\appendix
\section{test}