
나는 물리학 학위를 위한 그룹 프로젝트의 일환으로 보고서를 작성하고 있으며 목차의 형식을 올바르게 지정하는 데 재미를 느끼고 있습니다. MWE는 다음과 같습니다.
\documentclass[twoside]{article}
\usepackage[a4paper,pdftex,left=1.7cm,right=1.7cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage{blindtext}
\usepackage[english]{babel}
\renewcommand*\thesection{\arabic{section}.0}
\renewcommand*\thesubsection{\arabic{section}.\arabic{subsection}}
\begin{document}
\tableofcontents
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\newpage
\begin{abstract}
\blindtext
\end{abstract}
\section{A section}
\blindtext
\section{Another section}
\blindtext
\subsection{A subsection}
\blindtext
\subsection{Yet another subsection}
\blindtext
\subsubsection{Oh, exciting, a sub sub section!}
\blindtext
\section{Another boring old section}
\blindtext
\end{document}
출력은 다음과 같습니다.
섹션 사이의 간격과 해당 번호가 너무 작다는 점을 제외하면 나쁘지 않습니다. 나는 이것을 서문에 포함시켜서 문제를 해결하려고 했습니다:
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{3em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{3.0em}{3.5em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{4.5em}{4.2em}}
\makeatother
이것을 주는 것:
원하는 대로 간격을 조정할 수 있지만(그림에서는 올바르게 조정되지 않았으며 예일 뿐임) 굵은 글꼴이 손실되고 이전에 없었던 섹션에 점이 몇 개 생긴 것 같습니다. 나는 또한 섹션 사이의 좋은 간격을 잃었습니다. 나는 굵은 글꼴을 다시 얻으려고 노력했습니다.
\renewcommand\cftsecfont{\bfseries}
하지만 별 효과가 없는 것 같았어요. 내 ToC 형식을 더 잘 지정하는 방법에 대한 조언을 주시면 감사하겠습니다. 대학에서 지정한 특정 레이아웃의 서식을 따를 필요는 없지만 명확하고 전문적으로 보이길 원합니다. 첫 번째 예는 섹션 바로 옆에 섹션 번호가 붙어 있는 점을 제외하면 완벽했지만 하위 섹션에는 문제가 없었습니다.
답변1
(기사 클래스) 의 섹션 번호에 사용되는 너비는 Toc
재조정하여 설정할 수 있습니다.
\cftsecnumwidth
적절한 값으로 설정합니다( 30pt
제 예에서는).
이를 위해서는 패키지가 tocloft
필요합니다.
목적을 이해하지 못함
\renewcommand*\thesection{\arabic{section}.0}
하지만.
\documentclass[twoside]{article}
\usepackage[a4paper,pdftex,left=1.7cm,right=1.7cm,top=2cm,bottom=2.5cm]{geometry}
\usepackage{blindtext}
\usepackage[english]{babel}
\usepackage{tocloft}
\renewcommand*\thesection{\arabic{section}.0}
\renewcommand*\thesubsection{\arabic{section}.\arabic{subsection}}
\renewcommand{\cftsecnumwidth}{30pt}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{4}
\begin{document}
\tableofcontents
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\newpage
\begin{abstract}
\blindtext
\end{abstract}
\section{A section}
\blindtext
\section{Another section}
\blindtext
\subsection{A subsection}
\blindtext
\subsection{Yet another subsection}
\blindtext
\subsubsection{Oh, exciting, a sub sub section!}
\blindtext
\section{Another boring old section}
\blindtext
\end{document}