我在章节中使用这种格式
\usepackage{xcolor}
\usepackage{pstcol}
\makeatletter
\def\LigneVerticale{\vrule height 1.5cm depth 0.9cm\hspace{0.1cm}\relax}
\def\LignesVerticales{%
\let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
\def\GrosCarreAvecUnChiffre#1{%
\rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
\rlap{\hbox to 1cm{\hss\mbox{\white #1}\hss}}%
\vrule height 0pt width 1cm depth 0pt}
\def\GrosCarreAvecUnChiffres#1{{%
\color{white}%
\rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
%\rlap{\hbox to 1cm{\hss\mbox{\color{black}#1}\hss}}%
%\vrule height 0pt width 1cm depth 0pt}}
\hspace{-0.65cm}
}}
\def\@makechapterhead#1{
\vspace*{-20pt}
\hbox{%
\huge\bfseries
\LignesVerticales
\hspace{-0.62cm}%
\GrosCarreAvecUnChiffre{\thechapter}
\hspace{0.2cm}\hbox{#1}%
}\par\vskip 0.5cm}
\def\@makeschapterhead#1{
\vspace*{-20pt}
\hbox{%
\huge\bfseries
\LignesVerticales
\hspace{-0.62cm}%
\GrosCarreAvecUnChiffres{\thechapter}
\hspace{0.2cm}\hbox{#1}%
}\par\vskip 0.5cm}
\makeatother
内容总是在新页面上,但我想将其放在第一页的标题下。有人知道怎么做吗?
答案1
这只是一个猜测(因为没有给出 MWE):使用book
类和修补\tableofcontents
并\@maketitle
稍微删除\newpage
或\cleardoublepage
使用。
\documentclass[notitlepage]{book}
\usepackage{xcolor}
\usepackage{pstricks}
\usepackage{xpatch}
\usepackage{auto-pst-pdf}
\makeatletter
\AtBeginDocument{%
\xpretocmd{\tableofcontents}{%
\begingroup\let\cleardoublepage\relax
}{}{}
\xapptocmd{\tableofcontents}{%
\endgroup%
}{}{}
\xpatchcmd{\@maketitle}{\newpage\null}{}{}{}
}
\makeatother
\title{Theory of Brontosaurs}
\author{Ann Elk}
\date{\today}
\makeatletter
\def\LigneVerticale{\vrule height 1.5cm depth 0.9cm\hspace{0.1cm}\relax}
\def\LignesVerticales{%
\let\LV\LigneVerticale\LV\LV\LV\LV\LV\LV\LV\LV\LV\LV}
\def\GrosCarreAvecUnChiffre#1{%
\rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
\rlap{\hbox to 1cm{\hss\mbox{\white #1}\hss}}%
\vrule height 0pt width 1cm depth 0pt}
\def\GrosCarreAvecUnChiffres#1{{%
\color{white}%
\rlap{\vrule height 0.8cm width 1cm depth 0.2cm}%
%\rlap{\hbox to 1cm{\hss\mbox{\color{black}#1}\hss}}%
%\vrule height 0pt width 1cm depth 0pt}}
\hspace{-0.65cm}
}}
\def\@makechapterhead#1{
\vspace*{-20pt}
\hbox{%
\huge\bfseries
\LignesVerticales
\hspace{-0.62cm}%
\GrosCarreAvecUnChiffre{\thechapter}
\hspace{0.2cm}\hbox{#1}%
}\par\vskip 0.5cm}
\def\@makeschapterhead#1{
\vspace*{-20pt}
\hbox{%
\huge\bfseries
\LignesVerticales
\hspace{-0.62cm}%
\GrosCarreAvecUnChiffres{\thechapter}
\hspace{0.2cm}\hbox{#1}%
}\par\vskip 0.5cm}
\makeatother
\begin{document}
\maketitle
\tableofcontents
\chapter{First chapter}
\end{document}