我正在使用 Legrand Orange 书模板LaTeX 模板网站并尝试合并cleveref
包。
在引用章节、表格、图形等时,它已经运行良好,但对于定理类环境,它却打上了问号。目前,我正在
\usepackage[nameinlink,capitalize,noabbrev]{cleveref}
\crefname{theorem}{Theorem}{Theorems}
就\input{structure.tex}
在之后main.tex
。我把它放错了地方还是我写错了\crefname
行?
我使用所有未改变的文件,除了main.tex
这是我的 MWE:
\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations
\input{structure.tex} % Insert the commands.tex file which contains the majority of the structure behind the template
\usepackage[nameinlink,capitalize,noabbrev]{cleveref}
\crefname{theorem}{Theorem}{Theorems}
%\hypersetup{pdftitle={Title},pdfauthor={Author}} % Uncomment and fill out to include PDF metadata for the author and title of the book
%----------------------------------------------------------------------------------------
\begin{document}
\chapterimage{chapter_head_2.pdf} % Chapter heading image
\chapter{In-text Elements}
\section{Theorems}\index{Theorems}
\label{sec-test}
This is an example of theorems.
\subsection{Single Line}\index{Theorems!Single Line}
This is a theorem consisting of just one line.
\begin{theorem}
A set $\mathcal{D}(G)$ in dense in $L^2(G)$, $|\cdot|_0$. \label{thm-test}
\end{theorem}
\cref{sec-test}\cref{thm-test}
%------------------------------------------------
\begin{table}[h]
\centering
\begin{tabular}{l l l}
\toprule
\textbf{Treatments} & \textbf{Response 1} & \textbf{Response 2}\\
\midrule
Treatment 1 & 0.0003262 & 0.562 \\
\bottomrule
\end{tabular}
\caption{Table caption}
\label{tab:example} % Unique label used for referencing the table in-text
%\addcontentsline{toc}{table}{Table \ref{tab:example}} % Uncomment to add the table to the table of contents
\end{table}
Referencing \cref{tab:example} in-text automatically.
%------------------------------------------------
\begin{figure}[h]
\centering\includegraphics[scale=0.5]{placeholder.jpg}
\caption{Figure caption}
\label{fig:placeholder} % Unique label used for referencing the figure in-text
%\addcontentsline{toc}{figure}{Figure \ref{fig:placeholder}} % Uncomment to add the figure to the table of contents
\end{figure}
Referencing \cref{fig:placeholder} in-text automatically.
\end{document}