我使用cleveref
来交叉引用我的方程式,并且使用equation
和align
环境没有任何问题。但是,使用gather
环境时,交叉引用显示为:“Section xyz”而不是“Equation xa”。
如何确保指cleveref
的gather
是方程式?
平均能量损失
请注意,我有一个附录,我将“cleveref”打印的“部分”更改为“附录”。
% !TeX program = lualatex
\documentclass[class=book]{tudapub}
\usepackage[english]{babel}
\usepackage{amsmath} % Bold math symbols
\usepackage[nameinlink]{cleveref} % For capitalized ref
\usepackage{appendix} % Needed to trigger clevref names change for appendix sections
\AtBeginEnvironment{appendices}{\crefalias{section}{appendix}} % To rename sections in clevref when entering appendices
\AtEndEnvironment{appendices}{\crefalias{section}{section}} % To rename sections back in clevref when leaving appendices
\begin{document}
\chapter{My chapter}
\section{My section}
This is an equation in the 'equation' environment:
\begin{equation}
\label{Eq_equation}
a = b
\end{equation}
This is an equation in the 'align' environment:
\begin{align}
\label{Eq_align}
a &= b
\nonumber \\
c &= d
\end{align}
This is an equation in the 'gather' environment:
\begin{gather}
\label{Eq_gather}
a = b
\nonumber \\
c = d
\end{gather}
I can use the package 'cleveref' with 'equation' and 'align: these are cross-references to \Cref{Eq_equation} and \Cref{Eq_align}.
But it does not work with 'gather': this is a cross-reference to \Cref*{Eq_gather}.
\end{document}
答案1
每gather
行都单独编号,因此可以有一个单独的标签,在这种情况下,\label
由于是未编号的,\nonumber
因此它引用当前活动标签,该标签通常是最新的部分标题。
也应该如此,align
但是的处理align
更加复杂,如果它在这种情况下拾取了更有用的东西,那是偶然的,而不是设计的。