diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-11 23:55:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-11 23:55:29 +0000 |
commit | 48243fdbbe15cb58c4136497707e37637e7d4100 (patch) | |
tree | 9de6f823e6a2520490bab3ea3f0828852d1a8db3 /Master/texmf-dist/source/latex/ncctools/nccstretch.dtx | |
parent | f7ffde8f769cd6f1d473ae231d219b99b3fa5263 (diff) |
trunk/Master/texmf-dist/source/latex/ncctools
git-svn-id: svn://tug.org/texlive/trunk@408 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/ncctools/nccstretch.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/ncctools/nccstretch.dtx | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx b/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx new file mode 100644 index 00000000000..8d942ef80e6 --- /dev/null +++ b/Master/texmf-dist/source/latex/ncctools/nccstretch.dtx @@ -0,0 +1,74 @@ +% \iffalse +%% +%% File: nccstretch.dtx Copyright (C) 2004 by Alexander I. Rozhenko +%% +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{nccstretch} +%<package> [2004/11/30 v1.0 Text Stretch Package (NCC)] +% +% \changes{v1.0}{2004/11/30}{This version was uploaded to CTAN} +% +%<*driver> +\documentclass{ltxdoc} +\usepackage{nccstretch} +\GetFileInfo{nccstretch.sty} +\begin{document} +\title{The \textsf{nccstretch} package\thanks{This file + has version number \fileversion, last + revised \filedate.}} +\author{Alexander I. Rozhenko\\rozhenko@oapmg.sscc.ru} +\date{\filedate} +\maketitle +\DocInput{nccstretch.dtx} +\end{document} +%</driver> +% \fi +% \section{User Interface} +% +% \DescribeMacro{\stretchwith} +% The package implements the command +% \begin{quote} +% |\stretchwith|\marg{foo}\marg{text} +% \end{quote} +% that stretches the \meta{text} parameter inserting the +% \meta{foo} sequence between every pair of neighbour tokens of +% the \meta{text}. Spaces in the text are ignored. So, to save +% a space, you need to insert a backslash before it or enclose +% a space in braces. If you do not want to insert \meta{foo} +% between some tokens, enclose them in braces. While stretching, +% all first-level braces are removed. The examples below +% show some use cases (we delimit the results with rules to show +% exactly how the command works): +% \begin{center}\small% +% \newcommand*\ruled[1]{\rule{.4pt}{2ex}#1\rule{.4pt}{2ex}}% +% \begin{tabular}{@{}l@{\qquad}l@{}} +% \textbf{Command} & \textbf{Result}\\ +% |\stretchwith{\,}{Proof\ of\ Theorem\ 1}| & +% \ruled{\stretchwith{\,}{Proof\ of\ Theorem\ 1}}\\ +% |\stretchwith{.}{\ test{ }test{}\ \ {test}{\"e}}| & +% \ruled{\stretchwith{.}{\ test{ }test{}\ \ {test}{\"e}}}\\ +% |\makebox[1.5\width]{\stretchwith{\hfill}{test\ test}}| & +% \ruled{\makebox[1.5\width]{\stretchwith{\hfill}{test\ test}}} +% \end{tabular} +% \end{center} +% \StopEventually{} +% +% \section{The Implementation} +% \begin{macro}{\stretchwith} +% The command is implemented using |\@tfor| cycle. +% The |\@tempa| command contains a sequence to be inserted +% before the next token. It is set to |\relax| before the +% cycle and is set to \meta{foo} after every inserted token. +% This trick allows insert \meta{foo} \textbf{between} +% neighbour tokens only. +% \begin{macrocode} +%<*package> +\newcommand*\stretchwith[2]{% + \let\@tempa\relax + \def\@tempb{#1}% + \@tfor\@tempc:=#2\do {\@tempa \@tempc \let\@tempa\@tempb}% +} +%</package> +% \end{macrocode} +% \end{macro} +\endinput |