% \iffalse %% %% File: nccstretch.dtx Copyright (C) 2004 by Alexander I. Rozhenko %% %\NeedsTeXFormat{LaTeX2e} %\ProvidesPackage{nccstretch} % [2004/11/30 v1.0 Text Stretch Package (NCC)] % % \changes{v1.0}{2004/11/30}{This version was uploaded to CTAN} % %<*driver> \let\makeindex\relax \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} % % \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}% } % % \end{macrocode} % \end{macro} \endinput