设置
我选择的“新章节”页面样式的代码如下
\documentclass[12pt,oneside]{book}
%********************************CHAPTER SETTINGS*********************
\usepackage[T1]{fontenc}
\usepackage{titlesec, blindtext, color} %remove blindtext after
\definecolor{gray75}{gray}{0.75} %1=white, 0=black
\newcommand{\hsp}{\hspace{20pt}} %spacing between line and text
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{\Huge\bfseries} %spacing across entire page
%----------------------------------BEGIN------------------------------
\begin{document}
\chapter{Less is More}
\blindtext
\chapter*{more is less}
\blindtext
%----------------------------------END------------------------------
\end{document}
问题
我可以添加什么来控制页面上标题的位置(即从页面顶部到“少即是多”的空白量)。我如何控制文本和数字的大小?
答案1
我使用format
第一部分{\Huge\bfseries}
作为预代码的钩子并插入了一些\vspace*
。请根据需要对其进行调整,并考虑解决方案是否可接受
\documentclass[12pt,oneside]{book}
%********************************CHAPTER SETTINGS*********************
\usepackage[T1]{fontenc}
\usepackage{titlesec, blindtext, color} %remove blindtext after
\definecolor{gray75}{gray}{0.75} %1=white, 0=black
\newcommand{\hsp}{\hspace{20pt}} %spacing between line and text
\titleformat{\chapter}[hang]{\vspace*{4em}\Huge\bfseries}{\thechapter\hsp\textcolor{gray75}{|}\hsp}{0pt}{} %spacing across entire page
%----------------------------------BEGIN------------------------------
\begin{document}
\chapter{Less is More}
\blindtext
\chapter*{more is less}
\blindtext
%----------------------------------END------------------------------
\end{document}
答案2
以下是一个示例\titlespacing*
(带星号的版本删除了第一个段落缩进)和缩放的章节编号。请注意,\Huge\bfseries
第一个参数对整个标题有效,不必在最后一个参数中重复:
\documentclass[12pt,oneside]{book}
%********************************CHAPTER SETTINGS*********************
\usepackage[showframe]{geometry}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{titlesec, blindtext, color} %remove blindtext after
\definecolor{gray75}{gray}{0.75} %1=white, 0=black
\newcommand{\hsp}{\hspace{20pt}} %spacing between line and text
\titleformat{\chapter}[hang]{\Huge\bfseries}{\scalebox{2}{\thechapter}\hsp\textcolor{gray75}{|}\hsp}{3pt}{} %spacing across entire page
\titlespacing*{\chapter}{0pt}{50pt}{80pt}
%----------------------------------BEGIN------------------------------
\begin{document}
\chapter{Less is More}
\blindtext
\chapter*{more is less}
\blindtext
%----------------------------------END------------------------------
\end{document}