定理和定义表/摘要

定理和定义表/摘要

我想知道是否有任何软件包可以自动打印出我文档中的定理和定义的表格或摘要。我不想要定理和定义的列表。谢谢。

%%%%%%%%%%%%%  PACKAGES  %%%%%%%%%%%%%%%%%
\documentclass[11pt]{article}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{hyperref}


%%%%%%%%%%%%%  THEOREMS  %%%%%%%%%%%%%%%%%
\theoremstyle{plain} % other options: definition, remark
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem*{definition}{Definition} % the star prevents numbering
\theoremstyle{example}
\newtheorem{example}{Example}


%%%%%%%%%%%%%%  PAGE SETUP %%%%%%%%%%%%%%%%%
\usepackage[margin=1.5in]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Real Analysis} % Left Header
\rhead{\thepage} % Right Header
\cfoot{} % Center Foot (empty)



%%%%%%%%%%%%% DOCUMENT BEGINS %%%%%%%%%%%%%%%%%%%%
\begin{document}

\section{Lecture 1}

\begin{theorem}
This is my first theorem.
\end{theorem}

\begin{definition}
My first definition.
\end{definition}

\begin{theorem}
This is my second theorem.
\end{theorem}

\begin{definition}
My second definition.
\end{definition}


\newpage

\section{Definition and Theorem Summary}
\textbf{Theorem 1.} This is my first theorem.\\
\textbf{Definition.} My first definition.\\
\textbf{Theorem 2.} This is my second theorem.\\
\textbf{Definition.} My second definition.\\

\end{document}

答案1

    \documentclass[a4paper]{report}
\usepackage{amsthm,amsfonts}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]

% --------------------------------------------
% --------------------------------------------
% Select the appropriate switch depending on your operating system
\newif\ifOSisUnix
\OSisUnixtrue % Unix, Linux, Mac OS X...
% \OSisUnixfalse % Windows

% Load fancyvrb
\usepackage{fancyvrb}

% Name of the scratch file: \ScratchFile is <jobname>.tmp
\newcommand{\ScratchFile}{\jobname.tmp}

% Command \SetTempFile to set names of auxiliary files where to store code.
% \SetTempFile{foo} defines \fooTempFile as <jobname>-foo.tmp and writes in this file
% the line \let\label\@gobble (this avoids warnings about multiply defined labels).
% Any existing file \fooTempFile is overwritten.

