ElegantLaTeX / ElegantBook

Elegant LaTeX Template for Books
LaTeX Project Public License v1.3c
2.02k stars 395 forks source link

书签跳转错误 #149

Open silentmissile opened 3 years ago

silentmissile commented 3 years ago

软件包版本是3.11,Texlive2021

xelatex+bibtex+xelatex编译后生成的pdf文件的书签栏,跳转出错

在第一层没有问题,点击第1章节会跳转到第一章节,点击第2章节会跳转到第2章节 在第2层有问题,点击1.2节会跳转到1.2节,但是点击2.2节、3.2节会跳转到1.2节

sikouhjw commented 3 years ago

xelatex bibtex xelatex xelatex

silentmissile commented 3 years ago

xelatex bibtex xelatex xelatex

我确信解决不了,我试了还是不行

sikouhjw commented 3 years ago

xelatex bibtex xelatex xelatex

我确信解决不了,我试了还是不行

复现不了你的问题,请提供出问题的 .tex.log.pdf 文件

silentmissile commented 3 years ago

这里贴上一个小小的案例,请测试一下

mail.tex

% !TEX program = xelatex % !TeX encoding = UTF8

\documentclass[lang=cn, toc=twocol]{elegantbook} \title{标题名} \author{作者} \date{\today} \logo{figures/logo-blue.png} \cover{figures/cover.jpg} \usepackage{amssymb,amsfonts,amsmath,esint} \usepackage{listings} \lstset{language=Matlab}%这条命令可以让LaTeX排版时将Matlab关键字突出显示 \definecolor{light-gray}{gray}{0.95} \usepackage{listings} \usepackage{courier} \lstset{ breaklines,%这条命令可以让LaTeX自动将长的代码行换行排版
basicstyle=\footnotesize\ttfamily, % Standardschrift backgroundcolor=\color[rgb]{0.95,0.95,0.95}, keywordstyle=\color{blue}, commentstyle=\color{green}, tabsize=4,numbers=left, numberstyle=\tiny, frame=single, %numbers=left, % Ort der Zeilennummern numberstyle=\tiny, % Stil der Zeilennummern %stepnumber=2, % Abstand zwischen den Zeilennummern numbersep=5pt, % Abstand der Nummern zum Text tabsize=2, % Groesse von Tabs extendedchars=false, % breaklines=true, % Zeilen werden Umgebrochen keywordstyle=\color{red},%这一条命令可以解决代码跨页时,章节标题,页眉等汉字不显示的问题 stringstyle=\color{white}\ttfamily, % Farbe der String showspaces=false, % Leerzeichen anzeigen ? showtabs=false, % Tabs anzeigen ? xleftmargin=17pt, framexleftmargin=17pt, framexrightmargin=5pt, framexbottommargin=4pt, %backgroundcolor=\color{lightgray}, showstringspaces=false % Leerzeichen in Strings anzeigen ?
} \renewcommand{\lstlistingname}{CODE} \lstloadlanguages{% Check Dokumentation for further languages ... %[Visual]Basic %Pascal %C C++ %XML %HTML %Java }

\usepackage{chngcntr} \newcounter{empty} \counterwithin*{section}{empty}

\hypersetup{ bookmarks=true, % show bookmarks bar? bookmarksopenlevel=2, unicode=true, % non-Latin characters in Acrobat’s bookmarks pdftoolbar=true, % show Acrobat’s toolbar? pdfmenubar=true, % show Acrobat’s menu? pdffitwindow=false, % window fit to page when opened pdfstartview={FitH}, % fits the width of the page to the window pdftitle={标题名}, % title pdfauthor={作者}, % author pdfsubject={具体内容标题}, % subject of the document pdfcreator={XeLaTex with hyperref and TeXStudio as editor}, % creator of the document pdfproducer={XeLaTex}, % producer of the document pdfkeywords={关键词}, % list of keywords pdfnewwindow=true, % links in new window colorlinks=true, % false: boxed links; true: colored links linkcolor=blue, % color of internal links citecolor=green, % color of links to bibliography filecolor=magenta, % color of file links urlcolor=cyan % color of external links }

\begin{document}

\maketitle
\frontmatter
\input{data/abstract}

\tableofcontents

\mainmatter \include{data/basic} \include{data/analyze} \include{data/theory}

\backmatter

\bibliography{reference}

\appendix \include{data/appendix}

