
나는 이것을 원하는 사람들의 여러 게시물과 질문을 발견했습니다.제거하다세로 간격이 그림 목록에 자동으로 추가되었지만 내 문제는 (정확히) 반대입니다.
저는 scrartcl
섹션이 있는 문서 클래스를 최상위 구분 기호로 사용하고 있습니다. 내 그림 목록에는 여러 섹션의 그림이 구분되어 있지 않습니다.
시각적인 분리를 어떻게 추가할 수 있나요?
다음 최소 작업 예제와 아래 출력을 참조하세요.
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{amsmath}
\numberwithin{figure}{section}
\begin{document}
\listoffigures
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\begin{figure}[ht]\caption{Figure}\end{figure}
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\end{document}
답변1
명령 을 패치해야 합니다 \@startsection
. 패치 \section
도 가능하지만 \section*
. 큰 문제는 아니지만, 피할 수 있다면 더 좋습니다.
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{amsmath}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
\newcommand{\artemis@space@loft}[1]{%
\ifnum#1=\sectionnumdepth
\doforeachtocfile[float]{%
\addtocontents{\@currext}{\protect\addvspace{\@sectionlistsgap}}%
}%
\fi
}
\newcommand{\@sectionlistsgap}{5pt} % <-- change here the desired gap
\makeatother
\numberwithin{figure}{section}
\begin{document}
\listoffigures
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\begin{figure}[ht]\caption{Figure}\end{figure}
\section{Section}
\subsection{SUB}
\begin{figure}[ht]\caption{Figure}\end{figure}
\end{document}
설명: 가 없는 \@dblarg
경우에만 실행됩니다 . 따라서 TeX이 이를 실행하기 전에 및 파일 에 수직 공간 주석을 추가하는 를 추가합니다 . 이는 클래스에서 수행하는 것과 동일합니다 (여기에는 10pt가 사용되며 기사에서는 더 작은 공간이 더 적절해 보입니다). 에서 제안한 기술을 사용합니다.\section
*
\artemis@space@loft
.lof
.lot
book
\chapter
요하네스_BKoma-Script의 기능을 활용합니다. 이런 식으로 새로 정의된 float 유형도 동일한 처리를 받게 됩니다.
매개변수 #2
to \@startsection
는 섹션 수준이므로 와 동일한지 확인합니다 \sectionnumdepth
. 의 본문 대신 에 article
사용해야 합니다 .\@ne
\sectionnumdepth
\artemis@space@loft
\subsection
간격이 섹션에만 추가되는지 확인하기 위해 추가했습니다 .
KoMaScript 버전 3.14에 대한 중요 업데이트
새로 출시된 KoMaScript 클래스 및 패키지 버전 3.14를 설치하면 위 패치가 더 이상 작동하지 않습니다.
이 버전에서는 하나를 변경해야 합니다
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
~ 안으로
\patchcmd{\scr@startsection}
{\scr@section@dblarg}
{\artemis@space@loft{#2}\scr@section@dblarg}
{}{}
일찍 알아차린 Johannes_B에게 감사드립니다(새 버전은 2014년 12월 8일 TeX Live에 업로드되었습니다).
당사자 중 한 쪽이 아직 KoMaScript를 업데이트하지 않았을 때 협력 작업을 위해 두 패치가 모두 필요한 경우,
\makeatletter
\ifdefined\scr@startsection
\patchcmd{\scr@startsection}
{\scr@section@dblarg}
{\artemis@space@loft{#2}\scr@section@dblarg}
{}{}
\else
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
\fi
\newcommand{\artemis@space@loft}[1]{%
...
해야 할 것.