我正在使用该report
课程来编写一本书,并希望将章节标题分布在多行上,并能够为每行选择字体大小。
\documentclass{report}
\makeatletter
\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \center \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \center
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
\chapter*{\textbf{ŚirīharṣaMahākaviPraṇītam\\Naiṣadhīyacaritam\\Saralavyākhyāsahitam\\prathamaḥ sargaḥ}}
%Want to set different font sizes for different lines as below:
{\small ŚirīharṣaMahākaviPraṇītam}\\
{\Huge Naiṣadhīyacaritam}\\
Saralavyākhyāsahitam\\
{\Large prathamaḥ sargaḥ}
\end{document}
这该怎么做?我不想更改,documentclass
因为这可能会导致我的文档(已有约 600 页)发生其他未知更改。
答案1
您几乎自己已经给出了答案。
% chapterprob.tex SE 596976
\documentclass{report}
\makeatletter
\def\@makechapterhead#1{%
%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \center \normalfont
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\def\@makeschapterhead#1{%
%%%%%\vspace*{50\p@}% %%% removed!
{\parindent \z@ \center
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\makeatother
\begin{document}
%\chapter*{\textbf{ŚirīharṣaMahākaviPraṇītam\\Naiṣadhīyacaritam\\Saralavyākhyāsahitam\\prathamaḥ sargaḥ}}
\chapter*{\textbf{{\small ŚirīharṣaMahākaviPraṇītam}\\
{\Huge Naiṣadhīyacaritam}\\
{\normalsize Saralavyākhyāsahitam}\\
{\Large prathamaḥ sargaḥ}}}
%Want to set different font sizes for different lines as below:
{\small ŚirīharṣaMahākaviPraṇītam}\\
{\Huge Naiṣadhīyacaritam}\\
Saralavyākhyāsahitam\\
{\Large prathamaḥ sargaḥ}
\end{document}