하위 섹션 제목 및 참조에 대한 다양한 라벨

하위 섹션 제목 및 참조에 대한 다양한 라벨

저는 논문을 작성 중이며 보고서 클래스의 변형을 사용하고 있습니다. 장소에는 장, 섹션, 하위 섹션 및 하위 하위 섹션이 있습니다. 텍스트를 읽을 때 하위 섹션과 하위 섹션의 제목에 긴 숫자, 문자, 로마 숫자가 포함되어 있으면 불쾌해 보입니다. 나는 이러한 제목에 관련 하위 섹션 또는 하위 하위 섹션 제목만 포함하는 것을 선호하며 다음을 사용하여 그렇게 합니다.

\renewcommand\thesubsection{\Roman{subsection}}

(결과에 따라 섹션 카운터를 포함할 수도 있지만 장 카운터는 확실히 제거하겠습니다.) 그러나 하위 섹션이나 하위 섹션을 참조할 때는 전체 숫자 문자열을 선호합니다. 그렇지 않으면 참조가 제대로 정의되지 않습니다. 누구든지 이 작업을 수행하는 방법에 대해 의견을 말할 수 있습니까?

다음은 최소한의 예입니다.

\documentclass{report}

\begin{document}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.
\\

\noindent Here is a reference to the subsection: (\ref{subsection})
\\

\noindent I would like references to the subsection to be (1.1.I), however.

\end{document}

답변1

재정의 \p@subsection(하위 섹션에 대한 참조에 사용되는 접두사):

\documentclass{report}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}
\makeatletter
\renewcommand\p@subsection{\thesection.}
\makeatother

\begin{document}

\chapter{Chapter}

\section{Section}

\subsection{Subsection}\label{subsection}

\noindent I have the subsections labelled in Roman in the title, because 1.1.I would just be long.

\noindent Here is a reference to the subsection: (\ref{subsection})

\end{document}

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

그런데 절대 ; 조합을 사용하지 마세요 \\ + blank line. 이렇게 하면 상자가 가득 찼다는 경고가 생성됩니다.

답변2

참조에는 자동으로 접두사가 붙을 수 있습니다 \p@<counter>. 예를 참조하세요.

\documentclass{report}
\usepackage{parskip}

\renewcommand\thesection{\arabic{chapter}.\arabic{section}}
\renewcommand\thesubsection{\Roman{subsection}}

\makeatletter
\renewcommand*{\p@subsection}{\thesection.}
\makeatother

\begin{document}
\chapter{Chapter}

Here is a reference to the subsection: \ref{subsection}

\section{Section}

\subsection{Subsection}\label{subsection}

\end{document}

결과:

결과

관련 정보