我想使章节标题看起来像这样:
我将使用不同的字体,但想法是一样的。如果可能的话,我希望它像这样工作:
- 选择数字的大小(可以将其设置为任意大)。数字的顶部应始终与章节标题的顶部一致。
- 选择章节标题使用的字体大小。
- 将数字扩展至所需长度。(当然,所有章节的长度都相同。)
章节文本应如图所示环绕,但应适合页面顶部(如标准章节标题)。数字应与左边距齐平,整个块的宽度应为\textwidth
。您还应该能够更改从章节标题到其下方文本的距离。
编辑:这是我的部分解决方案:
\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{adjustbox}
\usepackage{multirow}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-5.0em}%
{\parindent \z@ \normalfont
\interlinepenalty\@M
\begin{table}[h]
\begin{tabular}{rl}
{\resizebox{1cm}{3cm}{\thechapter}} & \multicolumn{1}{l}{
{\fontsize{2cm}{0cm}
\selectfont\MakeUppercase{#1}}}
\end{tabular}
\end{table}
\par\vspace{3.5em}%
}}
\makeatother
\begin{document}
\chapter{Vectors and Kinematics -- A Few Mathematical Preliminaries}
\end{document}
输出如下:
我需要修复章节号的垂直对齐方式并使其与边距左对齐,并修复章节标题中的文本换行。
![在此处输入图片描述][3]
答案1
这里有一个使用一些更合适的低级命令的解决方案 - 但它有点麻烦,所以titlesec
可能是一种更好的方法。
\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\makeatletter
\def\@makechapterhead#1{\bgroup
\moveright-1in\vbox to 0pt{\hbox{}\vskip4pt\fontsize{86}{68}\selectfont\thechapter\par\vss}%
\parindent\z@\normalfont\fontsize{32}{36}\selectfont\raggedright%
\MakeUppercase{#1}
\par\egroup
\vskip36pt
}
\makeatother
\begin{document}
\chapter{Vectors and Kinematics -- A Few Mathematical Preliminaries}
In particular, any associated supporting element necessitates that urgent
consideration be applied to possible bidirectional logical relationship approaches.
Conversely, any associated supporting element recognizes other systems' importance
and the necessity for possible bidirectional logical relationship approaches.
However, a service-oriented paradigm is further compounded when taking into account
the evolution of specifications over a given time period.
\end{document}
答案2
我猜您希望数字与两行文本一样多;这是一种与字体大小无关的可能性(我使用了\Huge
)。数字在边距中。
请注意showframe
和lipsum
不是必需的;前者仅用于显示页面各个部分的边界。
\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{cmbright}
\usepackage{graphicx}
\usepackage{showframe,lipsum}
\makeatletter
\def\@makechapterhead#1{%
\begingroup\raggedright
\noindent\normalfont\Huge\selectfont
\setbox0=\vbox{A\par A}% measure two lines
\dimen0=\ht0 % save the height
\sbox0{A}% measure just one uppercase letter
\dimen2=\ht0 % save the height
\makebox[0pt][r]{%
% lower the box containing the chapter number
\raisebox{\dimexpr\dimen2-\dimen0\relax}[\dimen2][0pt]{%
% scale the chapter number to be as high as two lines of text
\resizebox{!}{\dimen0}{\thechapter}%
}\hspace{5mm}% some gap to the title
}%
% typeset the title
\MakeUppercase{#1}\par
\endgroup
\vspace{6ex}
}
\makeatother
\begin{document}
\chapter{Vectors and Kinematics -- A Few Mathematical Preliminaries}
\lipsum[1]
\end{document}