如何更改节间距文章类

如何更改节间距文章类

我希望所有章节标题和正文都按照以下规则间隔。我使用 article 类。

前空格:0pt

后空格:文本大小的 50–100%

行距 = 文本大小的 135%

如何才能做到这一点?

编辑:平均能量损失

\documentclass[12pt, oneside, a4paper]{article}
\usepackage{titlesec}%                          Define titles and spacing
\usepackage{lipsum}
\usepackage{fontspec}%                          Font specification
\usepackage{sectsty}%                               Section font
\usepackage{xcolor}%                                For colored things
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Font Declaration
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setmainfont{Futura Book.ttf}[
BoldFont = Futura Book Bold.ttf,
ItalicFont = Futura Book Italic BT.ttf,
BoldItalicFont = Futura Book Bold Italic.ttf]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Section Color.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionfont{\color{blue}}
\subsectionfont{\color{gray}}
\subsubsectionfont{\color{gray}}
\paragraphfont{\color{gray}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Titlesec Customizations 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
\titlespacing{\section}{0pt}{0pt}{0pt}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\titlespacing{\subsubsection}{0pt}{0pt}{0pt}        

\begin{document}
\section{A Section}
\lipsum[1]
\subsection{Sub-Section}
\lipsum[2]
\end{document}

我在想,为什么需要 MWE?但是在创建这个 MWE 时,我意识到titlesec和之间有些不一致sectsty。如果我注释掉section color序言中的说明,titlesec就会生效。

谢谢阿恩建议 MWE。

我需要彩色的章节标题和紧密的间距。帮忙吗?

答案1

我将答案更改为以下代码:

\documentclass{article}
\usepackage{ipsum}
\linespread{1.35}
\usepackage{titlesec}
\usepackage{xcolor}%                                For colored things
\usepackage{fontspec}%                          Font specification



\titleformat{\section}%
{\normalfont\Large\color{blue}}% format applied to label+text
{\parbox{1.1cm}{\thesection}}% label
{5pt}
{}


\titleformat{\subsection}%
{\normalfont\Large\color{gray}}% format applied to label+text
{\parbox{1.1cm}{\thesubsection}}% label
{5pt}
{}

\titlespacing\section{0pt}{-5pt plus 4pt minus 2pt}{0pt plus 2pt minus 20pt} %the -5pt is space before, experiment with the numbers
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}
\section{Section}
\lipsum[1]
\section{Section}
\subsection{test}
\lipsum[2]
\end{document}

导致 : 在此处输入图片描述

Futura 字体不适合我。希望我能够满足您的需求

相关内容