答案1
这使用文章类。
\documentclass{article}
\usepackage{tikz}
\usepackage{datetime}
\mdyyyydate
%\usepackage{showframe}
\newcommand{\thelecture}{1}
\renewcommand{\thesection}{\thelecture.\arabic{section}}
\renewcommand{\thefigure}{\thelecture.\arabic{figure}}
\begin{document}
\noindent\begin{tikzpicture}
\node[draw, inner ysep=.3cm] (title) {\parbox{\dimexpr \textwidth-.667em}{\centering \textbf{\Large Lecture \thelecture}\\
\textit{Introduction}}};
\node[fill=white, right=2pt] at (title.north west) {\footnotesize\today};
\end{tikzpicture}
\end{document}
此版本使用\chapter
和\thechapter
进行讲座。请注意,目录从新页面开始。
\documentclass{report}
\usepackage{tikz}
%\usepackage{showframe}% alignment tool
\makeatletter
\newcommand*{\lecturedate}[1]{\edef\@lecturedate{#1}}
\def\chaptername{Lecture}
\def\@makechapterhead#1{%
\noindent\begin{tikzpicture}
\node[draw, inner ysep=.3cm] (title) {\parbox{\dimexpr \textwidth-.667em}{\centering \textbf{\Large\chaptername~\thechapter}\\
\textit{#1}}};
\node[fill=white, right=2pt] at (title.north west) {\footnotesize\@lecturedate};
\end{tikzpicture}\par\bigskip
}
\makeatother
\begin{document}
\setcounter{chapter}{0}% will be incremented
\lecturedate{1/1/2001}
\chapter{Introduction}
\tableofcontents
\section{First}
\section{Second}
\begin{figure}[h]
\caption{test}
\end{figure}
\end{document}