在文档的不同页面上有两个具有相同样式的标题

在文档的不同页面上有两个具有相同样式的标题

我有一个文档,它结合了多个文档:例如,Pathoanatomy 和 Pathophysiology。我想从正文开始一个新文档,例如

\documentclass{article}
\begin{document}
\title{Introduction to Pathoanatomy Notes}
\begin{titlepage}
\maketitle
\end{titlepage}

% first document
 ...
% second document in the some body
\title{Introduction to Pathophysiology Notes}
\begin{titlepage}
\maketitle
\end{titlepage}
...
\end{document}

输出是正确的,但是风格没有保留。

您怎样才能做同样的事情但又保持第二个标题的标题页的风格呢?

答案1

不需要任何\renewcommands,该titling包已经提供了此功能:

\documentclass{article}
\usepackage{titling}
\title{Some Title}
\author{Uwe Ziegenhagen}
\date{01.01.1901}
\usepackage{blindtext}

\begin{document}

\maketitle

\blindtext[5]

\title{Second item}


\maketitle

\blindtext[5]


\end{document}

在此处输入图片描述

答案2

一种选择是防止\maketitleing \@empty,,,\@author等等\@title\@date以下是代码:

\documentclass{article}

\makeatletter
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    }
  \if@titlepage
  \renewcommand\maketitle{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
}
\else
\renewcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@[email protected]{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
}
\makeatother

\begin{document}
\title{Introduction to Pathoanatomy Notes}
\author{The Author A}
\begin{titlepage}
\maketitle
\end{titlepage}

\title{Another Title}
\author{The Author B}
\begin{titlepage}
\maketitle
\end{titlepage}

\end{document}

在此处输入图片描述

答案3

您可以使用titling包来执行此操作。此答案展示了如何使用该包中的命令将标题放入标题中fancyhdr以及如何扩展包以支持字幕。

\documentclass{article}
\usepackage{titling}

\usepackage{fancyhdr}% just for fun - if you are using a class which doesn't like this, just leave it out
  \fancyhf{}
  \fancyhf[ch]{\scshape \thetitle}
  \fancyhf[cf]{\thepage}
  \renewcommand{\headrulewidth}{0pt}
  \pagestyle{fancy}

% if you would like a subtitle as well
\makeatletter
   \newcommand{\my@presubtitle}{}
    \newcommand{\my@postsubtitle}{}
    \newcommand{\thesubtitle}{}
    \let\thesubtitle\@empty
    \newcommand{\presubtitle}[1]{%
            \renewcommand{\my@presubtitle}{#1}}
    \newcommand{\postsubtitle}[1]{%
            \renewcommand{\my@postsubtitle}{#1}}
    \newcommand{\subtitle}[1]{%
            \renewcommand\thesubtitle{#1}%
            \renewcommand{\maketitlehookb}{%
                    \par\noindent \my@presubtitle\thesubtitle\my@postsubtitle}}
    \presubtitle{\begin{center}\Large}
    \postsubtitle{\par\end{center}}
    \renewcommand{\maketitlehookb}{\presubtitle \subtitle \postsubtitle}
\makeatother

\usepackage{kantlipsum}% just for sample text - don't use for real!

\begin{document}
\title{Introduction to Pathoanatomy Notes}
\subtitle{A Guide for the Perplexed}
\begin{titlingpage}% Note that this environment differs from titlepage - see package documentation for details
\maketitle
\end{titlingpage}
% first document
\kant[1-5]\clearpage

% second document in the some body
\title{Introduction to Pathophysiology Notes}
\subtitle{Anatomy for the Adventurous}
\begin{titlingpage}
\maketitle
\end{titlingpage}
\kant[6-10]

\end{document}

带字幕的多个标题页

相关内容