enumite를 사용한 참조

enumite를 사용한 참조

이 질문이 다른 곳에서 제기되었다면 죄송합니다. 여기저기 찾아보았으나 찾을 수 없었습니다.

나는 많은 목록과 많은 참고자료가 포함된 문서를 작성하고 있습니다. 각 항목을 명시적으로 작성하지 않고 목록 항목을 참조하고 싶습니다 \label{}. 패키지가 이 문제를 해결할 것이라고 생각했지만 enumitem아마도 제가 착각했을 수도 있습니다.

예는 다음과 같습니다.

\begin{theorem} There are four equivalent things
\begin{enumerate}[label=(\roman{*}), ref=(\roman{*})]
   \item Thing 1
   \item Thing 2
   \item Thing 3
   \item Thing 4
\end{enumerate}

그리고 나중에 본문에서 나는 이것을 다음과 같이 언급합니다.

Theorem~\ref[(ii)]{thm:4.1} 

텍스트는 다음과 같이 나옵니다.Theorem ??(ii)]thm:4.1

그런 일이 가능합니까? 아니면 너무 많은 것을 요구하는 걸까요?

답변1

여기서 가장 큰 문제 \ref선택 과목논쟁. 따라서 첫 번째 토큰은 [다음 토큰으로 간주됩니다.필수적인에 전달된 인수 는 적절한 연결이 \ref없습니다 . \label대신 다음 옵션 중 하나를 사용할 수 있으며, 모두 기본적으로 다음을 통해 지원됩니다.enumitem:

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\newtheorem{theorem}{Theorem}
\begin{document}
\begin{theorem}\label{thm:labelA} There are four equivalent things
\begin{enumerate}[label=(\roman*), ref=(\roman*)]
   \item \label{thm:labelA:thing1} Thing 1
   \item \label{thm:labelA:thing2} Thing 2
   \item \label{thm:labelA:thing3} Thing 3
   \item \label{thm:labelA:thing4} Thing 4
\end{enumerate}
\end{theorem}

Theorem~\ref{thm:labelA}\ref{thm:labelA:thing2}.

\begin{theorem}\label{thm:labelB} There are four equivalent things
\begin{enumerate}[label=(\roman*), ref=\thetheorem(\roman*)]
   \item \label{thm:labelB:thing1} Thing 1
   \item \label{thm:labelB:thing2} Thing 2
   \item \label{thm:labelB:thing3} Thing 3
   \item \label{thm:labelB:thing4} Thing 4
\end{enumerate}
\end{theorem}

Theorem~\ref{thm:labelB:thing2}.

\end{document}

첫 번째는 환경 레이블과 열거된 항목을 수동으로 분리해야 하는 반면, 두 번째는 목록 속성 에 theorem추가하여 단일 단계로 결합합니다 .\thetheoremref

관련 정보