标题横跨两页;第二页及以后的标题不同

标题横跨两页;第二页及以后的标题不同

我想创建一个 LaTeX 模板,它将产生以下 PDF 输出:

在此处输入图片描述

我尝试了各种方法,但仍然失败将标题页分布在两页布局中如上所示。我还想在直线下方添加姓名、课程标题和日期(如上所示),并在底部中间显示页码(再次忽略全局双页布局设置)。


第二页及以后,我想要一个不同的标题页眉,左边是名称,中间是讲义的标题,右边是日期,如下所示:

在此处输入图片描述

我是 LaTeX 新手,因此非常希望得到任何帮助或建议。谢谢!

答案1

我不知道你把标题、作者和日期存储在哪里,因此我为此创建了新的宏,它还允许使用标题和作者姓名的简短版本。但当然,你可以根据自己的喜好进行调整。表格环境的使用基于以下问题的答案中的建议这个问题

\documentclass{article}
\usepackage[landscape, a4paper, twocolumn, margin=3cm, columnsep=2cm,
    headheight=1.5cm, top=3.5cm, headsep=.5cm]{geometry}
\usepackage{array, booktabs, afterpage}

\newcommand{\mytitle}[2][]{%
    \newcommand{\myshorttitle}{#1}%
    \newcommand{\mylongtitle}{#2}%
}

\newcommand{\myauthor}[2][]{%
    \newcommand{\myshortauthor}{#1}%
    \newcommand{\mylongauthor}{#2}%
}

\newcommand{\mynumberdate}[2]{%
    \newcommand{\mynumber}{#1}%
    \newcommand{\mydate}{#2}%
}

\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[C]{\thepage}
\fancyhead[L]{%
    \begin{tabular}{ @{} p{.333\textwidth} 
                     @{} >{\centering}p{.333\textwidth} 
                     @{} >{\raggedleft\arraybackslash}p{.333\textwidth} @{} }
        \myshortauthor & \myshorttitle & \mydate \\ \midrule
    \end{tabular}%
}
\fancypagestyle{fancyfirstpage}{%
    \fancyhf{}
    \fancyfoot[C]{\thepage}
    \fancyhead[L]{%
        \begin{tabular}{ @{} p{.5\textwidth} 
                         @{} >{\raggedleft\arraybackslash}p{.5\textwidth} @{} }
            \textbf{\mylongtitle} & \\ \midrule
            \mylongauthor & \mynumber \\ & \mydate 
        \end{tabular}%
    }
}    
\pagestyle{fancy}

\usepackage{lipsum}

\begin{document}
\thispagestyle{fancyfirstpage}

\mytitle[Meaning of Life]{An Introduction to the Meaning of Life}
\myauthor[Smith]{Mary Smith}
\mynumberdate{PHIL1001}{1 January 2021}

\lipsum[1-10]

\end{document}

在此处输入图片描述 在此处输入图片描述

相关内容