섹션 앞뒤 공백

섹션 앞뒤 공백

문단 사이에 텍스트 [그림 참조] 안에 추가 공간이 있습니다. 그 외에도 [이 공간]의 크기가 다릅니다. 섹션 앞과 섹션 제목 뒤에도 추가 공간이 있습니다. 또한 다른 섹션 제목의 크기도 다릅니다. 여기에 이미지 설명을 입력하세요 여기에 이미지 설명을 입력하세요 여기에 이미지 설명을 입력하세요 어떻게 고치나요?

    \documentclass[openany]{book}
    \usepackage[utf8]{inputenc}
    \usepackage[MeX]{polski}
    \usepackage{xcolor}
    \usepackage{lipsum}
    \usepackage[explicit]{titlesec}
    \usepackage[dotinlabels]{titletoc}
    \usepackage{setspace}
    \onehalfspacing
    \usepackage[protrusion=true,expansion=true]{microtype}
    \usepackage{lettrine}
    \usepackage{titlesec}
    %\titleformat{\section}{\normalfont\bfseries}{\thesection}{1em}{}
    %\linespread{0.9}
    \newlength\BoxWd
    \setlength\BoxWd{0.75cm}
    \newlength\Aux
    \usepackage[left=4.65cm, right=4.65cm, top=4cm, bottom=4.25cm]{geometry}

    % chapter tiltes formatting
    \titleformat{\chapter}[display]
     {\normalfont\sffamily\huge}
     {\renewcommand{\thechapter}{\Roman{chapter}}%
      \settowidth\Aux{\textcolor{white}{\Huge\thechapter}}
      \ifnum\Aux>\BoxWd
        \setlength\BoxWd{\Aux}
      \else\fi
     \hspace*{0.3em}\colorbox{black}{%
     \parbox[c][1.2cm][c]{\BoxWd}{%
      \centering\textcolor{white}{\Huge\thechapter}}}}
      {-1ex}
      {\titlerule\vspace{.7ex}\filleft\MakeUppercase{#1}}
      [\vspace{.2ex}\titlerule]
     \titlespacing*{\chapter}{0pt}{50pt}{80pt}
     \titleformat{\section}
      {\scshape\normalsize\bfseries}{\MySecSquare\ \thesection.}{0.15em}{#1}
       \titlespacing*{\section}{0pt}{2.5pt}{1.5pt}

       \titleformat{\subsection}
       {\normalfont\scshape\normalsize\bfseries}{\MySecSquare\ \thesubsection.} {0.10em}{#1}
      \titlespacing*{\subsection}{0pt}{1.5pt}{0.5pt}

      % formatting for chapter entries in ToC  
      \titlecontents{chapter}
      [3em]{\vspace*{5.5pt}}
      {\small\bfseries{\hspace*{-2.63em}{\chaptername}\hspace*  {5pt}\contentslabel{0.25em}\hspace*{1.25em}}}
      {\hspace*{-3em}}
      {\titlerule*[1pc]{.}\small\sffamily\bfseries\contentspage}

      % formatting for section entries in ToC  
      \titlecontents{section}
      [4em]{\vspace*{-2pt}}
      {\small\contentslabel{2.5em}}
      {\hspace*{2.75em} }%\hspace*{-2.3em}
      {\titlerule*[1pc]{.}\small\sffamily\contentspage}

      \titlecontents{subsection}
      [7em]{\vspace*{-2pt}}
      {\small\contentslabel{2.85em}}
      {\hspace*{6em}}
      {\titlerule*[1pc]{.}\small\sffamily\contentspage}

      \newcommand\MySquare{%
      \leavevmode\hbox to 1.2ex{\hss\vrule height .9ex width .7ex depth -.2ex\hss}}

      \newcommand\MySecSquare{%
      \leavevmode\hbox to 1.2ex{\hss\vrule height 1.3ex width 1.1ex depth -.2ex\hss}}

      \renewcommand\labelitemi{\MySquare}

      \newenvironment{myquote}{\list{}{\leftmargin=15pt\rightmargin=0.0pt}\item[]}{\endlist}
      \newcommand\MyTitle{Some title}
      \usepackage{fancyhdr}
      \fancyhf{}
      \fancyhead[EL,OR]{\thepage}
      \fancyhead[OL]{\scriptsize\scshape{\leftmark}}
      \fancyhead[ER]{\footnotesize\scshape{\MyTitle}}
      \renewcommand\headrulewidth{0.2pt}


      \pagestyle{fancy}

      \newcommand{\initial}[1]{%
        \lettrine[lines=2,lhang=0.35,nindent=0em]{
                    \color{black}
                    {{#1}}}{}}
       \renewcommand\chaptermark[1]{\markboth{\thechapter.\ #1}{}} 
        \usepackage{hyperref}
       \hypersetup
        {   
        colorlinks,
        citecolor=black,
        filecolor=black,
        linkcolor=black,
        urlcolor=black,
        pdfauthor = {Pdfautor},
        pdftitle = {My title},
        pdftex
         }

         \begin{document}

        \frontmatter

        \tableofcontents
        \clearpage

        \newpage
        \thispagestyle{empty}



        \mainmatter
        \chapter*{Na wstępie}\label{chap:one}
        \addcontentsline{toc}{chapter}{\bfseries{Na wstępie}\vspace*{2em}}
        \setcounter{page}{9}

        \section{Section One}
        \lipsum[1-10]
        \section{Section two}
        \lipsum[1]
        \section{Section 3}
        \section{Section 4}
        \lipsum[1-10]
        \section{Section 5}
        \lipsum[1-2]
        \section{Section 6}
        \lipsum[1]
        \section{Section 7}
        \lipsum[1-20]
        \chapter{Second chapter}
        \section{someSection}
        \lipsum[1-20]
        \section{someSection2}
        \lipsum[1-20]
        \chapter{Last chapter}
        \end{document}

답변1

이 질문은 아마도 질문에 답변되었을 것입니다페이지 하단(및 상단) 사이에 텍스트가 정렬되어 있는지 확인.

옵션을 추가해보세요paper=a4paper,twoside=true,textheight=45\baselineskip+\topskip

geometry문서의 -옵션 에 . 패키지도 이용해야해요calc

\usepackage{calc}
\usepackage[paper=a4paper,
            twoside=true,
            bindingoffset=0cm,
            textheight=45\baselineskip+\topskip,
            left=4.65cm, right=4.65cm, top=4cm, bottom=4.25cm
            ]{geometry}

MWE(아마도 실제 문서에서는)에서는 뒤에 작은 텍스트가 있어야 section 0.2하고 그 사이에 텍스트가 없는 두 개의 하위 섹션이 있어야 하기 때문에 간격 문제가 해결되지 않습니다. LaTeX페이지를 분할할 적절한 위치를 찾지 못했습니다. 실제 텍스트를 사용하거나 \lipsum[2-3]뒤에 사용하면 section 0.2공백도 사라집니다. 다음 명령을 사용할 수도 있습니다.

\enlargethispage{2\baselineskip}

또는

\enlargethispage{-\baselineskip}

문제가 있는 페이지에서 일부 줄을 추가하거나 뺍니다.

문제는 book-class가 기본값으로 사용되므로 flushbottom위쪽과 아래쪽 여백 사이의 텍스트가 늘어나기 때문에 발생합니다. raggedbottom클래스 옵션에 옵션을 추가하면 문제가 영구적으로 사라집니다.

도덕은: 텍스트를 상단과 하단 여백 사이에 플러시하려면 모든 편집을 마친 후 문서를 주의 깊게 살펴보아야 합니다. 마지막 수정에서는 이러한 유형의 조판 오류를 수정하는 미묘한 변경을 가할 수 있습니다. 하지만 자동으로 발행된 모든 항목을 처리할 수는 없습니다.

관련 정보