\ref 명령에 점을 추가하지 않고 헤드라인 및 ToC의 \섹션 번호 뒤에 점을 추가하는 방법

\ref 명령에 점을 추가하지 않고 헤드라인 및 ToC의 \섹션 번호 뒤에 점을 추가하는 방법

번호 매기기 후 점으로 인쇄된 \section( \subsection, ...) 제목이 필요합니다 .\subsubsection

예:

  1. 내 제목

이 목적을 위해 나는 다음을 사용합니다:

\renewcommand\thesection{\normalfont \arabic{section}.}

\renewcommand\thesubsection{\thesection\arabic{subsection}.}

\renewcommand\thesubsubsection{\thesubsection\arabic{subsubsection}.}

\renewcommand\theparagraph{\thesubsubsection\arabic{paragraph}.}

그러나 이 방법은 \ref{}명령에 추가 점을 추가하기도 합니다. 따라서 "부분을 보세요 \ref{section:label}." 라고 코드화하세요. "Look at section 3.." 문자열을 생성합니다.

헤드라인과 ToC에만 점을 추가하고 참조에는 점을 추가하지 않는 방법이 있습니까?

답변1

로 수행하는 방법은 다음과 같습니다 titlesec/titletoc. 라벨 뒤의 점은 \titleformat가 아닌 에 의해 추가됩니다 \thesection. 목차의 점은 titletoc의 옵션입니다. 또한, cleveref상호 참조를 보다 간단하게 작성하기 위해 사용합니다.

\documentclass[12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{heuristica}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage[dotinlabels]{titletoc}
\titleformat{\section}[hang]{\bfseries\large}{Section \thesection.}{0.4em}{}
\titlespacing*{\section}{0pt}{2\baselineskip}{2\baselineskip}
\dottedcontents{section}[3.8em]{}{2.3em}{1pc}
\usepackage{cleveref}

\begin{document}

\tableofcontents

\section{Preliminaries}\label{sec:prelim}
\lipsum[1]

\section{Another section}
See \Cref{sec:prelim}.

\end{document} 

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

답변2

\usepackage{titlesec}
\titlelabel{\thetitle.\quad}

자세한 내용은패키지 titlesec문서3페이지에 있습니다.

관련 정보