\end{document}

data/abstract.tex

\chapter{摘要} 这里是摘要的内容

\textbf{摘要:}关键词1、关键词2

data/basic.tex

\chapter{基础} 这里是基础章节的内容

\section{基础第一节} 这里是第一小节的内容 \subsection{热力学第一定律:焓enthalphy、总焓、总温} 对于封闭系统内的气体,有微分形式的能量守恒方程 [ \delta Q = \mathrm{d}U+p\,\mathrm{d}V ]

data/analyze.tex

\chapter{分析} 本章是最为枯燥的纯理论的分析

表格\ref{dimention_tab}给出了一些相关参数\footnote{弧度$rad$本身是无量纲的,这里为了理解更加清楚特意加上去}。 \begin{table}[!htb] \begin{center} \begin{tabular}{|l|l|} \hline Property & Dimension \ \hline Surface & $m^2$ \ \hline Volume & $m^3$ \ \hline Density & $kg\centerdot m^{-3}$ \ \hline Velocity & $m \centerdot s^{-1}$ \ \hline Acceleration & $m \centerdot s^{-2}$ \ \hline Momentum & $kg\centerdot m \centerdot s^{-1}$ \ \hline Force & $kg\centerdot m \centerdot s^{-2}$ \ \hline Energy and work & $kg\centerdot m^2 \centerdot s^{-2}$ \ \hline Power & $kg\centerdot m^2 \centerdot s^{-3}$ \ \hline Moment of inertia & $kg\centerdot m^2$ \ \hline Angular velocity & $rad \centerdot s^{-1}$ \ \hline Angular acceleration & $rad \centerdot s^{-2}$ \ \hline Angular momentum & $kg\centerdot m^2 \centerdot s^{-1}$ \ \hline Torque & $kg\centerdot m^2 \centerdot s^{-2}$ \ \hline Modules of elasticity & $kg\centerdot m^{-1} \centerdot s^{-2}$ \ \hline Surface tension & $kg \centerdot s^{-2}$ \ \hline Viscosity (absolute) & $kg\centerdot m^{-1} \centerdot s^{-1}$ \ \hline Viscosity (kinematic) & $m^2 \centerdot s^{-1}$ \ \hline \end{tabular} \caption{分析的相关参数}\label{dimention_tab} \end{center} \end{table}

量纲分析是很重要的

\section{白金汉原理BUCKINGHAM II THEOREM} 在1915年,白金汉发现了该原理:一组有量纲的相关变量之间的关系可以用$n-m$个无量纲变量来表达,其中$n$代表有量纲的变量的个数,$m$代表这些变量所涉及到的基本量纲的个数。举个例子,流体流过力一个球体,受到阻力$F$,已知该阻力$F$是速度$v$、流体密度$\rho$、粘性系数$\mu$和球体直径$D$的函数,这样就有5个有量纲的变量$F$、$v$、$\rho$、$\mu$、$D$,这些有量纲变量包含3个基本量纲:长度$m$米、质量$kg$千克、时间$s$秒\footnote{白金汉原理是一个数学原理,与单位制无关,这里采用国际单位制,其实采用英制或者其他单位制原理上也是一样的},所以它们之间的关系其实可以用$5-3=2$个无量纲变量来表达。 \subsection{几何相似性} 所谓几何相似性就是说两个物体的形状完全一致,只有大小的差别。两个相似几何体的比例就是一维尺度上的比例,面积比就是比例的平方,体积比就是比例的立方。

其实对于涡轮机械而言,相似性其实还意味着某些非几何参数也存在相似,比如速度场的分布,压力场的分布等,两个相似的涡轮机械在两对对应的空间位置的速度的比例也是一致的,压力的比例也是一致的。

data/theory.tex

\chapter{分析} \section{分析第一节} 这里是分析的第一节 \subsection{相似性} 相似性很有用

data/appendix.tex

\chapter{相关的科学家}\label{app_scientist} \section{欧拉} 莱昂哈德·欧拉(Leonhard Euler ,1707年4月15日~1783年9月18日),瑞士数学家、自然科学家。1707年4月15日出生于瑞士的巴塞尔,1783年9月18日于俄国圣彼得堡去世。 \section{高斯} 约翰·卡尔·弗里德里希·高斯(德语:Johann Carl Friedrich Gauß;  ,英语:Gauss,拉丁语:Carolus Fridericus Gauss,1777年4月30日—1855年2月23日),德国著名数学家、物理学家、天文学家、几何学家,大地测量学家,毕业于Carolinum学院(现布伦瑞克工业大学)。

