设置部分前言和缩进

设置部分前言和缩进

我如何在环境中强制缩进\setpartpreamble?似乎\indent不起作用,解决方案对\hspace我来说就像猜测缩进的正确长度。

有什么想法可以实现这个目标吗?

最小示例:

\documentclass[a4paper,12pt,twoside,final]{scrbook}

\begin{document}

\setcounter{part}{0}
\setpartpreamble{
\vspace*{4\baselineskip}

In the first part of this book we shall become familiar with the central ingredients of the description of classical electrodynamics, that is the Maxwell equations. We first follow a “derivation” of these equations, suggested by Richard P. Feynman, and then introduce the scalar and the vector potential.

\hspace{0.1cm} Appropriate combinations of their derivatives represent solutions of the homogeneous Maxwell equations. The inhomogeneous ones provide us with coupled inhomogeneous wave equations for these potentials which are determined by the charge and the current densities. We can decouple these equations by taking advantage of the gauge freedom of electrodynamics. In the non-relativistic limit the Coulomb gauge is convenient and allows us to obtain a rather intuitive picture for the energy of the electromagnetic field as a sum of the energies of a continuous superposition of harmonic oscillators. 

The gauge freedom inherent in the Maxwell equations is also crucial in constructing the interaction of a charged particle with an electromagnetic field in quantum theory. The invariance of the Schrödinger equation under local phase transformation leads us to the minimal substitution which is at the very heart of Feynman’s derivation, as well as at the construction of the Lagrangian and the Hamiltonian of a charged particle in an electromagnetic field described by classical mechanics.  
}
\part{Maxwell equations}
\end{document}

答案1

部分序言的文本在 中排版\parbox,其中\parindent参数设置为零,因此\indent不执行任何操作。

为了获得正常的缩进,您必须将其保存在某处并修补前导设置命令。

\documentclass[a4paper,12pt,twoside,final]{scrbook}
\usepackage{etoolbox}
\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\makeatletter
\patchcmd{\set@@@@preamble}{#6}{\setlength{\parindent}{\normalparindent}#6}{}{}
\makeatother

\begin{document}

\setpartpreamble{
In the first part of this book we shall become familiar with the central ingredients of the 
description of classical electrodynamics, that is the Maxwell equations. We first follow a 
“derivation” of these equations, suggested by Richard P. Feynman, and then introduce the 
scalar and the vector potential.

Appropriate combinations of their derivatives represent solutions of the homogeneous 
Maxwell equations. The inhomogeneous ones provide us with coupled inhomogeneous wave 
equations for these potentials which are determined by the charge and the current 
densities. We can decouple these equations by taking advantage of the gauge freedom of 
electrodynamics. In the non-relativistic limit the Coulomb gauge is convenient and allows 
us to obtain a rather intuitive picture for the energy of the electromagnetic field as a 
sum of the energies of a continuous superposition of harmonic oscillators.

The gauge freedom inherent in the Maxwell equations is also crucial in constructing the 
interaction of a charged particle with an electromagnetic field in quantum theory. The 
invariance of the Schrödinger equation under local phase transformation leads us to the 
minimal substitution which is at the very heart of Feynman’s derivation, as well as at the 
construction of the Lagrangian and the Hamiltonian of a charged particle in an 
electromagnetic field described by classical mechanics.}

\part{Maxwell equations}
\end{document}

在此处输入图片描述

如果您希望部分标题和序言之间有固定的垂直空间,请将其添加到补丁中,例如

\makeatletter
\patchcmd{\set@@@@preamble}
  {#6}
  {\setlength{\parindent}{\normalparindent}
   \vspace{4\baselineskip}
   %\noindent % uncomment if you want the first paragraph unindented
   #6}
  {}{}
\makeatother

相关内容