导出定义

导出定义

以下是我笔记的部分代码。我想“轻松”创建一个仅显示定义、定理和引理的新文档。我可以复制并粘贴它,然后删除我不想要的内容,但如果有更简单的方法,那就太好了。

\documentclass[12pt,letterpaper]{article}

\usepackage{amsmath}    % just math
\usepackage{amssymb}    % allow blackboard bold (aka N,R,Q sets)
\usepackage{amsthm} % allows thm environment
\usepackage{mathrsfs}
\usepackage{graphicx, framed} % allows graphics
\usepackage[none]{hyphenat} % allows graphics
\usepackage[usenames,dvipsnames]{color}
\usepackage{color}
\usepackage{wrapfig}
\definecolor{Def}{rgb}{0.85,0.65,0.13}
\definecolor{Ex}{rgb}{0,0.39,0}
\definecolor{Nt}{rgb}{1,0.08, 0.58}
\definecolor{Tm}{rgb}{0,0,0.80}
\definecolor{Pf}{rgb}{1,0.55,0}
\definecolor{white}{rgb}{1,1,1}
\linespread{1.6}    % double spaces lines

\textwidth 6.5truein  % These 4 commands define more efficient margins
\textheight 9.4truein
\oddsidemargin 0.0in
\topmargin -0.6in

\parskip 5pt  % Also, a bit of space between paragraphs

\newtheorem{theorem}{\color{Tm}{\textbf{\underline{Theorem}}}}
\newtheorem{cor}{\color{Tm}{\textbf{\underline{Corollary}}}}
\newtheorem{prop}{\color{Tm}{\textbf{\underline{Proposition}}}}
\newtheorem{claim}{\color{Tm}{\textbf{\underline{Claim}}}}
\theoremstyle{definition}\newtheorem{definition}{\color{Def}{\textbf{\underline{Definition}}}}
\newtheorem{lemma}{\color{Tm}{\textbf{\underline{Lemma}}}}
\newtheorem{exer}{\color{Plum}{\textbf{\underline{Exercise}}}}
\theoremstyle{definition}\newtheorem{note}{\color{Nt}{\textbf{\underline{Note}}}}
\theoremstyle{definition}\newtheorem{example}{\color{Ex}{\textbf{\underline{Example}}}}
\newtheorem{sidebar}{\color{Aquamarine}{\textbf{\underline{Sidebar}}}}
\newtheorem{pf}{\color{BurntOrange}{\textbf{\underline{Proof}}}}

\newcommand{\QEDend}{\linebreak \begin{flushright}\textbf{QED}\end{flushright}}
\newcommand{\QEDish}{\linebreak \begin{flushright}\textbf{$\approx$QED}\end{flushright}}
\newcommand{\bb}[1]{\mathbb{#1}}
\newcommand{\mcal}[1]{\mathcal{#1}}
\newcommand{\scr}[1]{\mathscr{#1}}
\newcommand{\R}[1]{$\mathbb{R}$}
\newcommand{\C}[1]{$\mathbb{C}$}
\newcommand{\N}[1]{$\mathbb{N}$}
\newcommand{\Q}[1]{$\mathbb{Q}$}
\newcommand{\lp}[1]{$\left({#1}\right)$}
\newcommand{\la}[1]{$\left|{#1}\right|$}
\newcommand{\as}[1]{\color{white}{*}\color{black}{}}
\newcommand{\ind}{\hspace*{30pt}}
\newcommand{\done}{\hfill \mbox{\raggedright \rule{0.1in}{0.1in}}}

\newcommand{\bigdotcup}{\ensuremath{\mathop{\makebox[-0.6pt]{\hspace{16pt}{\(\cdot\)}}\bigcup}}}

\newcommand{\dotcup}{\ensuremath{\mathop{\makebox[-0.6pt]{\hspace{13pt}{\(\cdot\)}}\bigcup}}}

\raggedright

\parindent 30pt


\newcommand{\ftheorem}[1]{\begin{framed}\begin{theorem}#1\end{theorem}\end{framed}}
\newcommand{\fdef}[1]{\begin{framed}\begin{definition}#1\end{definition}\end{framed}}
\newcommand{\fnote}[1]{\begin{framed}\begin{note}#1\end{note}\end{framed}}
\newcommand{\flemma}[1]{\begin{framed}\begin{lemma}#1\end{lemma}\end{framed}}
\newcommand{\fex}[1]{\begin{framed}\begin{example}#1\end{example}\end{framed}}
\newcommand{\fcor}[1]{\begin{framed}\begin{corollary}#1\end{corollary}\end{framed}}




\begin{document}
\linespread{1.5}    % 1.5 space lines


\section{Course Notes}

%January 23, 2012

\subsection{Metric Spaces}

\begin{definition}The metric space $M$ is a \underline{complete metric space} if every Cauchy sequence is convergent in $M$.
\end{definition}

\begin{example}
$\bb{R}$ is a complete metric space\done
\end{example}

\begin{example}
$C[0,1]$ is a complete metric space with $d(f,g) = \sup \mid f(t) - g(t) \mid$, $t \in [0,1]$.\done
\end{example}

\begin{theorem}
Any closed subset $A$ of a complete metric space $M$ is complete.
\end{theorem}

\begin{proof}
Let $A \subset M$ be closed and $<x_n>$ be any Cauchy sequence in $A$. Since $M$ is a complete metric space, $<x_n>$ is convergent in $M$, so $x_n \rightarrow x \in M$. Since $A$ is closed, $x \in A$. Thus, $A$ is complete.
\end{proof}

\end{document}`

答案1

好吧,你的 MWE 中仍然缺少一些信息,因此它变成了 MNWE;)。但是试试这个:

\documentclass{amsart}

\usepackage[active,
            generate=short,
            extract-cmd={section},
            extract-env={definition,theorem}]{extract}

\begin{extract*}
  \usepackage{amsthm}

  \newtheorem{theorem}{Theorem}
  \theoremstyle{definition}
  \newtheorem{definition}{Definition}
  \newtheorem{example}{Example}
\end{extract*}

作为序言,编译您的文件并查看文件。有关更多信息,short.tex请参阅软件包的文档(这很重要 - 例如,此软件包会干扰 LaTeX 的内部结构,并且无法用于任何命令!)。简短信息:环境将其内容放入生成的文件中(并像往常一样处理它们);定义生成的文件的名称,并指定要提取的内容。extractextract*generateextract-cmdextract-env

另外,考虑避免\underline并改用\emph

相关内容