summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-02-08 23:07:54 +0000
committerKarl Berry <karl@freefriends.org>2013-02-08 23:07:54 +0000
commit872f1c6c598cdf1da901a0a06d09405cacb75268 (patch)
tree7eb2188db24172798bbfd0ed21140925cf2c9a38 /Master/texmf-dist/tex/latex
parentfd62f1ff5ad45396e8da1f36be8ba7c8e19d6e48 (diff)
coolthms (8feb13)
git-svn-id: svn://tug.org/texlive/trunk@29062 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/coolthms/coolthms.sty107
1 files changed, 92 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/coolthms/coolthms.sty b/Master/texmf-dist/tex/latex/coolthms/coolthms.sty
index e3739d5615b..a07ebcd6025 100644
--- a/Master/texmf-dist/tex/latex/coolthms/coolthms.sty
+++ b/Master/texmf-dist/tex/latex/coolthms/coolthms.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{coolthms}[2012/04/01 v1.1 Theorem markup and advanced referencing]
+\ProvidesPackage{coolthms}[2013/02/04 v1.2 Theorem markup and advanced referencing]
\let\Finv\@undefined
\let\Game\@undefined
\let\beth\@undefined
@@ -30,6 +30,8 @@
\RequirePackage{amssymb}
\RequirePackage{hyperref}
\RequirePackage{etoolbox}
+\RequirePackage{scrbase} % for \ifstr string comparison macro
+\RequirePackage{letltxmacro}
\RequirePackage{ifthen}
\RequirePackage{xargs}
\RequirePackage{kvoptions}
@@ -37,13 +39,16 @@
{\RequirePackage[thmmarks,amsmath,hyperref]{ntheorem}}
{\RequirePackage[thmmarks,hyperref]{ntheorem}}
\RequirePackage{cleveref}
-%% \begin{macro}{\ctp@hashchar}
\begingroup
\catcode`\#=12
\gdef\ctp@hashchar{#}%
\endgroup
\@ifundefined{proofname}{\newcommand{\proofname}{Proof}}{}
-\DeclareStringOption[\proofname]{proofname}
+\let\ctp@temp\proofname\relax
+\AtBeginDocument{\edef\ctp@temp{\proofname}%
+ \apptocmd{\select@language}{\edef\ctp@temp{\proofname}}{}{}}
+\AfterEndEnvironment{proof}{\gdef\proofname{\ctp@temp}}
+\DeclareStringOption[\ctp@temp]{proofname}
\DeclareStringOption[$\Box$]{proofsymbol}
\DeclareStringOption[\it]{proofcaptionstyle}
\DeclareStringOption[\coolthms@indent]{proofindent}
@@ -51,9 +56,65 @@
\DeclareStringOption[0em]{indent}
\DeclareStringOption[0pt]{minskip}
\DeclareStringOption[6pt]{maxskip}
+\DeclareBoolOption{externalchapters}
\DeclareLocalOptions{separator,indent,minskip,maxskip%
- proofname,proofsymbol,proofcaptionstyle,proofindent}
+ proofname,proofsymbol,proofcaptionstyle,proofindent,externalchapters}
\ProcessKeyvalOptions*
+\@ifundefined{c@chapter}{%
+ \newcounter{chapter}%
+ \setcounter{chapter}{1}%
+}{}%
+\ifcoolthms@externalchapters
+\renewcommand{\thechapter}{\Roman{chapter}}
+\renewcommand{\thesection}{\arabic{section}}
+\def\refstepcounter@noarg#1{%
+ \cref@old@refstepcounter{#1}%
+ \cref@constructprefix{#1}{\cref@result}%
+ \@ifundefined{cref@#1@alias}%
+ {\def\@tempa{#1}}%
+ {\def\@tempa{\csname cref@#1@alias\endcsname}}%
+ \edef\chapter@current@value{\the\value{chapter}}
+ \protected@edef\cref@currentlabel{%
+ [\@tempa][\arabic{#1}][\cref@result]%
+ \string\ifstr{\string\the\string\value{chapter}}%
+ {\chapter@current@value}{\string\relax}{\thechapter.}%
+ \csname p@#1\endcsname\csname the#1\endcsname}
+ \protected@edef\cref@old@currentlabel{%
+ [\@tempa][\arabic{#1}][\cref@result]%
+ \csname p@#1\endcsname\csname the#1\endcsname}
+ \ifstr{\@tempa}{chapter}{\protected@edef\cref@currentlabel{\cref@old@currentlabel}}{}}
+\def\refstepcounter@optarg[#1]#2{%
+ \cref@old@refstepcounter{#2}%
+ \cref@constructprefix{#2}{\cref@result}%
+ \edef\chapter@current@value{\the\value{chapter}}
+ \protected@edef\cref@currentlabel{%
+ [#1][\arabic{#2}][\cref@result]%
+ \string\ifstr{\string\the\string\value{chapter}}%
+ {\chapter@current@value}{\string\relax}{\thechapter.}%
+ \csname p@#2\endcsname\csname the#2\endcsname}
+ \protected@edef\cref@old@currentlabel{%
+ [#1][\arabic{#2}][\cref@result]%
+ \csname p@#2\endcsname\csname the#2\endcsname}
+ \ifstr{#1}{chapter}{\protected@edef\cref@currentlabel{\cref@old@currentlabel}}{}}
+ \def\ctp@label@noarg#1{%
+ \letcs{\mycurrentlabel}{@currentlabel}
+ \expandafter\def\csname @currentlabel\endcsname{\string\ifstr%
+ {\string\the\string\value{chapter}}{\the\value{chapter}}%
+ {\string\relax}{\thechpt}\mycurrentlabel}
+ \label@noarg{#1}
+ \cslet{@currentlabel}{\mycurrentlabel}
+ }%
+ \def\ctp@label@optarg[#1]#2{%
+ \letcs{\mycurrentlabel}{@currentlabel}
+ \expandafter\def\csname @currentlabel\endcsname{\string\ifstr%
+ {\string\the\string\value{chapter}}{\the\value{chapter}}%
+ {\string\relax}{\thechpt}\mycurrentlabel}
+ \label@optarg[#1]{#2}
+ \cslet{@currentlabel}{\mycurrentlabel}
+ \def\label{\@ifnextchar[\ctp@label@optarg\ctp@label@noarg}%]
+ }
+\else % belongs to \ifcoolthms@externalchapters
+\fi
\newtheoremstyle{keinenummern}%
{\item[\hskip\labelsep\theorem@headerfont ##1\theorem@separator]}%
{\item[\hskip\labelsep\theorem@headerfont ##1\ %
@@ -65,10 +126,6 @@
\newtheoremstyle{unserbeweis}%
{\item[{\hskip\labelsep\theorem@headerfont ##1\theorem@separator}]}%
{\item[\hskip\labelsep{\theorem@headerfont ##3\theorem@separator}]}
-\@ifundefined{c@chapter}{%
- \newcounter{chapter}%
- \setcounter{chapter}{1}%
-}{}%
\newcommandx*{\definetheorem}[5][1=thmcnt,3=,5=section]{
\@ifundefined{c@#1}{
\@ifundefined{c@#5}{
@@ -92,16 +149,40 @@
\addtocounter{#1}{1}%
\edef\ctp@labelcode%
{ctp@#2@\roman{chapter}@\roman{section}@\arabic{#1}}\relax%
+\ifcoolthms@externalchapters
+ \immediate\write\@auxout{\string\crefname{\ctp@labelcode}%
+ {#4\noexpand~%
+ \string\ifstr{\string\the\string\value{chapter}}%
+ {\chapter@current@value}{\string\relax}{\thechapter.}%
+ \csname the#1\endcsname}%
+ {#3\noexpand~\csname the#1\endcsname}}\relax%
+ \immediate\write\@auxout{\string\crefformat{\ctp@labelcode}%
+ {\string##2#4\noexpand~%
+ \string\ifstr{\string\the\string\value{chapter}}%
+ {\chapter@current@value}{\string\relax}{\thechapter.}%
+ \csname the#1\endcsname\noexpand~%
+ \ctp@hashchar1\ctp@hashchar3}}\relax%
+\else
\immediate\write\@auxout{\string\crefname{\ctp@labelcode}%
{#4\noexpand~\csname the#1\endcsname}%
{#4 plural\noexpand~\csname the#1\endcsname}}\relax%
\immediate\write\@auxout{\string\crefformat{\ctp@labelcode}%
{\string##2#4\noexpand~\csname the#1\endcsname\noexpand~%
\ctp@hashchar1\ctp@hashchar3}}\relax%
+\fi
+\ifcoolthms@externalchapters
+ \def\Label##1{\cref@old@label{##1}%
+ \protected@edef\cref@currentlabel{%
+ \expandafter\cref@override@label@type%
+ \cref@old@currentlabel\@nil{\ctp@labelcode}}%
+ \protected@write\@auxout{}%
+ {\string\newlabel{##1@cref}{{\cref@currentlabel}{\thepage}}}}
+\else
\edef\Label##1{\noexpand\label[\ctp@labelcode]{##1}}%
+\fi
\addtocounter{#1}{-1} %
- }%
-}%
+ }% End of \BeforeBeginEnvironment
+}% End of \newcommandx*{\definetheorem}
\newcommandx*{\theoremmarkup}[6][1=\bf,2=\normalfont,3=\relax,%
4=\coolthms@indent,5=\coolthms@separator,6=arabic]{
\theoremheaderfont{\hspace*{-\theorem@indent}#1}
@@ -113,16 +194,12 @@
}
\crefformat{equation}{#2(#1)#3}
\crefformat{chapter}{#2\chaptername~#1#3}
-\@ifundefined{sectionname}{\newcommand{\sectionname}{}}{}
- \gappto\captionsgerman{\renewcommand{\sectionname}{Abschnitt}}%
- \gappto\captionsenglish{\renewcommand{\sectionname}{section}}
-\crefformat{section}{#2\sectionname~#1#3}
\theorempreskipamount\coolthms@minskip plus \coolthms@maxskip\relax
\theorempostskipamount\coolthms@minskip plus \coolthms@maxskip\relax
\theoremstyle{unserbeweis}
\theoremmarkup[\coolthms@proofcaptionstyle][\normalfont]%
[\coolthms@proofsymbol][\coolthms@proofindent]
-\newtheorem{proof}{\coolthms@proofname}
+\expandafter\newtheorem{proof}{\coolthms@proofname}
\theoremmarkup
\endinput
%%