sikouhjw commented 3 years ago

这里贴上一个小小的案例,请测试一下

mail.tex

% !TEX program = xelatex % !TeX encoding = UTF8

\documentclass[lang=cn, toc=twocol]{elegantbook} \title{标题名} \author{作者} \date{\today} \logo{figures/logo-blue.png} \cover{figures/cover.jpg} \usepackage{amssymb,amsfonts,amsmath,esint} \usepackage{listings} \lstset{language=Matlab}%这条命令可以让LaTeX排版时将Matlab关键字突出显示 \definecolor{light-gray}{gray}{0.95} \usepackage{listings} \usepackage{courier} \lstset{ breaklines,%这条命令可以让LaTeX自动将长的代码行换行排版 basicstyle=\footnotesize\ttfamily, % Standardschrift backgroundcolor=\color[rgb]{0.95,0.95,0.95}, keywordstyle=\color{blue}, commentstyle=\color{green}, tabsize=4,numbers=left, numberstyle=\tiny, frame=single, %numbers=left, % Ort der Zeilennummern numberstyle=\tiny, % Stil der Zeilennummern %stepnumber=2, % Abstand zwischen den Zeilennummern numbersep=5pt, % Abstand der Nummern zum Text tabsize=2, % Groesse von Tabs extendedchars=false, % breaklines=true, % Zeilen werden Umgebrochen keywordstyle=\color{red},%这一条命令可以解决代码跨页时,章节标题,页眉等汉字不显示的问题 stringstyle=\color{white}\ttfamily, % Farbe der String showspaces=false, % Leerzeichen anzeigen ? showtabs=false, % Tabs anzeigen ? xleftmargin=17pt, framexleftmargin=17pt, framexrightmargin=5pt, framexbottommargin=4pt, %backgroundcolor=\color{lightgray}, showstringspaces=false % Leerzeichen in Strings anzeigen ? } \renewcommand{\lstlistingname}{CODE} \lstloadlanguages{% Check Dokumentation for further languages ... %[Visual]Basic %Pascal %C C++ %XML %HTML %Java }

\usepackage{chngcntr} \newcounter{empty} \counterwithin*{section}{empty}

\hypersetup{ bookmarks=true, % show bookmarks bar? bookmarksopenlevel=2, unicode=true, % non-Latin characters in Acrobat’s bookmarks pdftoolbar=true, % show Acrobat’s toolbar? pdfmenubar=true, % show Acrobat’s menu? pdffitwindow=false, % window fit to page when opened pdfstartview={FitH}, % fits the width of the page to the window pdftitle={标题名}, % title pdfauthor={作者}, % author pdfsubject={具体内容标题}, % subject of the document pdfcreator={XeLaTex with hyperref and TeXStudio as editor}, % creator of the document pdfproducer={XeLaTex}, % producer of the document pdfkeywords={关键词}, % list of keywords pdfnewwindow=true, % links in new window colorlinks=true, % false: boxed links; true: colored links linkcolor=blue, % color of internal links citecolor=green, % color of links to bibliography filecolor=magenta, % color of file links urlcolor=cyan % color of external links }

\begin{document}

\maketitle
\frontmatter
\input{data/abstract}

\tableofcontents

\mainmatter \include{data/basic} \include{data/analyze} \include{data/theory}

\backmatter

\bibliography{reference}

\appendix \include{data/appendix}

\end{document}

data/abstract.tex

\chapter{摘要} 这里是摘要的内容

\textbf{摘要:}关键词1、关键词2

data/basic.tex

\chapter{基础} 这里是基础章节的内容

\section{基础第一节} 这里是第一小节的内容 \subsection{热力学第一定律:焓enthalphy、总焓、总温} 对于封闭系统内的气体,有微分形式的能量守恒方程 [ \delta Q = \mathrm{d}U+p,\mathrm{d}V ]

data/analyze.tex

\chapter{分析} 本章是最为枯燥的纯理论的分析

