diff options
author | Karl Berry <karl@freefriends.org> | 2012-03-21 00:51:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-03-21 00:51:57 +0000 |
commit | db2ed0df6d72baba823361771569da548892c8ad (patch) | |
tree | b7caf137d1128860dd37e5bc4b045f016c2bf8aa /Master/texmf-dist | |
parent | 05e9b1f2ec14170945f72dc4c04cb6fd607a968a (diff) |
monofill (20mar12)
git-svn-id: svn://tug.org/texlive/trunk@25713 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/monofill/README | 36 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/monofill/monofill.pdf | bin | 0 -> 320639 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/monofill/monofill.tex | 166 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/monofill/srcfiles.tex | 12 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/monofill/monofill.sty | 188 |
5 files changed, 402 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/monofill/README b/Master/texmf-dist/doc/latex/monofill/README new file mode 100644 index 00000000000..797203767d4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/monofill/README @@ -0,0 +1,36 @@ + README for the `monofill' package + (C) Uwe Lueck 2012/03/19 + + +`monofill.sty' addresses horizontal alignment with plain text +as in the result of LaTeX's \listfiles, extending the +longnamefilelist package for ideas by Martin Muench. +It may also be useful for alignment in typesetting monospaced +characters as in figure tables, for simulating a typewriter, +or for code listings. The implementation also has "philosophical +aspects," avoiding use of a counter register. + +The package file `monofill.sty' and the documentation files +`monofill.pdf' and `monofill.tex' can be redistributed and/or +modified under the terms of the LaTeX Project Public License; +either version 1.3c of the License, or any later version, see + + http://www.latex-project.org/lppl.txt + +There is NO WARRANTY, actually this is somewhat experimental. + +The `monofill' package is author-maintained in the sense of +this license. + +The latest public version of the package is available at + + http://mirror.ctan.org/macros/latex/contrib/monofill/ + +A TDS version of the package is available as + + http://mirror.ctan.org/install/macros/latex/contrib/monofill.tds.zip + +Please report bugs, problems, and suggestions via + + http://www.contact-ednotes.sty.de.vu + diff --git a/Master/texmf-dist/doc/latex/monofill/monofill.pdf b/Master/texmf-dist/doc/latex/monofill/monofill.pdf Binary files differnew file mode 100644 index 00000000000..7b6828bbbb9 --- /dev/null +++ b/Master/texmf-dist/doc/latex/monofill/monofill.pdf diff --git a/Master/texmf-dist/source/latex/monofill/monofill.tex b/Master/texmf-dist/source/latex/monofill/monofill.tex new file mode 100644 index 00000000000..af02563081a --- /dev/null +++ b/Master/texmf-dist/source/latex/monofill/monofill.tex @@ -0,0 +1,166 @@ +\ProvidesFile{monofill.tex}[2012/03/19 documenting monofill.sty] +\title{\textsf{monofill.sty}\\---\\Alignment with Plain Text\\ + or Monospaced Characters\thanks{This + document describes version + \textcolor{blue}{\UseVersionOf{\jobname.sty}} + of \textsf{\jobname.sty} as of \UseDateOf{\jobname.sty}.}} +% \listfiles +{ \RequirePackage{makedoc} \ProcessLineMessage{} + \MakeJobDoc{17}%% 2011/11/23 + {\SectionLevelTwoParseInput} } +\documentclass[fleqn]{article}%% TODO paper dimensions!? +\input{makedoc.cfg} +% \ReadPackageInfos{monofill} +% \usepackage{monofill} +\usepackage[fake-undefined]{monofill} +% \expandafter\show\csname MF@field@undeclared\endcsname +\sloppy +\begin{document} +\maketitle +\begin{abstract}\noindent +'monofill.sty' addresses horizontal alignment with plain text +as in the result of \LaTeX's `\listfiles', extending the +\ctanpkgref{longnamefilelist} package. +It may also be useful for alignment in typesetting monospaced +characters as in figure tables, for simulating a typewriter, +or for code listings.---The implementation also has ``philosophical +aspects," avoiding use of a counter register. +\end{abstract} +\tableofcontents + +% \newpage +\section{Features and Usage} +\subsection{Summary of Features} +A command |\MFfieldtemplate| sets the maximum width of a ``field" +using a template, +with an optional argument for the ``filler" token. +Then |\MFleftinfield| and |\MFrightinfield| types given +(one-line) text and adds ``filler" tokens to the left or right, +until the entire number of tokens es the number of characters +in the associated template. So this is a kind of analogue to +`\settowidth{\mylength}{<template>}', +`\makebox[\mylength][l]{<text>}', and +`\makebox[\mylength][r]{<text>}' +intended for plain text output, without typesetting. +See Sec.~\ref{sec:user} for details. + +\subsection{``Philosophical aspects"} +The package also has ``philosophical" aspects: \ +1.\enspace Apart from the declaration of the width of a ``field", +everything is \strong{expandable} (thinking of application with 'blog.sty' +of the \ctanpkgref{morehype} bundle) and thus is a kind of +\Wikienref{functional programming}. \ +2.\enspace Actually, \strong{no counter} is used, +and we seem to \emph{count without} using the \emph{concept of ``number."} +\ +Rather, we \ (a)\enspace just generate a new list from a given one such +that both have the same length and \ +(b)\enspace compare the lengths of two lists---both (a) and (b) +without \emph{determining} the length (which would be a \emph{number}) +of any list. + +\subsection{Installing and Calling} +The file 'monofill.sty' is provided ready, installation only requires +putting it somewhere where \TeX\ finds it +(which may need updating the filename data + base).\urlfoot{ukfaqref}{inst-wlcf} %% corr. 2011/02/08 + +%% extended 2011/01/14: +Below the `\documentclass' line(s) and above `\begin{document}', +you load 'monofill.sty' (as usually) by +\begin{verbatim} + \usepackage{monofill} +\end{verbatim} +For certain uses such as with \ctanpkgref{fileinfo}, +the package is better loaded by +\begin{verbatim} + \RequirePackage{monofill} +\end{verbatim} + +\subsection{Examples} +\subsubsection{Typewriter} +% \MFfieldtemplate{tt}{leftright} +% \MFfieldtemplate[\ ]{tt}{leftright} +% \MFfieldtemplate[~]{tt}{leftright} +% \MFfieldtemplate[X]{tt}{leftright} +With both \[`\MFfieldtemplate[\MFspace]{tt}{leftright}' \] +and \[`\MFfieldtemplate[\MFenspace]{tt}{leftright}'\] +followed by +\begin{verbatim} +\begin{quotation}\tt\noindent + !leftright!\\ + !\MFleftinfield{left}{tt}!\\ + !\MFrightinfield{right}{tt}!\\ + !\MFrightinfield{rightleft}{tt}! +\end{quotation} +\end{verbatim} +I get +% \MFfieldtemplate[\MFspace]{tt}{leftright} +\MFfieldtemplate[\MFenspace]{tt}{leftright} +% \MFfieldtemplate[\enspace]{tt}{leftright} +% \MFfieldtemplate[\kern.5em ]{tt}{leftright} +% \renewcommand*{\MFfillelement}{\kern.5em } +% \renewcommand*{\MFfillelement}{\hphantom\enspace} +\begin{quotation}\tt\noindent +% \enspace leftright\\ + !leftright!\\ + !\MFleftinfield{left}{tt}!\\ + !\MFrightinfield{right}{tt}!\\ + !\MFrightinfield{rightleft}{tt}! +% \enspace \MFrightinfield{rightleft}{tt} +\end{quotation} +\subsubsection{Figures} +Similarly, with +`\MFfieldtemplate[\MFenspace]{figs}{0000}' +and +\begin{verbatim} +\begin{quote}\noindent + \MFrightinfield{1}{figs} is one,\\ + \MFrightinfield{10}{figs} is ten,\\ + \MFrightinfield{100}{figs} is hundred,\\ + \MFrightinfield{1000}{figs} is thousand. +\end{quote} +\end{verbatim} +I get +\MFfieldtemplate[\MFenspace]{figs}{0000} +\begin{quote}\noindent + \MFrightinfield{1}{figs} is one,\\ + \MFrightinfield{10}{figs} is ten,\\ + \MFrightinfield{100}{figs} is hundred,\\ + \MFrightinfield{1000}{figs} is thousand. +\end{quote} +\subsubsection{Screen Output} +Finally, try +\begin{verbatim} +\MFfieldtemplate{screen}{0000} + \typeout{\MFrightinfield{1}{screen} is one,} + \typeout{\MFrightinfield{10}{screen} is ten,} + \typeout{\MFrightinfield{100}{screen} is hundred,} + \typeout{\MFrightinfield{1000}{screen} is thousand.} +\typein{OK?} +\end{verbatim} +It works, believe me. +% \MFfieldtemplate{screen}{0000} +% \typeout{\MFrightinfield{1}{screen} is one,} +% \typeout{\MFrightinfield{10}{screen} is ten,} +% \typeout{\MFrightinfield{100}{screen} is hundred,} +% \typeout{\MFrightinfield{1000}{screen} is thousand.} +% \typein{OK?} + +% \pagebreak +% \section{Implementation} +\section{Package File Header (Legalize)} +\input{monofill.doc} + +\section{Credit} +The package actually is motivated by good ideas of Martin Muench's about +extending the \ctanpkgref{longnamefilelist} package. + +\end{document} + +VERSION HISTORY + +2012/03/18 for v0.1 started +2012/03/19 completed + + diff --git a/Master/texmf-dist/source/latex/monofill/srcfiles.tex b/Master/texmf-dist/source/latex/monofill/srcfiles.tex new file mode 100644 index 00000000000..ad749db2171 --- /dev/null +++ b/Master/texmf-dist/source/latex/monofill/srcfiles.tex @@ -0,0 +1,12 @@ +\ProvidesFile{srcfiles.tex}[2012/03/18 file infos -> SrcFILEs.txt] +\RequirePackage{myfilist} +\EmptyFileList %%% [readprov.sty,myfilist.sty] +%% packages: +\ReadPackageInfos{monofill} +%% documentation: +\ReadFileInfos{monofill} +%% documentation settings and auxiliaries: +\ReadPackageInfos{fifinddo,makedoc,niceverb} +\ReadFileInfos{makedoc.cfg,mdoccorr.cfg,srcfiles} +\ListInfos[SrcFILEs.txt] + diff --git a/Master/texmf-dist/tex/latex/monofill/monofill.sty b/Master/texmf-dist/tex/latex/monofill/monofill.sty new file mode 100644 index 00000000000..b0b55c01573 --- /dev/null +++ b/Master/texmf-dist/tex/latex/monofill/monofill.sty @@ -0,0 +1,188 @@ +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{monofill}[2012/03/19 v0.1 monospace alignment (UL)] + +%% Copyright (C) 2012 Uwe Lueck, +%% http://www.contact-ednotes.sty.de.vu +%% -- author-maintained in the sense of LPPL below -- +%% +%% This file can be redistributed and/or modified under +%% the terms of the LaTeX Project Public License; either +%% version 1.3c of the License, or any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% We did our best to help you, but there is NO WARRANTY. +%% +%% Please report bugs, problems, and suggestions via +%% +%% http://www.contact-ednotes.sty.de.vu +%% +%% == User Commands == +%% \label{sec:user} +%% |\MFfieldtemplate[<fill-element>]{<field>}{<template>}|\\[\smallskipamount] +%% determines the width of fields with id <field> to be the same +%% as of <template>: +\newcommand*{\MFfieldtemplate}[3][\MFfillelement]{% +%% % `\space' is the default <fill-element>, stored as first argument +%% % of `\MF@make@bg'. +%% `\@bg' delimits the ``background" or +%% ``filler list". The field id is stored at the end ahead. + \MF@make@bg#1#3\MF@store@field@bg\@bg{#2}} +%% `\MF@make@bg' is defined in Sec.~\ref{sec:field}. +%% \medskip\noindent %% TODO as in morgan.sty "vert. cmd. box" +%% |\MFfillelement| is the default for <fill-element>, +%% defined to be (like) `\space' here: +\newcommand*{\MFfillelement}{} \let\MFfillelement\space +%% <fill-element> \emph{must} be a \emph{``single item"} +%% (that \TeX\ converts into a single token, due to our +%% comparison mechanism), so for using somewhat more complex <complex> than `\space', +%% \[`\renewcommand*{\MFfillelement}{<complex>}'\] +%% must be used instead of the optional argument.---It was very hard +%% for me with \emph{typesetting}, what finally worked were +%% |\MFspace| and +%% |\MFenspace| as alternative optional arguments. +%% It is fine for half-quad spaces such as characters with `\tt' +%% figures with more Computer Modern fonts: +\newcommand*{\MFspace}{\mbox{ }} +% \newcommand*{\MFenspace}{\leavevmode\enspace} +\newcommand*{\MFenspace}{\mbox{\enspace}} +%% +%% \medskip\noindent %% TODO as in morgan.sty "vert. cmd. box" +%% |\MFleftinfield{<text>}{<field>}|\\[\smallskipamount] returns <text>, +%% followed by <fill-elements> to get as many elements +%% (characters) as the <template> associated with <field>: +\newcommand*{\MFleftinfield}{\MF@check@field l} +%% \smallskip\noindent +%% |\MFrightinfield{<text>}{<field>}| returns the <fill-elements> +%% before giving <text>: +\newcommand*{\MFrightinfield}{\MF@check@field r} +%% `\MF@check@field' is defined in Sec.~\ref{sec:text}. +%% +%% == Internal Commands == +%% === Tools === +%% We test arguments <arg> on emptiness by +%% |\MF@if@empty{<arg>}{<yes>}{<no>}|: +\newcommand*{\MF@if@empty}[1]{% + \ifx\MF@store@field@bg#1\MF@store@field@bg + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi} +%% |\MF@field| stores the name space for filling jobs: +\newcommand*{\MF@field}{MF@field:} +%% +%% === Field Declaration === +%% \label{sec:field} +%% |\MF@make@bg| essentially builds a list of as many filler elements +%% as the template has characters, using a loop macro `\MF@make@bg'. +%% The current list of filler elements is delimited by `\@bg'. +\def\MF@make@bg#1#2#3\MF@store@field@bg{% + \MF@if@empty{#3}% +%% First case: `#2' is the last template element. +%% We run `\MF@store@field@bg' with an additional filler +%% element:\footnote{Another run of `&\MF@make@bg fails' ...} + {\MF@store@field@bg#1}% +%% Second case: the filler list gets an additional element, +%% and the loop repeats: + {\MF@make@bg#1#3\MF@store@field@bg#1}% +} +%% |\MF@store@field@bg<background>\@bg{<field>}| +%% essentially stores the filler list (``<background>"), +%% or more precisely ... +\def\MF@store@field@bg#1\@bg#2{% +%% Here is the only assignment when the macros run: +%% a command \[`\MF@field:<field>{<text>}'\] +%% is defined.\footnote{This is the common, confusing way +%% to describe such situations. +%% Actually, the definition assigns a +%% macro meaning to a ``named token" +%% whose name is ```MF@field:<field>'". +%% \emph{Typing} `&\MF@field:<field>' won't work.} + \@namedef{\MF@field#2}##1{% + \MF@reduce@bg##1\rest@t#1\rest@f{##1}{#2}}} +%% +%% === Checking Field === +%% \label{sec:text} +%% |\MF@check@field{<align>}{<text>}{<field>}| +%% runs |\MF@field:<field>{<text>}| from above, +%% provided the latter has been defined (by `\MFfieldtemplate'). +%% The <align> command is appended. +\newcommand*{\MF@check@field}[3]{% + \@ifundefined{\MF@field#3}% +% {\PackageError{field "#3" not defined}% +% {use \string\MFfieldtemplate}}% +%% With v0.1, I thought about errors and warnings properly only +%% more below ... + {\MF@field@undeclared{#2}{#3}}% + {\csname\MF@field#3\endcsname{#2}#1}} +%% |\MF@field@undeclared{<text>}{<field>}| just outputs <text>. +\newcommand*{\MF@field@undeclared}[2]{#1} +%% A proper message is problematic in \strong{pure expansion} +%% as on screen or in \file{.log} files. +%% Package option |fake-undefined| (Sec.~\ref{sec:opt}) +%% offers another ``cheap" solution. +%% (TODO) +%% +%% === Trying Alignment === +%% |\MF@reduce@bg<r-text>\rest@t<r-fill>\rest@f{<text>}{<field>}<align>| +%% \\[\smallskipamount] +%% is invoked by that `\MF@field:<field>' that +%% `\MF@store@field@bg' defines as above. +%% It takes away one element both from the (remaining) <text> +%% (delimited by `\rest@t') and the filler list (delimited by `\rest@f'). +%% The full <text> has been stored ahead. +\def\MF@reduce@bg#1#2\rest@t#3#4\rest@f{% + \MF@if@empty{#2}% + {\MF@if@empty{#4}% +%% When we have removed the last elements of both lists at the same time, +%% we just return <text>: + \@firstofthree +%% When we have removed the last element of <text>, and there still is +%% a filler element, we perform the alignment: + {\MF@fine@align{#4}}}% + {\MF@if@empty{#4}% +%% When we have removed the last filler element, and a <text> element +%% is still present, we return <text>, maybe together with a warning: + \MF@bad@align +%% When neither #1 nor #3 have been the last elements in their lists, +%% we run `\MF@reduce@bg' on the remaining lists: + {\MF@reduce@bg#2\rest@t#4\rest@f}}} +%% |\@firstofthree{<use>}{<skip>}{<skip>}| may be known or not ... +\long\def\@firstofthree#1#2#3{#1} +%% |\MF@fine@align{<filler>}{<text>}{<field>}<align>| ... +\newcommand*{\MF@fine@align}[4]{\if r#4#1#2\else#2#1\fi} +%% |\MF@bad@align{<text>}{<field>}{<align>}|\\[\smallskipamount] +%% % gobbles <align>, +%% % throws a message about <text> and <field>, and outputs <text>. +%% % If this happens at \strong{pure expansion} such as writing +%% % to \emph{screen} or a \emph{plain text file}, something really +%% % awful may happen ... (we may adjust `\MF@bad@align' better +%% % for this case, another time ... TODO) +%% at present is similar to `\@firstofthree'. +%% In a future package version, we may add some warning or so +%% for cases where it is useful---while it is not useful to write +%% \emph{code} for warnings to screen and \file{.log} +%% (the originally intended use of the package). +%% We offer a ``cheap" possibility of throwing some error by +%% package option |fake-undefined|---see Sec.~\ref{sec:opt} +\newcommand*{\MF@bad@align}[3]{#1} +%% Actually, in v0.1 |\MF@check@field| appends the <field> +%% argument hoping it could be used in a warning. +%% +%% == Package Option == +%% \label{sec:opt} +%% With applications like `\listfiles', it may be useful to get an +%% ``undefined" error where the name of the undefined command +%% is a kind of ``secret message" ... +\DeclareOption{fake-undefined}{% +%% #1 is <text> and will be output, #2 is <field>, cf.~above. + \def\MF@field@undeclared#1#2{#1\monofillFieldUndeclared} + \def\MF@bad@align#1#2#3{#1\monofillFieldTooSmall}} +\ProcessOptions +%% == \cs{endinput} and Version HISTORY == +\endinput +%% +%% VERSION HISTORY + +v0.1 2012/03/18 started + 2012/03/19 completed + |