hyperref toc clickable

This commit is contained in:
EthanDeng
2020-07-29 13:37:20 +08:00
parent 9092103354
commit cf755a0387
3 changed files with 30 additions and 16 deletions

View File

@@ -5,8 +5,8 @@
\author{Ethan Deng \& Liam Huang} \author{Ethan Deng \& Liam Huang}
\institute{Elegant\LaTeX{} Program} \institute{Elegant\LaTeX{} Program}
\date{July 6, 2020} \date{July 29, 2020}
\version{4.0.2} \version{4.0.3}
\bioinfo{自定义}{信息} \bioinfo{自定义}{信息}
\extrainfo{温柔正确的人总是难以生存,因为这世界既不温柔,也不正确。—— 比企谷八幡} \extrainfo{温柔正确的人总是难以生存,因为这世界既不温柔,也不正确。—— 比企谷八幡}

View File

@@ -1,12 +1,12 @@
\documentclass[11pt,fancy,twoside]{elegantbook} \documentclass[11pt,fancy,twocol]{elegantbook}
\title{An Elegant \LaTeX{} Template for Books} \title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template} \subtitle{Classic Elegant\LaTeX{} Template}
\author{Ethan Deng \& Liam Huang} \author{Ethan Deng \& Liam Huang}
\institute{Elegant\LaTeX{} Program} \institute{Elegant\LaTeX{} Program}
\date{July 6, 2020} \date{July 29, 2020}
\version{4.0.2} \version{4.0.3}
\bioinfo{Bio}{Information} \bioinfo{Bio}{Information}
\extrainfo{Victory won\rq t come to us unless we go to it. } \extrainfo{Victory won\rq t come to us unless we go to it. }
@@ -15,6 +15,7 @@
\cover{cover.jpg} \cover{cover.jpg}
\begin{document} \begin{document}
\maketitle \maketitle
@@ -630,7 +631,7 @@ Let $G$ be a finite group, and let $H$ be a subgroup of $G$. Then the order of
\lipsum[3] \lipsum[3]
\begin{proposition}{Size of Left Coset}{} \begin{proposition}[Size of Left Coset]
Let $H$ be a finite subgroup of a group $G$. Then each left coset of $H$ in $G$ has the same number of elements as $H$. Let $H$ be a finite subgroup of a group $G$. Then each left coset of $H$ in $G$ has the same number of elements as $H$.
\end{proposition} \end{proposition}

View File

@@ -8,7 +8,7 @@
%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%
% % !Mode:: "TeX:UTF-8" % % !Mode:: "TeX:UTF-8"
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesClass{elegantbook}[2020/07/06 v4.0.2 ElegantBook document class] \ProvidesClass{elegantbook}[2020/07/29 v4.0.3 ElegantBook document class]
\RequirePackage{kvoptions} \RequirePackage{kvoptions}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
@@ -60,9 +60,11 @@
\DeclareVoidOption{margintrue}{\ekv{marginpar=margintrue}} \DeclareVoidOption{margintrue}{\ekv{marginpar=margintrue}}
\DeclareVoidOption{marginfalse}{\ekv{marginpar=marginfalse}} \DeclareVoidOption{marginfalse}{\ekv{marginpar=marginfalse}}
\DeclareVoidOption{onecol}{\ekv{toc=onecol}} \DeclareVoidOption{onecol}{\ekv{toc=onecol}}
\DeclareVoidOption{twocol}{\ekv{toc=twocol}} \DeclareVoidOption{twocol}{\ekv{toc=twocol}}
% ----- Math option ----- % ----- Math option -----
\newcommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}} \newcommand\mailto[1]{\href{mailto:#1}{\nolinkurl{#1}}}
@@ -310,14 +312,7 @@
\setlength{\footnotesep}{12pt} \setlength{\footnotesep}{12pt}
} }
\ifdefstring{\ELEGANT@toc}{twocol}{
\renewcommand{\tableofcontents}{%
\setlength{\columnsep}{2em}
%\setlength{\columnseprule}{.8pt}
\begin{multicols}{2}[\chapter*{\contentsname}]%
\@starttoc{toc}%
\end{multicols}}
}{\relax}
%% %%
@@ -883,4 +878,22 @@
\begin{enumerate}[label=\small\protect\circled{\arabic*}]}{ \begin{enumerate}[label=\small\protect\circled{\arabic*}]}{
\end{enumerate}} \end{enumerate}}
\addbibresource[location=local]{reference.bib} \addbibresource[location=local]{reference.bib}
\renewcommand\tableofcontents{%
\hypersetup{linktoc=all, linkcolor=black}
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\ifdefstring{\ELEGANT@toc}{twocol}{
\setlength{\columnsep}{2em}
\begin{multicols}{2}%
\@starttoc{toc}
\end{multicols}}{
\@starttoc{toc}}
\if@restonecol\twocolumn\fi}