| 1 |
% \iffalse |
| 2 |
%% |
| 3 |
%% File: nccstretch.dtx Copyright (C) 2004 by Alexander I. Rozhenko |
| 4 |
%% |
| 5 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 6 |
%<package>\ProvidesPackage{nccstretch} |
| 7 |
%<package> [2004/11/30 v1.0 Text Stretch Package (NCC)] |
| 8 |
% |
| 9 |
% \changes{v1.0}{2004/11/30}{This version was uploaded to CTAN} |
| 10 |
% |
| 11 |
%<*driver> |
| 12 |
\let\makeindex\relax |
| 13 |
\documentclass{ltxdoc} |
| 14 |
\usepackage{nccstretch} |
| 15 |
\GetFileInfo{nccstretch.sty} |
| 16 |
\begin{document} |
| 17 |
\title{The \textsf{nccstretch} package\thanks{This file |
| 18 |
has version number \fileversion, last |
| 19 |
revised \filedate.}} |
| 20 |
\author{Alexander I. Rozhenko\\[email protected]} |
| 21 |
\date{\filedate} |
| 22 |
\maketitle |
| 23 |
\DocInput{nccstretch.dtx} |
| 24 |
\end{document} |
| 25 |
%</driver> |
| 26 |
% \fi |
| 27 |
% \section{User Interface} |
| 28 |
% |
| 29 |
% \DescribeMacro{\stretchwith} |
| 30 |
% The package implements the command |
| 31 |
% \begin{quote} |
| 32 |
% |\stretchwith|\marg{foo}\marg{text} |
| 33 |
% \end{quote} |
| 34 |
% that stretches the \meta{text} parameter inserting the |
| 35 |
% \meta{foo} sequence between every pair of neighbour tokens of |
| 36 |
% the \meta{text}. Spaces in the text are ignored. So, to save |
| 37 |
% a space, you need to insert a backslash before it or enclose |
| 38 |
% a space in braces. If you do not want to insert \meta{foo} |
| 39 |
% between some tokens, enclose them in braces. While stretching, |
| 40 |
% all first-level braces are removed. The examples below |
| 41 |
% show some use cases (we delimit the results with rules to show |
| 42 |
% exactly how the command works): |
| 43 |
% \begin{center}\small% |
| 44 |
% \newcommand*\ruled[1]{\rule{.4pt}{2ex}#1\rule{.4pt}{2ex}}% |
| 45 |
% \begin{tabular}{@{}l@{\qquad}l@{}} |
| 46 |
% \textbf{Command} & \textbf{Result}\\ |
| 47 |
% |\stretchwith{\,}{Proof\ of\ Theorem\ 1}| & |
| 48 |
% \ruled{\stretchwith{\,}{Proof\ of\ Theorem\ 1}}\\ |
| 49 |
% |\stretchwith{.}{\ test{ }test{}\ \ {test}{\"e}}| & |
| 50 |
% \ruled{\stretchwith{.}{\ test{ }test{}\ \ {test}{\"e}}}\\ |
| 51 |
% |\makebox[1.5\width]{\stretchwith{\hfill}{test\ test}}| & |
| 52 |
% \ruled{\makebox[1.5\width]{\stretchwith{\hfill}{test\ test}}} |
| 53 |
% \end{tabular} |
| 54 |
% \end{center} |
| 55 |
% \StopEventually{} |
| 56 |
% |
| 57 |
% \section{The Implementation} |
| 58 |
% \begin{macro}{\stretchwith} |
| 59 |
% The command is implemented using |\@tfor| cycle. |
| 60 |
% The |\@tempa| command contains a sequence to be inserted |
| 61 |
% before the next token. It is set to |\relax| before the |
| 62 |
% cycle and is set to \meta{foo} after every inserted token. |
| 63 |
% This trick allows insert \meta{foo} \textbf{between} |
| 64 |
% neighbour tokens only. |
| 65 |
% \begin{macrocode} |
| 66 |
%<*package> |
| 67 |
\newcommand*\stretchwith[2]{% |
| 68 |
\let\@tempa\relax |
| 69 |
\def\@tempb{#1}% |
| 70 |
\@tfor\@tempc:=#2\do {\@tempa \@tempc \let\@tempa\@tempb}% |
| 71 |
} |
| 72 |
%</package> |
| 73 |
% \end{macrocode} |
| 74 |
% \end{macro} |
| 75 |
\endinput |