
\arabic
작은 하위 정의 목록 (\alph
. 때때로 전체 상호 참조를 사용하고 싶습니다(2.3a,2.3b, ...). 그러나 때로는 문맥상 주요 정의가 명확할 때 짧은 상호 참조를 사용하고 싶습니다(ㅏ,비, ..).
하지만 매크로는 하나만 정의할 수 있습니다 \thesubdefinition
. 그래서 내 질문은: 하나 이상의 서식을 단일 카운터(예: one \label
)에 연결하는 권장 방법이 있습니까? '사용자 코드'에서는 \ref
전체 참조와 \shortref
짧은 참조를 위해 사용하는 것을 상상합니다.
\newcounter{subdefinition}[definition]
\def\subdef#1{\refstepcounter{subdefinition}(\alph{subdefinition}) #1}
...
\begin{definition} \label{def}
Bla bla technical stuff:
\subdef{simple axiom}\label{simple},
\subdef{complex axiom}\label{complex}.
Note that axiom~\shortref{complex} is more complex than axiom~\shortref{simple}.
\end{definition}
We will focus mostly on axiom~\shortref{complex}). % axiom b
...
Recall that axiom~\ref{complex} is very complex. % axiom 2.3b
뭔가를 해킹할 수도 있겠지만, 이에 대한 패키지가 있을까요?
답변1
당신이 사용할 수있는 zref
:
\documentclass{article}
\usepackage{amsthm}
\usepackage[user]{zref}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newcounter{subdefinition}[definition]
\makeatletter
\zref@newprop{subdef}{}
\zref@newprop{fulldef}{}
\zref@addprop{main}{subdef}
\zref@addprop{main}{fulldef}
\newcommand\subdef[1]{%
\refstepcounter{subdefinition}%
\zref@setcurrent{subdef}{\alph{subdefinition}}%
\zref@setcurrent{fulldef}{\thedefinition\alph{subdefinition}}%
(\alph{subdefinition})~#1%
}
\newcommand{\shortref}[1]{\zref[subdef]{#1}}
\newcommand{\fullref}[1]{\zref[fulldef]{#1}}
\makeatother
\begin{document}
\section{A definition}
\begin{definition} \label{def}
Bla bla technical stuff:
\subdef{simple axiom}\zlabel{simple},
\subdef{complex axiom}\zlabel{complex}.
Note that axiom~\shortref{complex} is more complex than axiom~\shortref{simple}.
\end{definition}
\section{A reference}
We will focus mostly on axiom~\fullref{complex}.
\end{document}
\zlabel
에 대한 레이블을 설정하려면 을 사용해야 합니다 \subdef
.