与大多数毕业报告一样,目录前需要有致谢和摘要部分。将这些部分添加到目录中,并使用罗马数字作为页码,效果很好。但是,目录中的页码比所有条目的页码都多一个。
\documentclass[12pt,a4paper]{report}
%adjust your page margins here
\usepackage[top=0.70in, bottom=0.70in, left=1in,right=0.80in]{geometry} % setting the page alignment with this package
\usepackage[pdftex]{graphicx} %for embedding images
\usepackage[%dvips, % commented for pdflatex
bookmarks, colorlinks=false]{hyperref} %for creating links in the pdf version and other additional pdf attributes, no effect on the printed document
\hypersetup{%
pdfborder = {0 0 0}
}
\usepackage[final]{pdfpages} %for embedding another pdf, remove if not required
\usepackage{float} %used for figure placement with H as a parameter
\usepackage{hyperref}
\usepackage{pslatex} % for times new roman, old package, but works
\usepackage{array} % for making text bold in table
\usepackage{setspace}
\usepackage{float}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{glossaries}
\usepackage[toc,page]{appendix}
\usepackage[font=small,labelfont=bf]{caption}
\def\figurename{\textbf{Figure }}
\usepackage{listings}
\usepackage{color}
%For the header and footer
\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyfoot[L]{\emph{Hardware RISC-V Processor Learning Tool and Online SoC Training Platform}} % except the center
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\pagestyle{fancy}
\fancyfoot[L]{\emph{Hardware RISC-V Processor Learning Tool and Online SoC Training Platform}}
\cfoot{}
\rhead{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
%For the header and footer Over
%Page Border
\usepackage{pgf}
\usepackage{pgfpages}
\pgfpagesdeclarelayout{boxed}
{
\edef\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
}
\pgfpageslogicalpageoptions{1}
{
border code=\pgfsetlinewidth{2pt}\pgfstroke,%
border shrink=\pgfpageoptionborder,%
resized width=.95\pgfphysicalwidth,%
resized height=.95\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}
\pgfpagesuselayout{boxed}
\setlength{\parindent}{1cm}
\makeglossaries
\loadglsentries{project/glossaries}
%GLOBAL SETTINGS OVER, DOCUMENT BEGINS
\begin{document}
\renewcommand\bibname{References}
\lhead{}
%FROM HERE YOUR PAGES START GETTING ADDED
% includes the cover page
\input{project/cover.tex}
\newpage
% includes the title page
\input{project/title.tex}
\newpage
%TABLE OF CONTENTS AND LIST OF FIGURES ARE AUTOMATICALLY ADDED BY FOLLOWING COMMANDS
%ADD FIGURE OF TABLES IF YOU NEED TO, CHECK DOCUMENTATION
\doublespacing
\pagestyle{fancy}
\pagenumbering{roman}
% includes the acknowledgements page
\clearpage
\input{project/acknowledgements.tex}
\addcontentsline{toc}{chapter}{\numberline{}Acknowledgements}%
\newpage
\clearpage
\input{project/abstract.tex} % adds the Research Methodology page
\addcontentsline{toc}{chapter}{\numberline{}Abstract}
\newpage
%To reset the Header & Footer for TOC and LOF
\clearpage
\tableofcontents % adds Index Page
\newpage
% adds the glossaries page
\addcontentsline{toc}{chapter}{\numberline{}Glossary}%
\printglossary
\newpage
\addcontentsline{toc}{chapter}{\numberline{}\listfigurename}%
\listoffigures % adds List of Figures
\cleardoublepage
%And reset back the settings we choose for Header and Footer
\pagestyle{fancy}
\clearpage
\pagenumbering{arabic} %reset numbering to normal for the main content
\input{project/introduction.tex} % adds the introduction page
\input{project/background.tex} % adds the background page
\input{project/design.tex}
\input{project/learning.tex}
\input{project/health.tex}
\input{project/conclusion.tex} % adds the Scheduling and Planning page
\input{project/ref.tex} % adds the References page
\end{document}
我的理解是目录的编号与实际文档本身的编号不同。但我不明白如何正确管理页面。
答案1
我相信我的回答对你来说可能已经很晚了,但我希望这能帮助任何遇到与我一样问题的人。
问题似乎是\pgfpagesuselayout{boxed}
页面大小被压缩,这会导致链接出现问题。如果您还注意到,除了条目的编号偏移外,单击Glossary
还会指向List of Figures
将您发送到下一节。为了解决这个问题,我想到了一个解决方案,完全消除了 \pgfpagesdeclaredlayout 的使用
为了修复它,我建议删除以下代码块:
\pgfpagesdeclarelayout{boxed}
{
\edef\pgfpageoptionborder{0pt}
}
{
\pgfpagesphysicalpageoptions
{%
logical pages=1,%
}
\pgfpageslogicalpageoptions{1}
{
border code=\pgfsetlinewidth{2pt}\pgfstroke,%
border shrink=\pgfpageoptionborder,%
resized width=.95\pgfphysicalwidth,%
resized height=.95\pgfphysicalheight,%
center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
}%
}
\pgfpagesuselayout{boxed}
并使用包背景和 tikz 来制作边距:
\usepackage{background}
\usetikzlibrary{calc}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=4pt,]
($ (current page.north west) + (1cm,-1cm) $)
rectangle
($ (current page.south east) + (-1cm,1cm) $);
\end{tikzpicture}}