summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty')
-rw-r--r--Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty174
1 files changed, 174 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty b/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty
new file mode 100644
index 00000000000..752777feaa3
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/dlfltxb/dlfltxbcodetips.sty
@@ -0,0 +1,174 @@
+\ProvidesPackage{dlfltxbcodetips}[2007/05/07 v0.1 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
+% other than the normal readers of my book, the longer macros are
+% collected in this package.
+
+% This package be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2003/12/01 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% The Current Maintainer of this work is Lars Madsen (daleif@imf.au.dk).
+%%
+
+
+
+
+\RequirePackage{amsmath,amssymb}
+
+% \InsertTheoremBreak removes the spacing above the first item,
+% \InsertTheoremBreak* does not
+\newcommand\InsertTheoremBreak{%
+ \@ifstar{\item[\vbox{\null}]}{%
+ \begingroup % keep changes local
+ \setlength\itemsep{0pt}%
+ \setlength\parsep{0pt}%
+ \item[\vbox{\null}]%
+ \endgroup%
+ }}
+
+% macro made on request by Morten H\o gholm
+% \ArrowBetweenLines adds arrow on the left
+% \ArrowBetweenLines* on the right
+% more information is needed
+% requires the amsmath package
+\def\ArrowBetweenLines{\relax
+ \iffalse{\fi\ifnum0=`}\fi
+ \@ifstar{\ArrowBetweenLines@auxI{00}}{\ArrowBetweenLines@auxI{01}}}
+\def\ArrowBetweenLines@auxI#1{%
+ \@ifnextchar[%
+ {\ArrowBetweenLines@auxII{#1}}%
+ {\ArrowBetweenLines@auxII{#1}[\Updownarrow]}}
+\def\ArrowBetweenLines@auxII#1[#2]{%
+ \ifnum0=`{\fi \iffalse}\fi
+ \crcr
+ \noalign{\nobreak\vskip-\baselineskip\vskip-\lineskip}%
+ \noalign{\expandafter\in@\expandafter{\@currenvir}%
+ {alignedat,aligned,gathered}}%
+ \if#1 &&\quad #2\else #2\quad\fi
+ \ifin@ \else\notag\fi
+ \\\noalign{\nobreak\vskip-\lineskip}}
+
+
+% for making theorems with shaded background
+% requires the use of ntheorem, (x)color and framed
+% currently only ntheorem is supported (perhaps support for amsthm or
+% theorem will be added later)
+% has the same syntax as \newtheorem
+\newcommand\NewShadedTheorem[1]{%
+ \@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{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}%
+ \NST@helper{#1}%
+ \else% i.e. dominant counter
+ \newtheorem{#1@inner}{#3}[#4]%
+ \NST@helper{#1}%
+ \fi%
+ \else% i.e. common counter
+ \newtheorem{#1@inner}[#2]{#3}%
+ \fi%
+ \newenvironment{#1}{%
+ \begin{shaded}%
+ \setlength\theorempreskipamount{0pt}%
+ \setlength\theorempostskipamount{0pt}%
+ \begin{#1@inner}}{\end{#1@inner}\end{shaded}\@endparenv}%
+ \newtheorem*{#1@innerstr}{#3}
+ \newenvironment{#1*}{%
+ \begin{shaded}%
+ \setlength\theorempreskipamount{0pt}%
+ \setlength\theorempostskipamount{0pt}%
+ \begin{#1@innerstr}}{\end{#1@innerstr}\end{shaded}\@endparenv}%
+ }
+
+% Mathematics into Type by Ellen Swanson recommends that line-broken
+% displayed alignments should be indented by 2em (and other rules)
+% instead of aligning ti the left and indenting all subsequent lines,
+% it is easier to just pull back the first line. Just align all lines
+% to the left and replace the & on the fist line with \PullBack
+% The indentation amount can be changed by \PullBack[3], i.e. no unit,
+% 'em will be used automatically
+\newlength\PullBackLength
+\newcommand\PullBack[1][2]{%
+ \setlength{\global\PullBackLength}{#1em}%
+ \kern\PullBackLength%
+ &
+ \kern-\PullBackLength}
+
+
+% this implements a stack that holds a user build mathindent
+% not easy to explain in words see the documentation
+\newtoks\dlf@STACK
+\def\dlf@Prepend#1(to:)#2{\toks0={#1}%
+ \global\edef\act{\global\noexpand#2={\the\toks0 \the#2}}%
+ \act}
+\def\dlf@PopOff#1{\global\edef\act{\global\noexpand\dlf@SplitOff\the#1%
+ (tail:)\noexpand#1}\act}
+\def\dlf@SplitOff#1#2(tail:)#3{#3={#2}}
+\newlength\MathIndentLength
+\newcommand\MathIndent{\kern\MathIndentLength}
+\newcommand\PopMathIndent{%
+ \@ifstar{\@PopMathIndent\relax}{\@PopMathIndent\MathIndent}}
+\newcommand\@PopMathIndent[1]{\dlf@PopOff\dlf@STACK
+ \settowidth\@tempdimc{\ensuremath{\displaystyle\phantom{\the\dlf@STACK}}}
+ \setlength{\global\MathIndentLength}{\@tempdimc}#1}
+\newcommand\SetMathIndent[1]{\dlf@STACK={}\dlf@Prepend{{#1}}(to:)\dlf@STACK
+ \settowidth\@tempdimc{\ensuremath{\displaystyle\phantom{\the\dlf@STACK}}}
+ \setlength{\global\MathIndentLength}{\@tempdimc}#1}
+\newcommand\AddtoMathIndent[1]{\dlf@Prepend{{#1}}(to:)\dlf@STACK
+ \settowidth\@tempdimc{\ensuremath{\displaystyle\phantom{\the\dlf@STACK}}}
+ \setlength{\global\MathIndentLength}{\@tempdimc}#1}
+
+
+% constructs a \bigtimes symbol, in the same category as e.g. \sum
+% etc. Since we are using \DeclareMathOperator, the amsmath package is
+% required, thus autoloaded by this pacakge
+\newcommand\SNYDINTERN[1]{\vcenter{{\hbox{#1\ensuremath\times}}}}
+\newcommand\SNYD{%
+ \mathchoice{\SNYDINTERN\huge\displaystyle}% display style
+ {\SNYDINTERN\LARGE\textstyle\mkern-3.5mu} % text style
+ {\SNYDINTERN{}\scriptstyle\mkern-2mu} % script style
+ {\SNYDINTERN\footnotesize\scriptscriptstyle\mkern-2mu}% script script style
+}
+\DeclareMathOperator*\bigtimes{\SNYD}
+
+
+% constructor for creating negated \up/downarrow
+% requires graphicx
+\newcommand*\nrotarrowconstructor[2]{%
+ \mathrel{\m@th\sbox\z@{$ #1 $}%
+ \raisebox{1.3\dp\z@}{%
+ \makebox[\wd\z@][c]{%
+ \reflectbox{\rotatebox[origin=cB]{90}{$ #2 $}}%
+ \kern0.32\wd\z@%
+ }}}%
+}
+\newcommand\nuparrow{\nrotarrowconstructor\uparrow\nrightarrow}
+\newcommand\ndownarrow{\nrotarrowconstructor\downarrow\nleftarrow}
+
+
+% this can be used as the first thing in an amsmath alignment
+% environments for displayed math. It switches \abovedisplayskip and
+% \abovedisplayshortskip before the display, usefull in some cases to
+% save some space
+\newcommand\SwapDeadSpace{%
+ \noalign{\vskip-\abovedisplayskip\vskip\abovedisplayshortskip}
+}
+
+