
내 Supporting Info 에는 다음과 같이 정의 chapter
되어 있습니다 .subsections
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
교수님께서 요청하신 형식입니다.
이것은 로마 숫자 때문에 세 번째 섹션에 있을 때 하위 섹션 번호 매기기를 꽤 넓게 만듭니다. 이것은 패키지 toc
로 생성한 내부 2차 문제일 뿐입니다 titletoc
. 답변에 이어여기사용:
\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.9em}}
\makeatother
나는 my 에서 section number
와 사이의 간격을 변경하기 위해 동일한 경로를 따랐 지만 기본 및 내부 간격 모두에 대해 와 사이의 간격이 모두 변경되는 것을 발견했습니다 .title
toc
section number
subsection title
toc
toc
내 장 내에서 두 번째 간격을 더 작게 변경하고 싶습니다 .
toc
나는 with 에 명령을 추가 protect
하는 등 이전에 나에게 보여줬던 다른 트릭을 사용했지만 addtocontents
성공하지 못했습니다.
내 MWE는 다음과 같습니다.
\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\linespread{1.3}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.9em}}
\makeatother
\begin{document}
\addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
\frontmatter
\tableofcontents
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection}
\mainmatter
\DoubleSpacing
\chapter{Chap1}
\section{Chap1Sec1}
\section{Chap1Sec2}
\chapter{Chap2}
\section{Chap2Sec1}
\section{Chap2Sec2}
\subsection{Chap2Sec2Subsec1}
\SingleSpacing
\chapter{Chap3}
\settocdepth{section}
\renewcommand{\thesection}{\thechapter-\Roman{section}}
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
\renewcommand{\thepage}{S-\arabic{page}}
\section{Chap3Sec1}
\clearpage
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}
\end{document}
답변1
\l@subsection
정확히 필요한 위치와 그룹 내부에 대한 재정의를 삽입했습니다 . 이렇게 하면 재정의가 로컬이 되어 그룹이 닫힌 후 이전 상태로 되돌아갑니다.
%...
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\makeatletter
\addtocontents{toc}{%
\protect\begingroup%
\protect\makeatletter
\protect\def\protect\l@subsection{\protect\@dottedtocline{2}{4.0em}{3.9em}}
\protect\makeatother
}
\makeatother
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\addtocontents{toc}{%
\protect\endgroup%
}
%...
기본 ToC에는 여전히 원래 하위 섹션 간격이 있습니다.
그러나 지원 챕터의 미니 ToC 간격은 훨씬 더 넓습니다.
현재 업데이트된 원본 MWE는 다음과 같습니다.
\documentclass{memoir}% http://ctan.org/pkg/memoir
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}\linespread{1.3}
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
\frontmatter
\tableofcontents
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection}
\mainmatter
\DoubleSpacing
\chapter{Chap1}
\section{Chap1Sec1}
\section{Chap1Sec2}
\chapter{Chap2}
\section{Chap2Sec1}
\section{Chap2Sec2}
\subsection{Chap2Sec2Subsec1}
\SingleSpacing
\chapter{Chap3}
\settocdepth{section}
\renewcommand{\thesection}{\thechapter-\Roman{section}}
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
\renewcommand{\thepage}{S-\arabic{page}}
\section{Chap3Sec1}
\clearpage
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\makeatletter
\addtocontents{toc}{%
\protect\begingroup%
\protect\makeatletter
\protect\def\protect\l@subsection{\protect\@dottedtocline{2}{4.0em}{3.9em}}
\protect\makeatother
}
\makeatother
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\addtocontents{toc}{%
\protect\endgroup%
}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}
\end{document}