表格\ref{dimention_tab}给出了一些相关参数\footnote{弧度$rad$本身是无量纲的,这里为了理解更加清楚特意加上去}。 \begin{table}[!htb] \begin{center} \begin{tabular}{|l|l|} \hline Property & Dimension \ \hline Surface & $m^2$ \ \hline Volume & $m^3$ \ \hline Density & $kg\centerdot m^{-3}$ \ \hline Velocity & $m \centerdot s^{-1}$ \ \hline Acceleration & $m \centerdot s^{-2}$ \ \hline Momentum & $kg\centerdot m \centerdot s^{-1}$ \ \hline Force & $kg\centerdot m \centerdot s^{-2}$ \ \hline Energy and work & $kg\centerdot m^2 \centerdot s^{-2}$ \ \hline Power & $kg\centerdot m^2 \centerdot s^{-3}$ \ \hline Moment of inertia & $kg\centerdot m^2$ \ \hline Angular velocity & $rad \centerdot s^{-1}$ \ \hline Angular acceleration & $rad \centerdot s^{-2}$ \ \hline Angular momentum & $kg\centerdot m^2 \centerdot s^{-1}$ \ \hline Torque & $kg\centerdot m^2 \centerdot s^{-2}$ \ \hline Modules of elasticity & $kg\centerdot m^{-1} \centerdot s^{-2}$ \ \hline Surface tension & $kg \centerdot s^{-2}$ \ \hline Viscosity (absolute) & $kg\centerdot m^{-1} \centerdot s^{-1}$ \ \hline Viscosity (kinematic) & $m^2 \centerdot s^{-1}$ \ \hline \end{tabular} \caption{分析的相关参数}\label{dimention_tab} \end{center} \end{table}

量纲分析是很重要的

\section{白金汉原理BUCKINGHAM II THEOREM} 在1915年,白金汉发现了该原理:一组有量纲的相关变量之间的关系可以用$n-m$个无量纲变量来表达,其中$n$代表有量纲的变量的个数,$m$代表这些变量所涉及到的基本量纲的个数。举个例子,流体流过力一个球体,受到阻力$F$,已知该阻力$F$是速度$v$、流体密度$\rho$、粘性系数$\mu$和球体直径$D$的函数,这样就有5个有量纲的变量$F$、$v$、$\rho$、$\mu$、$D$,这些有量纲变量包含3个基本量纲:长度$m$米、质量$kg$千克、时间$s$秒\footnote{白金汉原理是一个数学原理,与单位制无关,这里采用国际单位制,其实采用英制或者其他单位制原理上也是一样的},所以它们之间的关系其实可以用$5-3=2$个无量纲变量来表达。 \subsection{几何相似性} 所谓几何相似性就是说两个物体的形状完全一致,只有大小的差别。两个相似几何体的比例就是一维尺度上的比例,面积比就是比例的平方,体积比就是比例的立方。

其实对于涡轮机械而言,相似性其实还意味着某些非几何参数也存在相似,比如速度场的分布,压力场的分布等,两个相似的涡轮机械在两对对应的空间位置的速度的比例也是一致的,压力的比例也是一致的。

data/theory.tex

\chapter{分析} \section{分析第一节} 这里是分析的第一节 \subsection{相似性} 相似性很有用

data/appendix.tex

\chapter{相关的科学家}\label{app_scientist} \section{欧拉} 莱昂哈德·欧拉(Leonhard Euler ,1707年4月15日~1783年9月18日),瑞士数学家、自然科学家。1707年4月15日出生于瑞士的巴塞尔,1783年9月18日于俄国圣彼得堡去世。 \section{高斯} 约翰·卡尔·弗里德里希·高斯(德语:Johann Carl Friedrich Gauß;  ,英语:Gauss,拉丁语:Carolus Fridericus Gauss,1777年4月30日—1855年2月23日),德国著名数学家、物理学家、天文学家、几何学家,大地测量学家,毕业于Carolinum学院(现布伦瑞克工业大学)。

请提供出问题的 .tex.log.pdf 文件

silentmissile commented 3 years ago

链接: https://pan.baidu.com/s/1gJIvp3UcNj_1vGVWydkU3Q 提取码: 8h79 复制这段内容后打开百度网盘手机App,操作更方便哦

请下载测试,里面包含全部的tex文件,以及生成的全部日志和中间文件,只要编译main.tex就可以

sikouhjw commented 3 years ago
\usepackage{chngcntr}
\newcounter{empty}
\counterwithin*{section}{empty}

是用来干嘛的呢?不知道用处的代码请不要随便添加。

如果一定要用,请在 hyperref 前加载。