diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:00:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:00:39 +0000 |
commit | 58b3c97cd0b6150672d05c6aec4af3fc3140fdc0 (patch) | |
tree | db42a726509b962652eb29ea6a04ad4b15aeddc2 /Master/texmf-dist/tex/latex/newthm/newthm.sty | |
parent | 344f33ebdf41a498671770dc2edbff38e3447b3d (diff) |
newthm
git-svn-id: svn://tug.org/texlive/trunk@1137 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/newthm/newthm.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/newthm/newthm.sty | 260 |
1 files changed, 260 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/newthm/newthm.sty b/Master/texmf-dist/tex/latex/newthm/newthm.sty new file mode 100644 index 00000000000..92ab26ff12d --- /dev/null +++ b/Master/texmf-dist/tex/latex/newthm/newthm.sty @@ -0,0 +1,260 @@ +\ifx\theoremstyle\undefined\else\typeout{WARNING: Package \string"theorem\string" will not +be loaded twice.}\expandafter\endinput\fi +%% +%% Original "theorem.sty" von Frank Mittelbach +%% +\def\filedate{1996/12/29} +%\def\docdate{1996/09/01} +\def\fileversion{1.0} +\def\filename{newthm.sty} +\ProvidesPackage{newthm}[\filedate] +\typeout{** Andreas's Document Style 'newthm' <\filedate>.} +\DeclareOption*{\PackageWarning{newthm}{Unknown Option '\CurrentOption'}} +\ProcessOptions +%% +%% Theoremdefinitionen erm"oglichen +%% +\gdef\theoremstyle#1{% + \@ifundefined{th@#1}{\@warning + {Unknown theoremstyle `#1'. Using `plain'}% + \theorem@style{plain}}% + {\theorem@style{#1}}% + \begingroup + \csname th@\the\theorem@style \endcsname + \endgroup} +\global\let\@begintheorem\relax +\global\let\@opargbegintheorem\relax +\newtoks\theorem@style +\global\theorem@style{plain} +\gdef\theorembodyfont#1{% + \def\@tempa{#1}% + \ifx\@tempa\@empty + \theorem@bodyfont{}% + \else + \theorem@bodyfont{\reset@font#1}% + \fi + } +\newtoks\theorem@bodyfont +\global\theorem@bodyfont{} +\gdef\theoremheaderfont#1{\gdef\theorem@headerfont{#1}% + \gdef\theoremheaderfont##1{% + \typeout{\string\theoremheaderfont\space should be used + only once.}}} +\ifx\upshape\undefined +\gdef\theorem@headerfont{\bfseries} +\else \gdef\theorem@headerfont{\normalfont\bfseries}\fi +%% +%% Stile +%% +\gdef\th@plain{\@input@{n-thp.sty}} +\gdef\th@break{\@input@{n-thb.sty}} +\gdef\th@marginbreak{\@input@{n-thmb.sty}} +\gdef\th@changebreak{\@input@{n-thcb.sty}} +\gdef\th@change{\@input@{n-thc.sty}} +\gdef\th@margin{\@input@{n-thm.sty}} +%% +%% Ohne Nummer +%% +\gdef\th@plainNo{\@input@{n-thpno.sty}} +\gdef\th@breakNo{\@input@{n-thbno.sty}} +\gdef\th@marginbreakNo{\@input@{n-thmbno.sty}} +\gdef\th@changebreakNo{\@input@{n-thcbno.sty}} +\gdef\th@changeNo{\@input@{n-thcno.sty}} +\gdef\th@marginNo{\@input@{n-thmno.sty}} +%% +%% Ein Trennzeichen? +%% +\gdef\theoremseparator#1{\gdef\th@thmsep{#1} + \gdef\theoremseparator##1{ + \typeout{\string\theoremseparator\space should be used + only once.}}} + +\gdef\th@thmsep{} +%% +%% Latexinterna umdefinieren +%% +\gdef\@xnthm#1#2[#3]{\expandafter\@ifdefinable\csname #1\endcsname + {\vig@definelthm{#1} + \@definecounter{#1}\@addtoreset{#1}{#3}% + \expandafter\xdef\csname the#1\endcsname + {\expandafter \noexpand \csname the#3\endcsname + \@thmcountersep \@thmcounter{#1}}% + \def\@tempa{\global\@namedef{#1}}% + \expandafter \@tempa \expandafter{% + \csname th@\the \theorem@style + \expandafter \endcsname \the \theorem@bodyfont + \@thm{#1}{#2}{#1}}% + \global \expandafter \let \csname end#1\endcsname \@endtheorem + }} +\gdef\@ynthm#1#2{\expandafter\@ifdefinable\csname #1\endcsname + {\vig@definelthm{#1}\@definecounter{#1}% + \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}% + \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa + \expandafter{\csname th@\the \theorem@style \expandafter + \endcsname \the\theorem@bodyfont \@thm{#1}{#2}{#1}}% + \global \expandafter \let \csname end#1\endcsname \@endtheorem}} +\gdef\@othm#1[#2]#3{\expandafter\@ifdefinable\csname #1\endcsname + {\vig@definelthm{#1}\expandafter \xdef \csname the#1\endcsname + {\expandafter \noexpand \csname the#2\endcsname}% + \def\@tempa{\global\@namedef{#1}}\expandafter \@tempa + \expandafter{\csname th@\the \theorem@style \expandafter + \endcsname \the\theorem@bodyfont \@thm{#2}{#3}{#1}}% + \global \expandafter \let \csname end#1\endcsname \@endtheorem}} +\gdef\@ythm#1#2#3[#4]{\@opargbegintheorem{#2}{\csname the#1\endcsname}{#4}\ignorespaces + \vig@thmcaption{#3}{{#2}{\csname the#1\endcsname}{#4}}} +\gdef\@thm#1#2#3{\refstepcounter{#1}% + \trivlist + \@topsep \theorempreskipamount % used by first \item + \@topsepadd \theorempostskipamount % used by \@endparenv + \@ifnextchar [% + {\@ythm{#1}{#2}{#3}}% + {\@begintheorem{#2}{\csname the#1\endcsname}% + \vig@thmcaption{#3}{{#2}{\csname the#1\endcsname}{}}\ignorespaces}} +\global\let\@xthm\relax +\newskip\theorempreskipamount +\newskip\theorempostskipamount +\global\setlength\theorempreskipamount{12pt plus 5pt minus 3pt} +\global\setlength\theorempostskipamount{8pt plus 3pt minus 1.5pt} +\global\let\@endtheorem=\endtrivlist +\@onlypreamble\@xnthm +\@onlypreamble\@ynthm +\@onlypreamble\@othm +\@onlypreamble\newtheorem +\@onlypreamble\theoremstyle +\@onlypreamble\theorembodyfont +\@onlypreamble\theoremheaderfont +\@onlypreamble\theoremseparator +\@onlypreamble\theoremnumbering +\theoremstyle{plain} +%% +%% Folgende Definitionen, um Listen zu ermoeglichen +%% Dokumentation anhand \begin{erinnerung}[A_n], 1.Erinnerung, Seite 5 +%% +% \vig@thmcaption schreibt ins aux-file, +% z.B. \contentsline {thm}{{Erinnerung}{1}{A_n}}}{5} +% \vig@thmcaption wird für jedes Theorem aufgerufen +% die beiden Parameter werden einfach weitergereicht +% +\def\vig@thmcaption#1#2{\vig@@thmcaption{#1}#2} +\def\vig@@thmcaption#1#2#3#4{\begingroup% \x, \y local + \def\y##1->##2\relax{##2}% "macro:->" entfernen + \def\x{#4}% + \edef\x{{#2}{#3}{\expandafter\y\meaning\x\relax}}% do it! + \addcontentsline{thm}{#1}{\x}% + \endgroup} +%% +%% \vig@@thmline gibt die einzelnen Zeilen aus +%% Aufruf z.B. \vig@@thmline{Erinnerung}{1}{A_n}{5} +%% +\def\theoremlistall{% + \def\vig@@thmline##1##2##3##4{% + \@dottedtocline{-2}{0em}{2.3em}% + {\protect\numberline{##2}##3}% 1, A_n + {##4}}% Seite +} +\def\theoremlistallname{% + \def\vig@@thmline##1##2##3##4{% + \@dottedtocline{-2}{0em}{2.3em}% + {##1 \protect\numberline{##2}##3}% 1, A_n + {##4}}% Seite +} +% +% Um nur Theoreme mit optionalem Text zu erhalten, \vig@@thmline +% umdefinieren +% +\def\theoremlistoptional{% + \def\vig@@thmline##1##2##3##4{% + \ifx\empty ##3% + \else% + \@dottedtocline{-2}{0em}{2.3em}% + {\protect\numberline{##2}##3}% + {##4}% + \fi}% +} +\def\theoremlistoptname{% + \def\vig@@thmline##1##2##3##4{% + \ifx\empty ##3% + \else% + \@dottedtocline{-2}{0em}{2.3em}% + {##1 \protect\numberline{##2}##3}% + {##4}% + \fi}% +} +\theoremlistall +% +\def\theoremlisttype#1{\csname vig@thml@#1\endcsname} +\def\vig@thml@all{\theoremlistall} +\def\vig@thml@opt{\theoremlistoptional} +\def\vig@thml@optname{\theoremlistoptname} +\def\vig@thml@allname{\theoremlistallname} +% +% \vig@thmline ruft \vig@@thmline auf, und enfernt die äußeren {} +% Klammern bei {{Erinnerung}{1}{A_n}} +% +\def\vig@thmline#1#2{\vig@@thmline#1{#2}} +% +% Um Zeilen zu ignorieren wird \vig@lgobble benötigt +% +\def\vig@lgobble#1#2{} +% +% \vig@definelthm wird durch \newtheorem aufgerufen +% und definiert die Befehle \l@erinnerung etc. +% +\def\vig@definelthm#1{% + \expandafter\gdef\csname l@#1\endcsname{\vig@lgobble}% +} +% +% listoftheorems{satz,satz*,aufgabe} +% +\def\listtheorems#1{\begingroup% + \c@tocdepth=-2% + \def\thm@list{#1}\thm@processlist% + \endgroup} +\def\thm@processlist{% + \begingroup% + \typeout{** Generating table of \thm@list}% + \@for\thm@currentlist:=\thm@list\do{% + \ifx\thm@currentlist\@empty\else% + \expandafter\def\csname l@\thm@currentlist\endcsname{\vig@thmline}% + \fi% + } + \@input{\jobname .thm} + \endgroup +} +% +% \enablelistoftheorems startet das Schreiben in das thm-file +% !! Dieser Befehl muss nach dem letzten listtheorems stehen, +% am besten vor \end{document} +% +\def\enablelistoftheorems{\@starttoc{thm}} +%% +%% +%% Griechische Counter +%% +%% +\def\@greek#1{\if b\expandafter\@car\f@series\@nil\boldmath\fi% + \ifcase#1\or$\alpha$\or$\beta$\or$\gamma$\or$\delta$\or$\varepsilon$% + \or$\zeta$\or$\eta$\or$\vartheta$\or$\iota$\or$\kappa$\or$\lambda$\or$% + \mu$\or$\nu$\or$\xi$\or$ o$\or$\varpi$\or$\varrho$\or$\varsigma$\or$\tau$% + \or$\upsilon$\or$\varphi$\or$\chi$\or$\psi$\or$\omega$\else\@ctrerr\fi} +\def\@Greek#1{\if b\expandafter\@car\f@series\@nil\boldmath\fi% + \ifcase#1\or A\or B\or$\Gamma$\or$\Delta$\or E% + \or Z\or H\or$\Theta$\or I\or K\or$\Lambda$\or M% + \or N\or$\Xi$\or O\or$\Pi$\or P\or$\Sigma$\or T% + \or$\Upsilon$\or$\Phi$\or X\or$\Psi$\or$\Omega$\else\@ctrerr\fi} +\def\greek#1{\@greek{\csname c@#1\endcsname}} +\def\Greek#1{\@Greek{\csname c@#1\endcsname}} +\def\none#1{\@gobble{#1}} +%% +\def\theoremnumbering#1{\gdef\@thmcounter##1{\noexpand\csname #1\endcsname{##1}}} +\theoremnumbering{arabic} +%% +\AtEndDocument{\enablelistoftheorems} +%% +%% +%%+-------------------------------------------+ +%%| Andreas Schlechte | +%%| Am Klepperberg 2 | +%%| 38678 Clausthal-Zellerfeld | +%%| email: Andreas.Schlechte@tu-clausthal.de | +%%+-------------------------------------------+ |