![사용자 정의 방정식 환경에 대한 자동 참조 이름 재정의](https://rvso.com/image/475708/%EC%82%AC%EC%9A%A9%EC%9E%90%20%EC%A0%95%EC%9D%98%20%EB%B0%A9%EC%A0%95%EC%8B%9D%20%ED%99%98%EA%B2%BD%EC%97%90%20%EB%8C%80%ED%95%9C%20%EC%9E%90%EB%8F%99%20%EC%B0%B8%EC%A1%B0%20%EC%9D%B4%EB%A6%84%20%EC%9E%AC%EC%A0%95%EC%9D%98.png)
사용자 정의 이름을 사용하기 위해 환경을 기반으로 패키지 \autoref
에서 사용자 정의 환경으로 참조를 가져올 수 없습니다 . 이러한 참조에서는 사용자 정의 이름을 사용하는 대신 "Equation"을 사용합니다.hyperref
equation
다음 예를 고려하십시오.
\documentclass{article}
\usepackage{hyperref}
% Define a 'query' counter and environment, based on 'equation'
\newcounter{query}
\newenvironment{query}
{\refstepcounter{query}%
\renewcommand\theequation{Q\arabic{query}}\equation}
{\endequation}
% Attempt to override the name autoref uses for the query environment
\newcommand{\queryautorefname}{Query}
\begin{document}
A labelled instance of the query environment can be found below:
%
\begin{query}
\label{q:my_query}
Q(x) = ...
\end{query}
A reference to \autoref{q:my_query} using \texttt{autoref} uses the wrong name to refer to the environment (i.e., Equation rather than Query).
\end{document}
이 문제(예제에 설명된 대로)는 이러한 방식으로 작성된 참조가 "쿼리 Q1"을 읽고 싶은 곳에서 "수식 Q1"을 읽게 된다는 것입니다. 이를 달성하기 위해 무엇을 바꿀 수 있습니까?
나는 이것이 작동하도록 하기 위해 다른 전략(예: 환경에 대한 다른 정의)에 열려 있지만 환경의 내용을 수학 모드로 설정하고 환경의 카운터가 독립되어 있다는 것이 query
중요합니다. query
다른 카운터(예: equation
카운터). 이 경우에는 내가 사용해야 하는 템플릿/문서 클래스 와 결합하는 데 문제가 발생 cleveref
하므로 문제 가 됩니다.hyperref
svjour3
답변1
\documentclass{article}
\usepackage{hyperref}
% Define a 'query' counter and environment, based on 'equation'
\newcounter{query}
\makeatletter
\newenvironment{query}
{\stepcounter{query}%
\def\Hy@chapterstring{equation}%
\def\Hy@chapapp{query}%
\renewcommand\theequation{Q\arabic{query}}\equation}
{\endequation}
\makeatother
% Attempt to override the name autoref uses for the query environment
\newcommand{\queryautorefname}{Query}
\begin{document}
A labelled instance of the query environment can be found below:
%
\begin{query}
\label{q:my_query}
Q(x) = ...
\end{query}
A reference to \autoref{q:my_query} using \texttt{autoref} uses the wrong name to refer to the environment (i.e., Equation rather than Query).
\end{document}