用于编写课堂笔记的文档类

用于编写课堂笔记的文档类

我想了解文档类别,以便记录我将用于所教课程的讲义和作业问题。

我希望您在这方面提出宝贵的建议。

答案1

这取决于您希望您的讲座笔记是什么样子!通常,我使用article文档类amsthm和其他 AMS 包。当我输入从别人的讲座中记下的笔记时,我还会将以下宏添加到我的文档标题中:

\documentclass{article}
\usepackage{amsthm}

\makeatletter
\def\lecture{\@ifnextchar[{\@lectureWith}{\@lectureWithout}}
\def\@lectureWith[#1]{\medbreak\refstepcounter{section}%
  \renewcommand{\leftmark}{Lecture \thesection}
  \noindent{\addcontentsline{toc}{section}{Lecture \thesection: #1\@addpunct{.}}%
  \sectionfont Lecture \thesection. #1\@addpunct{.}}\medbreak}
\def\@lectureWithout{\medbreak\refstepcounter{section}%
  \renewcommand{\leftmark}{Lecture \thesection}
  \noindent{\addcontentsline{toc}{section}{Lecture \thesection.}%
  \sectionfont Lecture \thesection.}\medbreak}
\makeatother

\title{Long Boring Lectures on 0-dimensional Manifolds}
\author{Alex Nelson}
\begin{document}
\maketitle

\lecture % it's ok for it to not take any arguments
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat 
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\lecture[I'M BRILLIANT] % It can also take an argument
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis 
praesentium voluptatum deleniti atque corrupti quos dolores et quas 
molestias excepturi sint occaecati cupiditate non provident, similique sunt in 
culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et 
harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum 
soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime 
placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
 Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus 
saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. 
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis 
voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
\end{document}

在此处输入图片描述

练习附录

我要分享的这些宏并不是最好的,但由于我的懒惰,它们是我所拥有的最好的。

我在笔记中运用了练习和问题。“问题”通常是“我问自己的激励问题,以引导读者想要进入下一节,但首先尝试自己得出一些东西”——有点像带有“剧透警告”的练习,其解决方案将随后出现。

我只是用它们amsthm来:

\theoremstyle{theorem}
\newtheorem{xca}{Exercise}
\theoremstyle{definition}
\newtheorem{prob}{Problem}

我有时会使用 Donald Knuth 的宏,或将其改编为 LaTeX,用于练习(您可能需要)。以下内容假设您希望将答案放在一起并在最后显示(如果有的话)。只需添加到您的序言中:

\makeatletter
%%%%%%%%%%
% Exercise Macros
%%%%%%%%%%
\def\textindent#1{\indent \llap {#1\enspace }\ignorespaces}
\newcounter{exercise}[section]
\def\exercise [#1]{\refstepcounter{exercise}%
  \ifnum\value{exercise}>1 \smallbreak\fi
  \textindent{\textbf{\theexercise.}}[\textit{#1\/}]\kern6pt}
\def\suggestedExercise [#1]{\refstepcounter{exercise}%
  \ifnum\value{exercise}>1 \smallbreak\fi
  \textindent{\llap{\manual x\hskip3pt}\bf{\hbox to
     \ifnum \value{exercise}>99 1.5em\else 1em\fi%
     {\hfil\theexercise}}.}[\textit{#1\/}]\kern6pt}

\def\HM{H\kern-.1em M} % used for "higher math" exercise ratings
\def\MN{M\kern-.1em N} % used in Section 4.3.1 when $MN$ appears frequently

\newenvironment{exercises}{\medskip\noindent\ignorespaces\section*{Exercises}%
        \parindent=0pt}{}

\newwrite\ans%
\immediate\openout\ans=tex/answers % file for answers to exercises
\def\loadAnswers{\immediate\closeout\ans
  \input{tex/answers}}
\def\ansSec#1{\immediate\write\ans{\detokenize{\section*}{#1}}}
\def\ansno#1:{\smallbreak\textindent{\textbf{#1.\enspace}}}
\newenvironment{answer}%
 {\par\medbreak
    \immediate\write\ans{}%
    \immediate\write\ans{\string\ansno\arabic{exercise}:}%
  \@bsphack
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\ans{\the\verbatim@line}}%
  \verbatim@start}%
 {\@esphack} 

%% Sometimes there's an alternate way to solve the problem
%% TODO: Make this include an optional argument specifying how it
%%       was done, so one can use the following code snippet
%% \begin{altAns}[Using Complex Analysis]
%% ...
%% \end{altAns}
\newenvironment{altAns}%
 {\par\medbreak
    \immediate\write\ans{}%
    \immediate\write\ans{\string\ansno\theexercise (Alternate):}%
  \@bsphack
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\ans{\the\verbatim@line}}%
  \verbatim@start}%
 {\@esphack} 
\makeatother

如何使用它们?例如:

\begin{exercises}
\suggestedExercise [01\M] What's $\sqrt{2}$ to 12 digits?
\begin{answer}
We have $\sqrt{2}\approx 1.41421356237...$
\end{answer}
\exercise [45\HM] Solve the Riemann conjecture.
\end{exercises}

“建议练习”的左边空白处有一个三角形指向它,就像 Knuth 在他的 TeXbook 中那样。要加载解决方案,您只需调用宏即可\loadAnswers{}

相关内容