프레임이 있는 장 제목 위의 "늘어나는" 음수 수직 공간 이해

프레임이 있는 장 제목 위의 "늘어나는" 음수 수직 공간 이해

이 질문은 이전 질문과 다소 관련이 있습니다.KOMA 스크립트를 사용하여 장 제목 위/아래에 줄이 있는 장의 hbox가 가득 찼습니다., (일부) 문제는 상단 및 하단 라인을 추가하는 다양한/모든 방법에서 발생합니다( mdframed제어하기 가장 쉬운 방법일 뿐만 아니라).

문제를 보여주기 위해 다음과 같은 최소한의 예가 주어졌습니다.

\documentclass[
    parskip=full,
    open=any,
]{scrreprt}
\usepackage{mdframed}
\usepackage{lipsum}

\RedeclareSectionCommand[
    beforeskip=0pt,
    afterskip=0pt,
]{chapter}

\newmdenv[
    skipabove=16pt, % why is this necessary?
    leftline=false,
    rightline=false,
    innerleftmargin=0.5mm,
    innerrightmargin=0.5mm,
    innertopmargin=4pt,
    innerbottommargin=1pt,
    linewidth=.6pt,
]{chapterframe}

\makeatletter
\renewcommand{\chapterlinesformat}[3]{%
\begin{chapterframe}%
    \raggedchapter%
    \@hangfrom{\vphantom(#2}{#3}%
\end{chapterframe}%
\nointerlineskip}

\widowpenalty10000
\clubpenalty10000
\begin{document}
\flushbottom
\chapter{Foo}
\lipsum[1-4]
\chapter{Bar}
\lipsum[1-4]

% just the right amount of text to cause paragraph spacing to stretch
Fusce mauris. Vestibulum luctus nibh at lectus. Sed
bibendum, nulla a faucibus semper, leo velit ultricies
tellus, ac venenatis arcu wisi vel nisl. Vestibulum
diam. Aliquampellentesque, augue quis sagittis posuere,
turpis lacus congue quam, in hendrerit risus eros eget
felis.
\end{document}

다음 두 가지 문제가 발생합니다.

  1. 제목 윗줄이 텍스트 상자 밖으로 나가지 않도록 스킵을 정의해야 합니다. 이는 beforeskipin이 \RedeclareSectionCommand0 건너뛰기가 아니라 부정적인 건너뛰기를 초래한다는 것을 나타내는 것처럼 보입니다 .
  2. 고아/과부를 방지하기 위해 단락 간격을 늘리면 페이지에 대한 장 제목의 위치가 변경됩니다. 분명히 음수 공간이 존재할 뿐만 아니라 "늘어나기" 때문입니다.

따라서 내 질문은 다음과 같습니다. 왜 음수 공백이 있으며 이를 제거하거나 최소한 장 제목이 고정된 위치에 유지되도록 늘어나는 것을 방지할 수 있습니까?

몇 가지 실험을 거친 후 다음 방법으로 문제가 해결된 것으로 보이지만 여전히 원인을 알고 싶습니다(더 깔끔한 솔루션도 환영합니다!).

\makeatletter
\renewcommand{\chapterlinesformat}[3]{%
\makebox[.65\linewidth][l]{%
\begin{minipage}{\linewidth}%
\vspace{1.6pt}
\begin{chapterframe}%
    \raggedchapter%
    \@hangfrom{\vphantom(#2}{#3}%
\end{chapterframe}%
\end{minipage}%
}}

이는 \makebox원래의 과도한 hbox 문제를 방지하는 데 필요하며 미니페이지는 간격 문제를 해결하는 것으로 보입니다. 여전히 작은 음수가 있지만 분명히 일정한 vspace인 1.6pt가 있습니다. 이는 선 너비와 내부 하단 여백의 합일 수도 있고 아닐 수도 있습니다.

답변1

showbox 출력을 보면 코드가 보상하고 있지만 \parskip자연스러운 길이만 있으므로 제목 앞에 늘이기 구성 요소만 표시됩니다. 정확히 어디를 추적하지는 않았지만 로컬에서 고정된 parskip을 사용하는 경우 두 제목이 모두 같은 지점에 옵니다.

\documentclass[
    parskip=full,
    open=any,
]{scrreprt}
\usepackage{mdframed}
\usepackage{lipsum}

\RedeclareSectionCommand[
    beforeskip=0pt,
    afterskip=0pt,
]{chapter}

\newmdenv[
    skipabove=16pt, % why is this necessary?
    leftline=false,
    rightline=false,
    innerleftmargin=0.5mm,
    innerrightmargin=0.5mm,
    innertopmargin=4pt,
    innerbottommargin=1pt,
    linewidth=.6pt,
]{chapterframe}

\makeatletter

\showoutput
\showboxdepth=1
\renewcommand{\chapterlinesformat}[3]{%
\begin{chapterframe}%
    \raggedchapter%
    \@hangfrom{\vphantom(#2}{#3}%
\end{chapterframe}%
\nointerlineskip}

\widowpenalty10000
\clubpenalty10000
\begin{document}
\flushbottom
{\parskip=1\parskip\chapter{Foo}}

\lipsum[1-4]

{\parskip=1\parskip\chapter{Bar}}
\lipsum[1-4]

% just the right amount of text to cause paragraph spacing to stretch
Fusce mauris. Vestibulum luctus nibh at lectus. Sed
bibendum, nulla a faucibus semper, leo velit ultricies
tellus, ac venenatis arcu wisi vel nisl. Vestibulum
diam. Aliquampellentesque, augue quis sagittis posuere,
turpis lacus congue quam, in hendrerit risus eros eget
felis.
\end{document}

원본이 생산

Underfull \vbox (badness 1783) has occurred while \output is active
\vbox(595.80026+0.0)x418.25555, glue set 2.61316
.\write-{}
.\write1{\@writefile{toc}{\protect \contentsline {chapter}{\protect \numberline
 \ETC.}
.\write1{\@writefile{lof}{\protect \addvspace {10\p@ }}}
.\write1{\@writefile{lot}{\protect \addvspace {10\p@ }}}
.\glue(\topskip) 11.0
.\vbox(0.0+0.0)x0.0, glue set 13.6fil []
.\glue -13.6 plus -1.36008
.\glue -13.6

더하기 -1.360008은 결코 보상되지 않으며, 페이지가 가득 차 있지 않으면 어떤 양의 스트레치 구성 요소라도 공간을 채우기 위해 늘어날 수 있습니다.

관련 정보