30 在索引页码中使用超链接。

发布于 2024-08-13 11:00:26

我想实现在附录中添加超链接,但查找了很多资料都没有找到解决方法

  1. 参考

Index with hyperreference to the page 这篇文章实现了我想要的效果,在简单的.tex 文件
2.zip
中表现得很好,
image.png
但在 elegantbook 中实现不了, 可能与文档类的一些设置冲突了。

  1. 我使用的是在 github 上下载的 elegantbook 模板,应该是最新版,mwe 如下:

c.zip

%%%%%%%%%%%%%%%%
\begin{filecontents}[force]{\jobname.ist}
headings_flag 1
heading_prefix "\\par\\penalty-50\\textbf{"
heading_suffix "}\\par\\nobreak"
\end{filecontents}
\documentclass[cn,hang,blue,chinese,fancy,twocol,biber]{elegantbook}

\title{数学分析}
\subtitle{学习笔记}

\author{?}
\date{\today}
\version{0.0}
\bioinfo{邮件:}{??}

\extrainfo{???}


\cover{cover.jpg}
\logo{logo.jpg}

% 本文档命令
\usepackage{float}% 浮动体图表设置
\renewcommand\topfraction{.9}
\renewcommand\textfraction{0.35}
\renewcommand\floatpagefraction{0.8}
\setlength\columnseprule{0.01pt} % 分栏线
\setcounter{tocdepth}{3}

\usepackage[xindy]{imakeidx} %在 mkind.ist 格式文件进行了修改
\makeindex[options={-s \jobname.ist}]
\usepackage{hyperref}
% \hypersetup{
%    colorlinks=true,
    %linkcolor=blue,
    %filecolor=blue,
    %urlcolor=blue,
    %citecolor=blue
%}
\makeindex
% 快捷命令
% bb 系列 黑板
\usepackage{amssymb}
\newcommand\bbR{\mathbb{R}}

% 新列表设置
% proenumerate 列表 性质(property)列表
\newlist{proenumerate}{enumerate}{1}
\setlist[proenumerate, 1]{itemsep=0pt,parsep=0pt,label=(\arabic*)}

% 实现\chapter随\part的编号增加而清零重新编号
\makeatletter \@addtoreset{chapter}{part} \makeatother 

\begin{document}
\maketitle
    
\tableofcontents
\mainmatter
\chapter{序列极限}
\section{实数系连续性的基本定理}
\subsection{戴德金分割定理}
\begin{theorem}{戴德金分割定理}\index{戴德金分割定理}
    对 $\bbR$ 的任一分划 $(A|B)$ , $B$ 中必有最小数.    
\end{theorem}
    
\subsection{确界存在定理}
\begin{theorem}{确界存在定理}\index{确界存在定理}
    非空有上界的实数集必有上确界; 非空有下界的实数集必有下确界.
\end{theorem}
\subsection{闭区间套定理}
\begin{theorem}{闭区间套定理}\index{闭区间套定理}
    设 $\{[a_n,b_n]\}$ 是一列闭区间, 并满足:
    \begin{proenumerate}
        \item $[a_n,b_n] \supseteq [a_{n+1},b_{n+1}],\; n=1,2,\cdots$;
        \item $\displaystyle\lim_{n\to\infty}(b_n-a_n)=0$,
    \end{proenumerate}
    则存在唯一的一点 $c\in\bbR$, 使得 $c\in[a_n,b_n],\; n=1,2,\cdots,$ 即
    \[\{c\}= \bigcap_{n=1}^{\infty}[a_n,b_n].\]
\end{theorem}
\backmatter
\appendix
\printindex

\end{document}

3. 这是我修改的 mkind.ist 文件:
%
%
%  This file is part of
%    MakeIndex - A formatter and format independent index processor
%
%  Author: Gabor Herr
%
%
% $Log: mkind.ist,v $
% Revision 1.1  1991/12/13  16:39:53  schrod
% Initial revision
%
% Revision 1.1  1991/08/26  17:50:38  herr
% Initial revision
%
%
% MakeIndex 2.x 'word ordering'

% words beginning with a digit should sorted like special characters
sort_rule    "\b.*"        "&"
*sort_rule    "[0-9].*"    "\b&"

% define merge rules
include "tex.ist"
include "latex.ist"

% define sort rules
include    "english/digit.ist"
include    "english/special.ist"
include    "icase.ist"

% 新的设置 2024/8/12
preamble "
\\begin{theindex}
 \\def\\seename{见}
 \\def\\alsoname{又见}
 \\providecommand*\\indexgroup[1]{\\indexspace
   \\item \\textbf{#1}\\nopagebreak}
"
postamble "\n\n\\end{theindex}\n"

group_skip "  %\n  \\indexspace\n  %\n"

delim_0    "\\dotfill" % 设置条目与页码间的分隔

headings_flag 1 % 控制显示字母(分组)标题的旗标
heading_prefix "  %\n  \\indexgroup{"
heading_suffix "}\n  %\n"

numhead_positive "数字"
numhead_negative "数字"
symhead_positive "符号"
symhead_negative "符号"
  1. 此外,如果使用 imakeidx 中的多个索引中怎么实现索引页码中添加超链接这个效果, 例如:

d.zip
还有一个小问题就是,在 Texstudio 中怎么让 ihtheorem 定义的标签导入 ref 命令的提示中
缺少 ihtheorem 标签.png

查看更多

关注者
0
被浏览
387
Eureka
Eureka 2024-08-13
这家伙很懒,什么也没写!

针对问题一, 即附件c

我给你说一下修改的地方:

  1. elgantlatex.cls 注释掉 1282 行的内容:

image.png

  1. 同样是 elgantlatex.cls 这个文件,第108行, 把这个imakeidx 放到 hyperref 前面:

image.png

对应的再把,相应的 c.tex 的第 30 行注释掉:
image.png

编译结果:
image.png

问题二

本人对 TeXStudio 不熟悉,所以无法告知

1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览