章节标题格式

章节标题格式

有人能向我解释一下如何让一个部分看起来像这样吗在此处输入图片描述和这个在此处输入图片描述 我真的很难做到这一点,我不确定我是否应该使用 titlesec 或 titleformat,尤其是对于右边有一个大 1 的图片。我真的很想知道如何完成图片 2。有谁能帮我吗?非常感谢。这当然是在 LaTeX 中。

答案1

以下是两个示例解决方案,改编自的代码\chapter。对于这种布局,我必须更改的类,\section 以便新部分开始新的页面,并从页面顶部开始:

\documentclass[11pt, a4paper]{article}% http://ctan.org/pkg/amsproc

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier, erewhon}
\usepackage[showframe]{geometry}
\usepackage[x11names]{xcolor}

\usepackage[]{titlesec}%

\titleclass{\section}{top}
\titleformat{\section}[display]
{\filleft\bfseries}
{\fontsize{72}{75}\selectfont\color{SlateGray3}\thesection}
{8ex}
{\LARGE}%
\titlespacing*{\section}{0pt}{-8ex}{12ex}

\begin{document}

\section {The History of the Seven Families}%

           In former days – that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.

\end{document} 

在此处输入图片描述

\documentclass[11pt, a4paper]{article}% http://ctan.org/pkg/amsproc

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier, erewhon}
\usepackage[showframe]{geometry}
\usepackage[x11names]{xcolor}

\usepackage[]{titlesec}%

\titleclass{\section}{top}

\titleformat{\section}[display]
{\filleft\bfseries}
{\Huge\color{SlateGray3}\raisebox{-0.5\height}{\thesection}\enspace \titlerule[1pt]}
{6ex}
{\LARGE}[\vspace{4.5ex}{\color{SlateGray3}\titlerule[1pt]}]%
\titlespacing*{\section}{0pt}{-6ex}{12ex}

\begin{document}

\section {The History of the Seven Families}%

           In former days – that is to say, once upon a time, there lived in the Land of Gramblamble, Seven Families. They lived by the side of the great Lake Pipple-popple (one of the Seven Families, indeed, lived in the Lake), and on the outskirts of the City of Tosh, which, excepting when it was quite dark, they could see plainly. The names of all these places you have probably heard of, and you have only not to look in your Geography books to find out all about them.

\end{document} 

在此处输入图片描述

编辑:

目录标题的格式可以与上面的不同,使用\titleformat,带有numberless键,因为目录、参考资料等在文章类中被实现为未编号的部分。只需将此代码添加到您的序言中:

\titleformat{name = \section, numberless}[block]
{\filright}
{}
{0pt}
{\huge\textbf}%
\titlespacing*{name = \section, numberless}{0pt}{-4ex}{12ex}

在此处输入图片描述

相关内容