\titleformat (titlesec에서)은 장에 대한 수평선을 표시하지 않습니다

\titleformat (titlesec에서)은 장에 대한 수평선을 표시하지 않습니다

titlesec저는 각 장 아래에 수평선을 그리는 간단한 작업을 시도했습니다 . 에 대한 많은 튜토리얼, 문서 및 질문이 있습니다.텍스이것이 어떻게 이루어질 수 있는지 설명합니다. 하지만... 그 각각의 대답은 나에게 전혀 아무것도 주지 않았습니다. 내가 시도한 솔루션은 다음과 같습니다.

  1. titlesec을 사용하여 장 제목 뒤에 규칙 추가
  2. 장 항목 위와 아래에 두 개의 수평선
  3. 줄 사이의 제목

그러나 각각의 경우에 컴파일된 PDF는 \titleformat. 내 현재 서문은 titlesec다음과 같이 사용됩니다.

\documentclass[11pt,oneside]{book}
\usepackage{titlesec}
% Below "\section" can be replaced with "\subsection" and "\subsubsection"
% in order to customize the corresponding headings. "bch" - Bitstream
% Charter, "b" - bold.
\titleformat{\section}[hang]
{\usefont{T1}{bch}{b}{n}\selectfont}
{}    % label
{0em} % horizontal separation between label and title body
{\hspace{-0.4pt}\Large \thesection\hspace{0.6em}} % before-code
[] % after-code

\titleformat
{\chapter}                       % command
[display]                        % shape
{\normalfont\huge\bfseries}      % format
{\chaptertitlename\ \thechapter} % label
{20pt}                           % sep
{\Huge}[\vspace{2ex}\titlerule]  % before-code

이것은 내가 시도한 적어도 12가지 변형 중 하나일 뿐입니다.타이틀섹 문서, 섹션 3.8에 설명된 방법을 포함 {name=\chapter,numberless}하지만 이에 대해 보여줘야 할 것은 다음 스크린샷뿐입니다.

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

보시다시피, "Abstract" 장 위, 아래 또는 근처에는 수평선이 없습니다. 현재 문서가 거의 비어 있습니다. 서문이 끝나면 나에게 남은 건

\begin{document}
\maketitle
\chapter*{Abstract}
Lorem Ipsum etc. etc.
\end{document}

MWE를 제공할 수 있었으면 좋겠습니다. 가장 기본적인 예라도 결과가 나오지 않도록 내가 여기서 뭘 잘못하고 있는지 알려주십시오.

답변1

번호가 매겨진 장에 대한 형식을 정의하고 에 대해 번호가 매겨지지 않은 장을 사용했습니다 Abstract. 이 경우 규칙을 얻으려면 번호가 없는 장의 형식을 정의해야 합니다.

\documentclass[11pt,oneside]{book}
\usepackage{titlesec}
% Below "\section" can be replaced with "\subsection" and "\subsubsection"
% in order to customize the corresponding headings. "bch" - Bitstream
% Charter, "b" - bold.
\titleformat{\section}[hang]
{\usefont{T1}{bch}{b}{n}\selectfont}
{}    % label
{0em} % horizontal separation between label and title body
{\hspace{-0.4pt}\Large \thesection\hspace{0.6em}} % before-code
[] % after-code

\titleformat
{\chapter}                       % command
[display]                        % shape
{\normalfont\huge\bfseries}      % format
{\chaptertitlename\ \thechapter} % label
{20pt}                           % sep
{\Huge}[\vspace{2ex}\titlerule]  % before-code

\titleformat
{name=\chapter,numberless}                       % command
[display]                        % shape
{\normalfont\huge\bfseries}      % format
{} % label
{0pt}                           % sep
{\Huge}[\vspace{2ex}\titlerule]  % before-code    %% adjust 2ex here as you want.

\begin{document}
%\maketitle
\chapter*{Abstract}
Lorem Ipsum etc. etc.
\end{document}

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

간격을 조정하지 않았습니다. 다음을 사용하여 수행하십시오. \titlespacing* 기본값은 다음과 같습니다.

\titlespacing*{\chapter} {0pt}{50pt}{40pt}

다음을 사용하여 번호가 없는 장에도 수행하십시오.

\titlespacing*{name=\chapter,numberless} {0pt}{50pt}{40pt}

관련 정보