请查看工作示例
\documentclass[12pt,reqno]{amsart} \usepackage[T1]{fontenc} \setlength{\textheight}{23cm} \setlength{\textwidth}{16cm} \setlength{\topmargin}{-0.8cm} \setlength{\parskip}{0.3\baselineskip} \hoffset=-1.4cm \usepackage{amssymb} \usepackage[mathscr]{eucal} \usepackage{amsmath} \usepackage[all]{xy} \usepackage{lineno} \usepackage{epsfig} \usepackage{amscd} \usepackage{mathrsfs}
\usepackage{hyperref} \usepackage[nameinlink]{cleveref} \usepackage[thinc]{esdiff} %\usepackage[all]{xy} \usepackage{tikz-cd} \usepackage[normalem]{ulem} \newcommand{\ms}{\medskip} \renewcommand{\arraystretch}{-1.7} \newcommand{\toto}{\rightrightarrows}
\usepackage{xcolor}
\newcounter{lecnum} \renewcommand{\thepage}{\thelecnum-\arabic{page}} \renewcommand{\thesection}{\thelecnum.\arabic{section}} \renewcommand{\theequation}{\thelecnum.\arabic{equation}} \renewcommand{\thefigure}{\thelecnum.\arabic{figure}} \renewcommand{\thetable}{\thelecnum.\arabic{table}}
% % The following macro is used to generate the header. % \newcommand{\lecture}[4]{ \pagestyle{myheadings} \thispagestyle{plain} \newpage \setcounter{lecnum}{#1} \setcounter{page}{1} \noindent \begin{center} \framebox{ \vbox{\vspace{2mm}
\hbox to 6.28in { {\bf MT2223: Real analysis-I
\hfill Jan-May 2022} }
\vspace{4mm}
\hbox to 6.28in { {\Large \hfill \bf Lecture #1 \hfill} }
\vspace{2mm}
\hbox to 6.28in { {Date: #2 \hfill Course instructor: Praphulla Koushik} }
\vspace{2mm}} } \end{center} \markboth{Lecture #1: #2}{Lecture #1: #2} } % % Convention for citations is authors' initials followed by the year. % For example, to cite a paper by Leighton and Maggs you would type % \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}. % (To avoid bibliography problems, for now we redefine the \cite command.) % Also commands that create a suitable format for the reference list. \renewcommand{\cite}[1]{[#1]} \def\beginrefs{\begin{list}% {[\arabic{equation}]}{\usecounter{equation} \setlength{\leftmargin}{2.0truecm}\setlength{\labelsep}{0.4truecm}% \setlength{\labelwidth}{1.6truecm}}} \def\endrefs{\end{list}} \def\bibentry#1{\item[\hbox{[#1]}]}
%Use this command for a figure; it puts a figure in wherever you want it. %usage: \fig{NUMBER}{SPACE-IN-INCHES}{CAPTION} \newcommand{\fig}[3]{ \vspace{#2} \begin{center} Figure \thelecnum.#1:~#3 \end{center} } % Use these for theorems, lemmas, proofs, etc.
\newtheorem{theorem}{Theorem}[lecnum] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{claim}[theorem]{Claim} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{exercise}[theorem]{Exercise} \newtheorem{construction}[theorem]{Construction} \newtheorem{question}[theorem]{Question} \newtheorem*{note}{Note}
\linenumbers
\numberwithin{equation}{section}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\mc}{\mathcal} \newcommand{\mb}{\mathbb} \newcommand{\mf}{\mathfrak} \newcommand{\xra}{\xrightarrow} \newcommand{\ra}{\rightarrow} \newcommand{\rra}{\rightrightarrows}
\def\og{\leavevmode\raise.3ex\hbox{$\scriptscriptstyle\langle\!\langle$~}} \def\fg{\leavevmode\raise.3ex\hbox{~$\!\scriptscriptstyle\,\rangle\!\rangle$}}
\begin{document} \title {Real analysis I}
\author[Praphulla Koushik]{Praphulla Koushik} \today \maketitle \addtocontents{toc}{\setcounter{tocdepth}{1}}
{\bf Note}: {\it LaTeX template courtesy of UC Berkeley EECS dept.}
{\bf Disclaimer}: {\it These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Instructor.}
\lecture{1}{today}123 \end{document}
我从https://www.cs.cmu.edu/~ggordon/10725-F12/template.tex并做了一些小的改动,得到了上面的例子。
我想获取基于讲座的目录。如果我输入 \tableofcontents,则不会得到任何结果。
请告诉我如何获取它。
答案1
更新在后续问题之后。
由于您想要制作一个包含讲座集合和相应列表(讲座)的文档,一种方法是使用类article
和tocloft
包来定义讲座列表。
\lecture
它定义了具有两个参数的宏\lecture{<id number>}{<date>}
来格式化每个讲座的标题。
课程名称、学期和导师姓名在宏之外加载使用:
\newcommand{\CourseName}{MT2223: Real analysis-I}
\newcommand{\CourseSemester}{Jan-May 2022}
\newcommand{\CourseInstructor}{Praphulla Koushik}
在类中添加地址和电子邮件信息的方法article
是将它们放在作者姓名之后,用\\
类似
\author{Praphulla Koushik\\[10pt]
Department of Mathematics\\ Some University \\ Some place\\[10pt]% add address and mail here <<<<<<<<<<<<<<<<<<<
\href{mailto:[email protected]}{[email protected]}\\[10pt]
My Academic Page:\ \url{https://myacademicpage.com} % other information
}
这是完整的代码。
% !TeX TS-program = pdflatex
\documentclass[12pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[left=2.50cm, right=2.50cm, top=3.00cm, bottom=2.00cm]{geometry}
\usepackage{xcolor}
\usepackage{tocloft} % added <<<<<<<<<<<<<<<<<<<<<<
\usepackage{kantlipsum} % only to add dummy tex <<<<<<<<<<
\usepackage{amssymb}
\usepackage[mathscr]{eucal}
\usepackage{amsmath}
\usepackage[all]{xy}
\usepackage{lineno}
\usepackage{epsfig}
\usepackage{amscd}
\usepackage{mathrsfs}
\usepackage[thinc]{esdiff}
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue,breaklinks]{hyperref} % changed <<<<<<
\usepackage[nameinlink]{cleveref}
%%******************************************************************** Changed
\newcommand{\CourseName}{MT2223: Real analysis-I} % fill <<<<<<<<<<<<<<<<<<<<<<<
\newcommand{\CourseSemester}{Jan-May 2022} % fill <<<<<<<<<<<<<<<<<<<<<<<
\newcommand{\CourseInstructor}{Praphulla Koushik} % fill <<<<<<<<<<<<<<<<<<<<<<<
\newcommand{\listlecturename}{List of Lectures \hfill {\footnotesize Page \par}} % title of the list <<<<<<<<<<<<<<<<
\newlistof[chapter]{lecture}{lec}{\listlecturename} % define list of lectures
\newcounter{lecnum}
\renewcommand{\thepage}{\thelecnum-\arabic{page}}
\renewcommand{\thesection}{\thelecnum.\arabic{section}}
\renewcommand{\theequation}{\thelecnum.\arabic{equation}}
\renewcommand{\thefigure}{\thelecnum.\arabic{figure}}
\renewcommand{\thetable}{\thelecnum.\arabic{table}}
\newcommand{\lecture}[2]{% changed <<<<<<<<<<<<<<<< use as \lecture{number}{date}
\pagestyle{myheadings}
\newpage
\setcounter{lecnum}{#1}
\setcounter{page}{1}
\refstepcounter{lecture}
\addcontentsline{lec}{lecture}{Lecture~#1:~#2}
\noindent
\fbox{%
\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
\centering\vspace{2mm}
{\bfseries\CourseName \hfill \CourseSemester
\vspace{4mm}\\
\Large \hfill Lecture #1 \hfill }
\vspace{4mm}\\
{\normalfont Date: #2 \hfill Course instructor:~\CourseInstructor}
\vspace{2mm}
\end{minipage}
} % end fbox
\markboth{Lecture #1: #2}{Lecture #1: #2}
\setcounter{section}{0}% reset counters
\setcounter{figure}{0}
\setcounter{table}{0}
\setcounter{equation}{0}
} % end lecture
%%********************************************************************
\begin{document}
\title{Real analysis I}
\author{Praphulla Koushik\\[10pt]
Department of Mathematics\\ Some University \\ Some place\\[10pt]% add address and mail here <<<<<<<<<<<<<<<<<<<
\href{mailto:[email protected]}{[email protected]}\\[10pt]
My Academic Page:\ \url{https://myacademicpage.com} % other information
}
\date{\today}
\maketitle
\vfill
\noindent\textbf{Note}: \emph{\textit LaTeX template courtesy of the Department of Mathematics of Some University.}
\noindent\textbf{Disclaimer}: \emph{These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distribute outside this class only with the permission of the Instructor.}
\thispagestyle{empty}
\newpage
\listoflecture % list of lectures
\thispagestyle{empty}\clearpage
\lecture{1}{February 21}
\section{Introduction}
1. \kant[1]
\lecture{2}{April 1\textsuperscript{st}}
\section{Numbers}
2. \kant[2]
\lecture{3}{July 4\textsuperscript{th}}
\section{Functions}
3. \kant[3-8]
\end{document}
答案2
问题就在于这部分:明智地使用它。
% % The following macro is used to generate the header.
% \newcommand{\lecture}[4]{ \pagestyle{myheadings} \thispagestyle{plain} \newpage \setcounter{lecnum}{#1} \setcounter{page}{1} \noindent \begin{center} \framebox{ \vbox{\vspace{2mm}
\hbox to 6.28in { {\bf MT2223: Real analysis-I
\hfill Jan-May 2022} }
\vspace{4mm}
\hbox to 6.28in { {\Large \hfill \bf Lecture #1 \hfill} }
\vspace{2mm}
\hbox to 6.28in { {Date: #2 \hfill Course instructor: Praphulla Koushik} }
\vspace{2mm}} } \end{center} \markboth{Lecture #1: #2}{Lecture #1: #2} }
你要么对整件事发表评论,要么不发表评论。
尝试使用这个宏:
\documentclass[12pt,reqno]{amsart} \usepackage[T1]{fontenc} \setlength{\textheight}{23cm} \setlength{\textwidth}{16cm} \setlength{\topmargin}{-0.8cm} \setlength{\parskip}{0.3\baselineskip} \hoffset=-1.4cm \usepackage{amssymb} \usepackage[mathscr]{eucal} \usepackage{amsmath} \usepackage[all]{xy} \usepackage{lineno} \usepackage{epsfig} \usepackage{amscd} \usepackage{mathrsfs}
\usepackage{hyperref} \usepackage[nameinlink]{cleveref} \usepackage[thinc]{esdiff} %\usepackage[all]{xy} \usepackage{tikz-cd} \usepackage[normalem]{ulem} \newcommand{\ms}{\medskip} \renewcommand{\arraystretch}{-1.7} \newcommand{\toto}{\rightrightarrows}
\usepackage{xcolor}
\newcounter{lecnum} \renewcommand{\thepage}{\thelecnum-\arabic{page}} \renewcommand{\thesection}{\thelecnum.\arabic{section}} \renewcommand{\theequation}{\thelecnum.\arabic{equation}} \renewcommand{\thefigure}{\thelecnum.\arabic{figure}} \renewcommand{\thetable}{\thelecnum.\arabic{table}}
% % The following macro is used to generate the header.
\newcommand{\lecture}[4]{ \pagestyle{myheadings} \thispagestyle{plain} \newpage \setcounter{lecnum}{#1} \setcounter{page}{1} \noindent \begin{center} \framebox{ \vbox{\vspace{2mm}
\hbox to 6.28in { {\bf MT2223: Real analysis-I
\hfill Jan-May 2022} }
\vspace{4mm}
\hbox to 6.28in { {\Large \hfill \bf Lecture #1 \hfill} }
\vspace{2mm}
\hbox to 6.28in { {Date: #2 \hfill Course instructor: Praphulla Koushik} }
\vspace{2mm}} } \end{center} \markboth{Lecture #1: #2}{Lecture #1: #2} } % % Convention for citations is authors' initials followed by the year. % For example, to cite a paper by Leighton and Maggs you would type % \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}. % (To avoid bibliography problems, for now we redefine the \cite command.) % Also commands that create a suitable format for the reference list. \renewcommand{\cite}[1]{[#1]} \def\beginrefs{\begin{list}% {[\arabic{equation}]}{\usecounter{equation} \setlength{\leftmargin}{2.0truecm}\setlength{\labelsep}{0.4truecm}% \setlength{\labelwidth}{1.6truecm}}} \def\endrefs{\end{list}} \def\bibentry#1{\item[\hbox{[#1]}]}
%Use this command for a figure; it puts a figure in wherever you want it. %usage: \fig{NUMBER}{SPACE-IN-INCHES}{CAPTION} \newcommand{\fig}[3]{ \vspace{#2} \begin{center} Figure \thelecnum.#1:~#3 \end{center} } % Use these for theorems, lemmas, proofs, etc.
\newtheorem{theorem}{Theorem}[lecnum] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{claim}[theorem]{Claim} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{exercise}[theorem]{Exercise} \newtheorem{construction}[theorem]{Construction} \newtheorem{question}[theorem]{Question} \newtheorem*{note}{Note}
\linenumbers
\numberwithin{equation}{section}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\mc}{\mathcal} \newcommand{\mb}{\mathbb} \newcommand{\mf}{\mathfrak} \newcommand{\xra}{\xrightarrow} \newcommand{\ra}{\rightarrow} \newcommand{\rra}{\rightrightarrows}
\def\og{\leavevmode\raise.3ex\hbox{$\scriptscriptstyle\langle\!\langle$~}} \def\fg{\leavevmode\raise.3ex\hbox{~$\!\scriptscriptstyle\,\rangle\!\rangle$}}
\begin{document} \title {Real analysis I}
\author[Praphulla Koushik]{Praphulla Koushik} \today \maketitle \addtocontents{toc}{\setcounter{tocdepth}{1}}
{\bf Note}: {\it LaTeX template courtesy of UC Berkeley EECS dept.}
{\bf Disclaimer}: {\it These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Instructor.}
\lecture{1}{today}123 \end{document}
避免这种情况以抑制该宏:
\documentclass[12pt,reqno]{amsart} \usepackage[T1]{fontenc} \setlength{\textheight}{23cm} \setlength{\textwidth}{16cm} \setlength{\topmargin}{-0.8cm} \setlength{\parskip}{0.3\baselineskip} \hoffset=-1.4cm \usepackage{amssymb} \usepackage[mathscr]{eucal} \usepackage{amsmath} \usepackage[all]{xy} \usepackage{lineno} \usepackage{epsfig} \usepackage{amscd} \usepackage{mathrsfs}
\usepackage{hyperref} \usepackage[nameinlink]{cleveref} \usepackage[thinc]{esdiff} %\usepackage[all]{xy} \usepackage{tikz-cd} \usepackage[normalem]{ulem} \newcommand{\ms}{\medskip} \renewcommand{\arraystretch}{-1.7} \newcommand{\toto}{\rightrightarrows}
\usepackage{xcolor}
\newcounter{lecnum} \renewcommand{\thepage}{\thelecnum-\arabic{page}} \renewcommand{\thesection}{\thelecnum.\arabic{section}} \renewcommand{\theequation}{\thelecnum.\arabic{equation}} \renewcommand{\thefigure}{\thelecnum.\arabic{figure}} \renewcommand{\thetable}{\thelecnum.\arabic{table}}
% % The following macro is used to generate the header.
% \newcommand{\lecture}[4]{ \pagestyle{myheadings} \thispagestyle{plain} \newpage \setcounter{lecnum}{#1} \setcounter{page}{1} \noindent \begin{center} \framebox{ \vbox{\vspace{2mm}
%\hbox to 6.28in { {\bf MT2223: Real analysis-I
%\hfill Jan-May 2022} }
%\vspace{4mm}
%\hbox to 6.28in { {\Large \hfill \bf Lecture #1 \hfill} }
%\vspace{2mm}
% \hbox to 6.28in { {Date: #2 \hfill Course instructor: Praphulla Koushik} }
% \vspace{2mm}} } \end{center} \markboth{Lecture #1: #2}{Lecture #1: #2} } % % Convention for citations is authors' initials followed by the year. % For example, to cite a paper by Leighton and Maggs you would type % \cite{LM89}, and to cite a paper by Strassen you would type \cite{S69}. % (To avoid bibliography problems, for now we redefine the \cite command.) % Also commands that create a suitable format for the reference list. \renewcommand{\cite}[1]{[#1]} \def\beginrefs{\begin{list}% {[\arabic{equation}]}{\usecounter{equation} \setlength{\leftmargin}{2.0truecm}\setlength{\labelsep}{0.4truecm}% \setlength{\labelwidth}{1.6truecm}}} \def\endrefs{\end{list}} \def\bibentry#1{\item[\hbox{[#1]}]}
%Use this command for a figure; it puts a figure in wherever you want it. %usage: \fig{NUMBER}{SPACE-IN-INCHES}{CAPTION} \newcommand{\fig}[3]{ \vspace{#2} \begin{center} Figure \thelecnum.#1:~#3 \end{center} } % Use these for theorems, lemmas, proofs, etc.
\newtheorem{theorem}{Theorem}[lecnum] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{claim}[theorem]{Claim} \newtheorem{corollary}[theorem]{Corollary} \newtheorem{definition}[theorem]{Definition} \newtheorem{example}[theorem]{Example} \newtheorem{exercise}[theorem]{Exercise} \newtheorem{construction}[theorem]{Construction} \newtheorem{question}[theorem]{Question} \newtheorem*{note}{Note}
\linenumbers
\numberwithin{equation}{section}
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\mc}{\mathcal} \newcommand{\mb}{\mathbb} \newcommand{\mf}{\mathfrak} \newcommand{\xra}{\xrightarrow} \newcommand{\ra}{\rightarrow} \newcommand{\rra}{\rightrightarrows}
\def\og{\leavevmode\raise.3ex\hbox{$\scriptscriptstyle\langle\!\langle$~}} \def\fg{\leavevmode\raise.3ex\hbox{~$\!\scriptscriptstyle\,\rangle\!\rangle$}}
\begin{document} \title {Real analysis I}
\author[Praphulla Koushik]{Praphulla Koushik} \today \maketitle \addtocontents{toc}{\setcounter{tocdepth}{1}}
{\bf Note}: {\it LaTeX template courtesy of UC Berkeley EECS dept.}
{\bf Disclaimer}: {\it These notes have not been subjected to the usual scrutiny reserved for formal publications. They may be distributed outside this class only with the permission of the Instructor.}
%\lecture{1}{today}123
\end{document}
在这种情况下您不能使用此命令:%\lecture{1}{today}123
。