我为我的论文设置了以下章节格式:
% Selected packages from my pre-amble.
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{graphicx}
% Chapter format
\definecolor{myblue}{RGB}{0,82,155}
\titleformat{\chapter}[display]
{\normalfont\bfseries}
{\filleft\hspace*{-60pt}
\rotatebox[origin=c]{90}{%
\normalfont\color{black}\Large%
\textls[90]{\textsc{\chaptertitlename}}%
}\hspace{10pt}%
{\setlength\fboxsep{0pt}%
\colorbox{myblue}{\parbox[c][3cm][c]{2.5cm}{%
\centering\color{white}\fontsize{80}{90}\selectfont\thechapter}%
}}
}
{10pt}
{\titlerule[2.5pt]\vskip3pt\titlerule\huge}
得出以下结果:
但是,我希望将章节标题向上移动,如下所示:
我将不胜感激任何能够帮助我完成上述任务的贡献!
谢谢 :)
答案1
这是一个解决方案。请注意,block
样式更适合这种情况。接下来,您应该将水平规则添加为optional
的参数\titleformat
:
\documentclass[a4paper, 11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{graphicx}
% Chapter format
\definecolor{myblue}{RGB}{0,82,155}
\titleformat{\chapter}[block]
{\normalfont\bfseries}
{\rlap{\makebox[\linewidth][r]{%
\rotatebox[origin=c]{90}{%
\normalfont\color{black}\Large%
\textls[90]{\textsc{\chaptertitlename}}%
}\hspace{10pt}%
{\setlength\fboxsep{0pt}%
\colorbox{myblue}{\parbox[c][3cm][c]{2.5cm}{%
\centering\color{white}\fontsize{80}{90}\selectfont\thechapter}%
}}}%
}}
{0pt}
{\huge\parbox{\dimexpr\linewidth-4cm}}[{\medskip\titlerule[2.5pt]}\vskip3pt\titlerule]
\usepackage{lipsum}
\begin{document}
\chapter{Serious Title. Serious Title. Serious Title. Serious Title. Serious Title.}
\lipsum[1]
\end{document}