hyperref
我正在编写一份文档,每当创建指向文档中已编号内容的链接时,我都希望使用旧式编号。这包括对已编号章节、页面(文本内以及目录、图表和表格中的引用)、定理 ( amsthm
)、图表、表格等的引用。我使用cleveref
包和命令\cref
来引用。
平均能量损失
\documentclass[oneside]{book}
\usepackage{amsthm}
\usepackage[hidelinks,linktocpage]{hyperref}
\usepackage{cleveref}
\newtheorem{theorem}{Theorem}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\chapter{Chapter}
\label{chapter}
\section{Section}
\label{section}
\section{Subsection}
\label{subsection}
\section{Subsubsection}
\label{subsubsection}
\begin{theorem}
\label{theorem}
A theorem.
\end{theorem}
\begin{figure}
%\includegraphics{example-image-a}}
\caption{An image.}
\label{figure}
\end{figure}
\begin{table}
\centering
\begin{tabular}{c|c}
0 & 1 \\
2 & 3
\end{tabular}
\caption{A table.}
\label{table}
\end{table}
References to \cref{chapter}, \cref{section}, \cref{subsection} and \cref{subsubsection}. References to \cref{theorem}, \cref{figure} and \cref{table}.
\end{document}
答案1
您可以使用该cfr-lm
包切换到旧式图形以进行交叉引用:
\documentclass[oneside]{article}
\usepackage{amsthm}
\usepackage[linktocpage,hidelinks]{hyperref}
\usepackage[nameinlink]{cleveref-usedon}
\usepackage[rm={oldstyle=false}]{cfr-lm}
\makeatletter
\patchcmd{\@cref}{\begingroup}{\begingroup\fontfamily{clm2j}\selectfont}{}{}
\makeatother
\newtheorem{theorem}{Theorem}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\begin{document}
\section{Section}
\label{section}
\section{Subsection}
\label{subsection}
\section{Subsubsection}
\label{subsubsection}
\begin{definition}
\label{definition}
A definition.
\end{definition}
\begin{theorem}
\label{theorem}
A theorem.
\end{theorem}
\begin{equation}
\label{equation}
0=1
\end{equation}
\begin{figure}
%\includegraphics{example-image-a}}
\caption{An image.}
\label{figure}
\end{figure}
\begin{table}
\centering
\begin{tabular}{c|c}
0 & 1 \\
2 & 3
\end{tabular}
\caption{A table.}
\label{table}
\end{table}
References to \cref{section,subsection} and \cref{subsubsection}. References to \cref{definition}, \cref{theorem}, \cref{equation}, \cref{figure} and \cref{table}.
\end{document}