ustctug / ustcthesis

LaTeX template for USTC thesis
https://gradschool.ustc.edu.cn/column/65
LaTeX Project Public License v1.3c
1.6k stars 396 forks source link

当章节过多时本科毕业论文模板pdf从目录开始页码全为罗马数字 #293

Closed GongSiqiu closed 3 years ago

GongSiqiu commented 3 years ago

检查

编译环境

描述问题

当章节过多时本科毕业论文模板pdf从目录开始页码全为罗马数字

截图:

图片

复现上述问题的代码:

\documentclass[degree=bachelor]{ustcthesis}
\begin{document}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\section{title}
\subsection{title}
\subsection{title}
\end{document}
zepinglee commented 3 years ago

我在本地 macOS 的 TeX Live 2021 无法复现,编译的结果:

main.pdf

GongSiqiu commented 3 years ago

不好意思,我以为MWE是在示例文档中修改的,现在再给一个完整的例子。注意比较注释前后生成文档的区别。 main.pdf

% !TeX encoding = UTF-8
% !TeX program = xelatex
% !TeX spellcheck = en_US

\documentclass[degree=bachelor]{ustcthesis}
\input{ustcsetup.tex}
\begin{document}
\maketitle
\frontmatter
\tableofcontents

\mainmatter
\chapter{title}
\section{title}
\iffalse
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\chapter{title}
\section{title}
\subsection{title}
\subsection{title}
\fi
\end{document}
zepinglee commented 3 years ago

嗯,我能复现了,目录以及正文的页码没问题,但是 PDF 书签的页码会坏掉。

zepinglee commented 3 years ago

这似乎是 hyperref 的 bug,只在 xelatex 编译时会出现。我去请教大佬们了,见 https://tex.stackexchange.com/q/593820/82731

MWE:

\documentclass{book}

\usepackage{notoccite}
\usepackage{hyperref}

\begin{document}

\pagenumbering{roman}
\tableofcontents

\newcommand\test{%
  \chapter{Title}%
  \section{Title}%
  \subsection{Title}%
  \subsection{Title}%
  \subsection{Title}%
  \section{Title}%
  \subsection{Title}%
  \subsection{Title}%
  \subsection{Title}%
  \section{Title}%
  \subsection{Title}%
  \subsection{Title}%
  \subsection{Title}%
}

% Make sure the TOC has more than one page
\test
\test
\test

\end{document}
zepinglee commented 3 years ago

临时解决方案是去掉 \maketitle 中的 \pagenumbering{Alph}

zepinglee commented 3 years ago

临时解决方案是去掉 \maketitle 中的 \pagenumbering{Alph}

更正:去掉 \maketitle\frontmatter 中的 \pagenumbering 可以改为阿拉伯数字,但是页码数还是错的。所以还是去掉 notoccite 宏包好了。

zepinglee commented 3 years ago

参考 Ulrike Fischer 的回答 https://tex.stackexchange.com/a/593839/82731