\newwrite\outputstream
\makeatletter
\newcommand{\SetTempFile}[1]{%
   \@namedef{#1TempFile}{\jobname-#1.tmp}%
   \immediate\openout\outputstream=\@nameuse{#1TempFile}%
   \immediate\write\outputstream{\string\makeatletter}%
   \immediate\write\outputstream{\string\let\string\label\string\@gobble}%
   \immediate\write\outputstream{\string\makeatother}%
   \immediate\closeout\outputstream}
\makeatother

% Command \AppendScratchFile.
% \AppendScratchFile{foo} appends the contents of \ScratchFile to those of 
% the auxiliary file \fooTempFile
\makeatletter
\newcommand{\AppendScratchFile}[1]{%
   \ifOSisUnix%
      \immediate\write18{cat \ScratchFile >> \@nameuse{#1TempFile}}%
   \else%
      \immediate\write18{type \ScratchFile >> \@nameuse{#1TempFile}}%
   \fi}
\makeatother

% Environment StoreCode. Usage:
% \begin{StoreCode}{foo}
%   code 
% \end{StoreCode}
% It typesets  all the code that lies inside and saves it to the auxiliary file \fooTempFile.
% The definition is a bit tricky. It is not done through \newenvironment

\makeatletter
\newcommand{\StoreCode}[1]%
  {\gdef\TempFileSuffix{#1}%
   \VerbatimEnvironment
   \begin{VerbatimOut}{\ScratchFile}}
\def\endStoreCode{%
   \end{VerbatimOut}
   \input{\ScratchFile}%
   \AppendScratchFile{\TempFileSuffix}}
\makeatother

% Command \StoreCounterValue.
% \StoreCounterValue{count}{foo} writes in the file \fooTempFile the line
% \setcounter{count}{counter_value}. It is useful to control numbering the second
% time the code is processed.

\newcommand{\StoreCounterValue}[2]{%
   \immediate\openout\outputstream=\ScratchFile%
   \immediate\write\outputstream{\string\setcounter{#1}{\arabic{#1}}}%
   \immediate\closeout\outputstream%
   \AppendScratchFile{#2}}

% Command \InputTempFile.
% \InputTempFile{foo} inputs the file \fooTempFile
\makeatletter
\newcommand{\InputTempFile}[1]{\input{\@nameuse{#1TempFile}}}
\makeatother

% --------------------------------------------
% --------------------------------------------

% Auxiliary macro for writing maths
\newcommand{\Rset}{\mathbb{R}}

% We set the auxiliary files for storing code: thm for theorems and def for definitions.
\SetTempFile{thm}
\SetTempFile{def}

\begin{document}

\chapter{First chapter}

\StoreCounterValue{chapter}{thm}
\StoreCounterValue{theorem}{thm}
\StoreCounterValue{chapter}{def}

\begin{StoreCode}{def}
\begin{definition}\label{def:1}
  A function $f:\Rset\to\Rset$ is \emph{continuous} in a point
  $x_0$ if \[\lim_{x\to x_0}f(x)=f(x_0).\]
\end{definition}
\end{StoreCode}

\begin{StoreCode}{def}
\begin{definition}\label{def:2}
  A funci\'on $f:\Rset\to\Rset$ is \emph{derivable} in
  a point $x_0$ if \[\lim_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}\]
  exists and is finite.  In such a case, this limit is called the
  \emph{derivative} of $f$ in $x_0$ and is denoted by $f'(x_0)$.
\end{definition}
\end{StoreCode}

The following result states the fundamental relation existing between the notions introduced in 
Definitions \ref{def:1} and \ref{def:2}.

\begin{StoreCode}{thm}
\begin{theorem}
  If $f:\Rset\to\Rset$ is derivable in $x_0$, then $f$ is continuous in $x_0$.
\end{theorem}
\end{StoreCode}

\chapter{Second chapter}

\StoreCounterValue{chapter}{thm}
\StoreCounterValue{theorem}{thm}

\begin{StoreCode}{thm}
\begin{theorem}[Rolle's Theorem]
   Let $f:[a,b]\to\Rset$ be a function continuous on $[a,b]$, derivable on
    $(a,b)$, and such that $f(a)=f(b)$. Then, there exists $c\in(a,b)$ such that
    $f'(c)=0$.
\end{theorem}
\end{StoreCode}

\begin{StoreCode}{thm}
\begin{theorem}[Mean Value Theorem]
   Let $f:[a,b]\to\Rset$ be a function continuous on $[a,b]$ and derivable on
   $(a,b)$. Then, there exists $c\in(a,b)$ such that $f(b)-f(a)=f'(c)(b-a)$.
\end{theorem}
\end{StoreCode}

\begin{corollary}
   Let $f:[a,b]\to\Rset$ be a function continuous on $[a,b]$ and derivable on
   $(a,b)$. If, for all $x\in(a,b)$, $f'(x)\geq0$, then $f$ is increasing in $[a,b]$. 
\end{corollary}

\StoreCounterValue{theorem}{thm}

\begin{StoreCode}{thm}
\begin{theorem}[Cauchy's Mean Value Theorem]
   Let $f, g:[a,b]\to\Rset$ be two functions continuous on $[a,b]$ and derivable on
   $(a,b)$. Then, there exists $c\in(a,b)$ such that $g'(b)(f(b)-f(a))=f'(c)(g(b)-g(a))$.
\end{theorem}
\end{StoreCode}

\chapter*{Main definitions}
\InputTempFile{def}

\chapter*{Main results}
\InputTempFile{thm}

\end{document}

相关内容