diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty | 95 |
1 files changed, 75 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty b/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty index e09446ebe6c..1a58f5f86a6 100644 --- a/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty +++ b/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty @@ -1,4 +1,4 @@ -\ProvidesPackage{dlfltxbcodetips}[2007/06/01 v0.2 by Lars 'daleif' Madsen] +\ProvidesPackage{dlfltxbcodetips}[2007/07/11 v0.26 by Lars 'daleif' Madsen] % this pacakge collects some macros presented as code tips in my LaTeX % book: "Introduktion til LaTeX". As the macros might be useful for @@ -25,8 +25,26 @@ % \bigtimes, all due to Enrico Gregorio % also made the environment uded inside \NewShadedTheorem % configurable. +% 20070604 Karl Ove Hufthammer mentioned that mathdesign does not like +% amssymb, and _does_ implement \nleftarrow \nrightnarrow. The +% package option 'noamssymb' now disables loading amssymb +% 20070606 alternative konstruction of \NewShadedTheorem, now using +% ntheorem konstructions internally +% 20070710 bug fix regarding shadedtheorems, the counter aliasing did +% not work correctly +% 20070711 Bug fixed in \ArrowBetweenLines, the \ifin@ should go +% inside the \noalign, not outside. + +\newif\ifdlf@do@load@amssymb +\dlf@do@load@amssymbtrue + +\DeclareOption{noamssymb}{\dlf@do@load@amssymbfalse} + +\ProcessOptions\relax + +\RequirePackage{amsmath} + -\RequirePackage{amsmath,amssymb} % \InsertTheoremBreak removes the spacing above the first item, % \InsertTheoremBreak* does not @@ -44,6 +62,7 @@ % \ArrowBetweenLines* on the right % more information is needed % requires the amsmath package +% Now including a fix explained by Jean-Côme Charpentier \def\ArrowBetweenLines{\relax \iffalse{\fi\ifnum0=`}\fi \@ifstar{\ArrowBetweenLines@auxI{00}}{\ArrowBetweenLines@auxI{01}}} @@ -56,9 +75,9 @@ \crcr \noalign{\nobreak\vskip-\baselineskip\vskip-\lineskip}% \noalign{\expandafter\in@\expandafter{\@currenvir}% - {alignedat,aligned,gathered}}% + {alignedat,aligned,gathered}% + \ifin@ \else\notag\fi}% \if#1 &&\quad #2\else #2\quad\fi - \ifin@ \else\notag\fi \\\noalign{\nobreak\vskip-\lineskip}} @@ -67,41 +86,57 @@ % currently only ntheorem is supported (perhaps support for amsthm or % theorem will be added later) % has the same syntax as \newtheorem - -\newcommand\NTSshadeenvironment{shaded} +% +% redesigned 2007/06/06 +\def\theoremframecommand{} \newcommand\NewShadedTheorem[1]{% +% \@ifpackageloaded{ntheorem}{ +% \@ifpackagewith{ntheorem}{framed}{}{ +% \PackageError{dlfltxbcodetips}{ +% \string\NewShadedTheorem\space requires ntheorem to be ^^J +% loaded with the framed option}{} +% } +% }{ +% \PackageError{dlfltxbcodetips}{\string\NewShadedTheorem\space can +% only be used^^J with the ntheorem package}{} +% } \@ifnextchar[{\NST@levelii{#1}}{\NST@levelii{#1}[]}} \def\NST@levelii#1[#2]#3{% \@ifnextchar[{\NST@leveliii{#1}[#2]{#3}}{\NST@leveliii{#1}[#2]{#3}[]}} \newcommand\NST@helper[1]{% \edef\@tempa{c@#1}\edef\@tempb{c@#1@inner}% \expandafter\let\csname\@tempa\expandafter\endcsname\csname\@tempb\endcsname% + \edef\@tempa{p@#1}\edef\@tempb{p@#1@inner}% + \expandafter\let\csname\@tempa\expandafter\endcsname\csname\@tempb\endcsname% + \edef\@tempa{cl@#1}\edef\@tempb{cl@#1@inner}% + \expandafter\let\csname\@tempa\expandafter\endcsname\csname\@tempb\endcsname% \edef\@tempa{the#1}\edef\@tempb{the#1@inner}% \expandafter\let\csname\@tempa\expandafter\endcsname\csname\@tempb\endcsname% } \def\NST@leveliii#1[#2]#3[#4]{% \ifx\\#2\\% i.e. no common counter \ifx\\#4\\% i.e. no dominant counter - \newtheorem{#1@inner}{#3}% + \newshadedtheorem{#1@inner}{#3}% \NST@helper{#1}% \else% i.e. dominant counter - \newtheorem{#1@inner}{#3}[#4]% + \newshadedtheorem{#1@inner}{#3}[#4]% \NST@helper{#1}% \fi% \else% i.e. common counter - \newtheorem{#1@inner}[#2]{#3}% + \newshadedtheorem{#1@inner}[#2]{#3}% \fi% \newenvironment{#1}{% - \begin{\NTSshadeenvironment}% + % code stolen from ntheorem.sty + \thm@topsepadd \theorempostskipamount + \ifvmode \advance\thm@topsepadd\partopsep\fi + \trivlist + \@topsep \theorempreskipamount + \@topsepadd \thm@topsepadd + \item \setlength\theorempreskipamount{0pt}% \setlength\theorempostskipamount{0pt}% - \begin{#1@inner}}{\end{#1@inner}\end{\NTSshadeenvironment}\@endparenv}% - \newtheorem*{#1@innerstr}{#3} - \newenvironment{#1*}{% - \begin{\NTSshadeenvironment}% - \setlength\theorempreskipamount{0pt}% - \setlength\theorempostskipamount{0pt}% - \begin{#1@innerstr}}{\end{#1@innerstr}\end{\NTSshadeenvironment}\@endparenv}% + \begin{#1@inner} + }{\end{#1@inner}\endtrivlist\@endparenv}% } % Mathematics into Type by Ellen Swanson recommends that line-broken @@ -156,7 +191,15 @@ } \newcommand\bigtimes{\mathop{\dlf@bigtimes}\displaylimits} -% better construction fro \nuparrow and \ndownarrow, se also + + +\ifdlf@do@load@amssymb + \RequirePackage{amssymb} +\fi + +\RequirePackage{graphicx} + +% better construction for \nuparrow and \ndownarrow, se also % http://groups.google.com/group/comp.text.tex/msg/689cc8bd604fdb51 % again due to Enrico Gregorio % construction requires graphicx @@ -167,8 +210,20 @@ \dp0=\dimen0 \box0 \mkern2.3965mu } -\def\nuparrow{\mathrel{\mathpalette\dlf@nrotarrow\nrightarrow}} -\def\ndownarrow{\mathrel{\mathpalette\dlf@nrotarrow\nleftarrow}} +\@ifundefined{nrightarrow}{% + \PackageWarning{dlfltxbcodetips}{\string\nrightarrow\space not found,^^J + \string\nuparrow\space will not be defined} +}{ + \def\nuparrow{\mathrel{\mathpalette\dlf@nrotarrow\nrightarrow}} +} + +\@ifundefined{nleftarrow}{% + \PackageWarning{dlfltxbcodetips}{\string\nleftarrow\space not found,^^J + \string\ndownarrow\space will not be defined} +}{ + \def\ndownarrow{\mathrel{\mathpalette\dlf@nrotarrow\nleftarrow}} +} + % this can be used as the first thing in an amsmath alignment % environments for displayed math. It switches \abovedisplayskip and |