% Modify behavior of standard LaTeX macros for book class
% to create a scribe format
% =======================================================
% \lecture{date}{scribe}{course number}{course name}{instructor name}

\newcounter{lecture}\def\thelecture{\arabic{lecture}}

\newcommand{\lecture}[5]{\refstepcounter{lecture}\clearpage\thispagestyle{plain}
\def\lecdate{#1}
\def\coursenumber{#3}
  \begingroup % Modification of definition of \@makechapterhead from book.cls
    \LARGE\bfseries\sffamily\relax\centering\interlinepenalty \@M
    \vspace*{-.325\baselineskip}
    \hrule height.2ex\vskip.25ex\hrule height.075ex\vskip1ex
    {\normalsize\bfseries\sffamily #3\ \ #4\hfill #1
    \\
    Lecture\ \thelecture}
    \\
    {\par \normalsize\bfseries\sffamily Lecturer: {\normalfont #5} \hfill Scribe: {\normalfont #2}}
    \\[1ex]
    \hrule height.075ex \vskip.25ex \hrule height.2ex \vskip1ex\par
  \endgroup}
% =======================================================
% Modify "headings" pagestyle
% Print Lecture # in headers

\def\ps@headings{\let\@mkboth\@gobbletwo
\def\@evenhead{\bfseries\sffamily \coursenumber \hfil Lecture~\thelecture \hfil \lecdate}
\let\@oddhead=\@evenhead
\def\@oddfoot{\bfseries\sffamily\hfil\thepage\hfil}
\let\@evenfoot=\@oddfoot}
\pagestyle{headings}
% =======================================================
\renewcommand\bibname{References}
% =======================================================
% Make \chapter NOT \cleardoublepage and DO indent
% first paragraph. Also do NOT set \thispagestyle{plain}

\renewcommand\chapter{%\if@openright\cleardoublepage\else\clearpage\fi
                   % \thispagestyle{plain}%
                    \global\@topnum\z@
                   % \@afterindentfalse
                    \secdef\@chapter\@schapter}
% =======================================================
% Modify display of chapter headings.

\renewcommand{\chaptername}{CHAPTER}
   
\def\@makechapterhead#1{\begingroup
\Large\bfseries\sffamily\relax\centering\interlinepenalty \@M
%\vspace*{-.325\baselineskip}
%\hrule height.2ex\vskip.25ex\hrule height.075ex\vskip1ex
        {\large\bfseries\sffamily  \chaptername\ \thechapter} \\ #1
\\[1ex]
%\hrule height.075ex \vskip.25ex \hrule height.2ex \vskip1ex\par
\endgroup}

\def\@makeschapterhead#1{\begingroup
\Large\bfseries\sffamily\relax\centering\interlinepenalty \@M
\vspace*{.325\baselineskip}
%\hrule height.2ex\vskip.25ex\hrule height.075ex\vskip1ex
         #1
\\[1ex]
%\hrule height.075ex \vskip.25ex \hrule height.2ex \vskip1ex\par
\endgroup}
% =======================================================