标题、副标题和文本之间的不同间距以及小节文本对齐方式

标题、副标题和文本之间的不同间距以及小节文本对齐方式
  1. 有什么办法可以使小节标题的第一行与 \parident 对齐,而第二行 -- 左对齐?

在此处输入图片描述

  1. 我需要在标题、副标题和副副标题之间设置不同的间距:a. 章节标题和小节标题之间的间距 - 8mm;b. 任何标题和文本之间的间距 - 15mm;c. 文本和小节标题之间的间距 - 1.5 倍行距。

尝试这样做,但没有得到正确的结果:

\documentclass{article}

\usepackage{titlesec}
\usepackage[T1,T2A]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}



\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries\filcenter}{\thesection}{1em}{} 
\titleformat{\subsection}{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{} 
\titleformat{\subsubsection}{\normalfont\fontsize{14}{15}}{\thesubsubsection}{1em}{} 

\titlespacing{\section}{}{10mm}{10mm}
\titlespacing{\subsection}{\parindent}{25mm}{15mm} 
\titlespacing{\subsubsection}{\parindent}{25mm}{15mm} 

\begin{document}

\section{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsubsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube.

\end{document} 

UPD。系统升级(包括 texlive 升级)后,如果我使用 \titleformat,标题中将没有文本。

答案1

章节与子章节之间的间距问题无法自动解决,因为您无法提前知道章节标题后面是一些文本还是子章节标题。所以我认为您必须手动完成。

以下代码是我根据您理解的要求提供的解决方案:

\documentclass{article}
\usepackage[T1]{fontenc}%,T2A
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}%,russian
\usepackage{fourier, erewhon}

\usepackage[aftersep]{titlesec}
\titleformat{\section}{\normalfont\fontsize{16}{15}\bfseries\filcenter}{\thesection}{1em}{}
\titleformat{\subsection}[block]{\normalfont\fontsize{14}{15}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}[block]{\normalfont\fontsize{14}{15}}{\thesubsubsection}{1em}{}

\titlespacing{\section}{0pt}{10mm}{10mm}
\titlespacing{\subsection}{0pt}{25mm}{15mm}
\titlespacing{\subsubsection}{0pt}{25mm}{0.5\baselineskip}

\begin{document}

\section{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}\vspace{-4ex}

\subsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

\subsubsection{For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube}

For three years, car mechanic Paen Long stayed up long after his wife went to bed each night, spending countless hours watching videos on YouTube.

\end{document} 

在此处输入图片描述

相关内容