summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-05-28 00:19:26 +0000
committerKarl Berry <karl@freefriends.org>2013-05-28 00:19:26 +0000
commit087037d946928765bc5098fe2b706601255ecd3d (patch)
treecda85f30b9bdaa95b3626599aa0e40ade18399d3 /Master/texmf-dist
parentd27eef38ae3949f50534d0d84c3e1e27a08d4a28 (diff)
interval (24may13)
git-svn-id: svn://tug.org/texlive/trunk@30747 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/interval/interval.pdfbin0 -> 302547 bytes
-rw-r--r--Master/texmf-dist/doc/latex/interval/interval.tex169
-rw-r--r--Master/texmf-dist/tex/latex/interval/interval.sty73
3 files changed, 242 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/interval/interval.pdf b/Master/texmf-dist/doc/latex/interval/interval.pdf
new file mode 100644
index 00000000000..8a728032c54
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/interval/interval.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/interval/interval.tex b/Master/texmf-dist/doc/latex/interval/interval.tex
new file mode 100644
index 00000000000..685cb54c718
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/interval/interval.tex
@@ -0,0 +1,169 @@
+\documentclass[a4paper,article]{memoir}
+\usepackage[T1]{fontenc}
+\usepackage{amsmath,enumitem,showexpl}
+%\usepackage[scaled]{beramono}
+\title{The \textsf{interval} package}
+\author{Lars Madsen\thanks{Email: daleif@imf.au.dk}\\ \small (on behalf of By the Danish \TeX\ collective)}
+\setsecnumdepth{none}
+
+%\setlength\overfullrule{5pt}
+
+\usepackage{interval}
+
+\begin{document}
+
+\maketitle
+
+\section{Motivation}
+\label{sec:motivation}
+
+In mathematics there are two syntax' when it comes to specifying open
+and closed intervals.
+
+The first use parantheses to mark an open end
+\begin{align*}
+ [a,b] \qquad (a,b] \qquad [a,b)\qquad (a,b),
+\end{align*}
+while the other use brackets throughout
+\begin{align*}
+ [a,b] \qquad ]a,b] \qquad [a,b[\qquad ]a,b[,
+\end{align*}
+
+The former poses no problem in \TeX, but the later does, as, e.g., a
+closing bracket is being used in place of an opening fence, and thus
+have the wrong category when it comes to spacing:
+\begin{align*}
+ ]-a,b[+c \qquad\text{versus}\qquad \mathopen{]}-a,b\mathclose{[}+c.
+\end{align*}
+
+One could use
+\begin{verbatim}
+\mathopen{]}-a,b\mathclose{[}+c
+\end{verbatim}
+to solve the problem, but then \cs{left}\dots\cs{right} can no longer
+be used to auto scale the fences.
+
+
+
+
+\section{The \cs{interval} command}
+\label{sec:csinterval-command}
+
+The following is the result of a discussion on the Danish \TeX\ Users
+groups mailing list. Kudos to Martin Heller, for proposing the
+original version using \textsf{pgfkeys}.
+
+We provide a macro and a way to globally configure it
+\begin{quote}
+ \cs{interval}\oarg{options}\marg{start}\marg{end}\\
+ \cs{intervalsetup}\marg{options}
+\end{quote}
+We note that the interval separator symbol is hidden inside the
+\cs{interval} macro and can be changed using an option.
+
+\subsection{Configuration options}
+\label{sec:options}
+
+\begin{description}[style=nextline,font=\sffamily\bfseries]
+\item[separator symbol]
+ symbol that separates the start and end of the interval. Default:
+ \texttt{\{,\}}, note that as comma is the separating character in the
+ options specification, the symbol is enclosed in braces, these are
+ automatically removed.
+\item[left open fence]
+ Default: \texttt{]}
+\item[left closed fence]
+ Default: \texttt{[}
+\item[right open fence]
+ Default: \texttt{[}
+\item[right closed fence]
+ Default: \texttt{]}
+\item[soft open fences]
+ This is just a fast way of saying
+ \begin{quote}
+ \ttfamily\obeylines
+ left open fence=(,
+ right open fence=)
+ \end{quote}
+
+\end{description}
+
+\subsection{Usage options}
+
+By default \cs{interval}\marg{start}\marg{end} will produce a closed
+interval. Other types are provided via options:
+
+\begin{description}[style=nextline,font=\sffamily\bfseries]
+\item[open]
+ an open interval
+\item[open left]
+ interval open on the left side
+\item[open right]
+ interval open on the right side
+\item[scaled]
+ auto scale interval fences
+\item[scaled=\meta{scaler}]
+ scale fences using \meta{scaler}, i.e.\ using \texttt{scaled=\cs{Big}}
+\end{description}
+
+\fancybreak{}
+
+As some might be guessed, the \texttt{interval} package depends on the
+\textsf{pgfkeys} package to handle its key-value configuration.
+
+\newpage
+
+\section{Examples}
+\label{sec:examples}
+
+% used for showexpl
+\lstset{
+ explpreset={
+ xleftmargin=0em,
+ columns=fixed,
+ },
+ pos=r,
+ width=-99pt,
+ overhang=0pt,
+ hsep=2\columnsep,
+ vsep=\bigskipamount,
+ rframe=x,
+ basicstyle=\footnotesize\ttfamily,
+}
+
+
+
+\begin{LTXexample}
+\begin{align*}
+&A\in\interval{a}{b}\\
+&A\in\interval[open]{a}{b}\\
+&A\in\interval[open left]{a}{b}\\
+&A\in\interval[open right,
+ scaled]{a}{\frac12b}=B\\
+&A\in\interval[scaled=\big]{a}{b}
+\end{align*}
+\end{LTXexample}
+And using soft open fences:
+\begin{LTXexample}
+\intervalconfig{
+ soft open fences,
+ separator symbol=;,
+}
+\begin{align*}
+&A\in\interval{a}{b}\\
+&A\in\interval[open]{a}{b}\\
+&A\in\interval[open left]{a}{b}\\
+&A\in\interval[open right,
+ scaled]{a}{\frac12b}=B\\
+&A\in\interval[scaled=\big]{a}{b}
+\end{align*}
+\end{LTXexample}
+
+
+
+\end{document}
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: t
+%%% End:
diff --git a/Master/texmf-dist/tex/latex/interval/interval.sty b/Master/texmf-dist/tex/latex/interval/interval.sty
new file mode 100644
index 00000000000..559520b9ae5
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/interval/interval.sty
@@ -0,0 +1,73 @@
+\ProvidesPackage{interval}[2013/05/24 v0.1]
+
+%%
+%% This package can 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{pgfkeys}
+
+
+\newcommand\INTV@scaler[1]{
+ \def\INTV@auto{auto}
+ \def\INTV@arg{#1}
+ \ifx\INTV@auto\INTV@arg
+ \def\INTV@openfence{\mathopen{}\mathclose\bgroup\left\INTV@leftfence}
+ \def\INTV@closefence{\aftergroup\egroup\right\INTV@rightfence}
+ \else
+ \def\INTV@openfence{\mathopen{#1\INTV@leftfence}}
+ \def\INTV@closefence{\mathclose{#1\INTV@rightfence}}
+ \fi
+}
+
+
+% setup
+\pgfkeys{%
+ /interval/.is family,%
+ /interval,%
+ left open fence/.initial={]},%
+ left closed fence/.initial={[},%
+ right open fence/.initial={[},%
+ right closed fence/.initial={]},%
+ left fence/.link=/interval/left closed fence,%
+ right fence/.link=/interval/right closed fence,%
+ separator symbol/.initial={,},%
+ open left/.style={ left fence/.link=/interval/left open fence },%
+ open right/.style={ right fence/.link=/interval/right open fence },%
+ open/.style={open left,open right},%
+ scaled/.code={\INTV@scaler{#1}},%
+ scaled/.default=auto,%
+ soft open fences/.style={%
+ left open fence={(},%
+ right open fence={)},%
+ },%
+}
+
+% user configuation
+\newcommand\intervalconfig[1]{\pgfkeys{/interval,#1}}
+
+
+\newcommand\interval[3][]{%
+ \begingroup%
+ \def\INTV@openfence{\mathopen{\INTV@leftfence}}%
+ \def\INTV@closefence{\mathclose{\INTV@rightfence}}%
+ \pgfkeys{interval,#1}%
+ \pgfkeysgetvalue{/interval/left fence}{\INTV@leftfence}%
+ \pgfkeysgetvalue{/interval/right fence}{\INTV@rightfence}%
+ \INTV@openfence%
+ #2%
+ %,%
+ \pgfkeysvalueof{/interval/separator symbol}
+ #3%
+ \INTV@closefence%
+ \endgroup%
+}