From 71441df00e80ebb3470475a2317e5b324011624b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 20 Dec 2012 00:30:59 +0000 Subject: conceps (19dec12) git-svn-id: svn://tug.org/texlive/trunk@28579 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/concepts/README | 8 +- Master/texmf-dist/doc/latex/concepts/concepts.pdf | Bin 306995 -> 339208 bytes Master/texmf-dist/doc/latex/concepts/concepts.tex | 581 ++++++++++++++++++++ .../texmf-dist/source/latex/concepts/concepts.dtx | 434 --------------- Master/texmf-dist/tex/latex/concepts/concepts.sty | 582 ++++++++++++++------- Master/texmf-dist/tex/latex/concepts/dry.sty | 66 +++ Master/texmf-dist/tex/latex/concepts/with.sty | 103 ++++ Master/tlpkg/libexec/ctan2tds | 6 +- 8 files changed, 1158 insertions(+), 622 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/concepts/concepts.tex delete mode 100644 Master/texmf-dist/source/latex/concepts/concepts.dtx create mode 100644 Master/texmf-dist/tex/latex/concepts/dry.sty create mode 100644 Master/texmf-dist/tex/latex/concepts/with.sty diff --git a/Master/texmf-dist/doc/latex/concepts/README b/Master/texmf-dist/doc/latex/concepts/README index bdafc91e1ee..99bf38b3a79 100644 --- a/Master/texmf-dist/doc/latex/concepts/README +++ b/Master/texmf-dist/doc/latex/concepts/README @@ -1,6 +1,6 @@ -LaTeX Package : concepts v0.0.4 +LaTeX Package : concepts v0.0.5 -Last Modified : 2012-12-08 +Last Modified : 2012-12-18 Author : Michiel Helvensteijn (www.mhelvens.net) @@ -48,9 +48,9 @@ it in a place where your LaTeX distribution can find it. ===== Documentation ===== concepts.pdf is provided directly in the package archive. To -generate the documentation yourself, run LaTeX on concepts.dtx. +generate the documentation yourself, run LaTeX on concepts.tex. -(concepts.dtx does not contain the package code itself; it inputs +(concepts.tex does not contain the package code itself; it inputs concepts.sty directly to document the implementation) ===== License ===== diff --git a/Master/texmf-dist/doc/latex/concepts/concepts.pdf b/Master/texmf-dist/doc/latex/concepts/concepts.pdf index 156dc16cbf2..b6c5c697e51 100644 Binary files a/Master/texmf-dist/doc/latex/concepts/concepts.pdf and b/Master/texmf-dist/doc/latex/concepts/concepts.pdf differ diff --git a/Master/texmf-dist/doc/latex/concepts/concepts.tex b/Master/texmf-dist/doc/latex/concepts/concepts.tex new file mode 100644 index 00000000000..d8582de46e8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/concepts/concepts.tex @@ -0,0 +1,581 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Copyright (C) 2012 by Michiel Helvensteijn - www.mhelvens.net % +% % +% http://latex-concepts.googlecode.com % +% % +% This work may 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 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the files concepts.tex and concepts.sty. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% 'ltxdoc' to typeset the documentation +% +\documentclass[a4paper]{ltxdoc} + +%%% including the 'concepts' package itself +% +\usepackage{concepts}[2012/11/25] + +%%% including other packages we need +% +\usepackage{etextools} +\usepackage{etoolbox} +\usepackage{framed} +\usepackage{color} +\usepackage{marginnote} +\usepackage{listings} +\usepackage{lstautogobble} +\usepackage{textcomp} +\usepackage{ifthen} +\usepackage{atbegshi} +\usepackage{tikz} +\usepackage{amssymb} + +%%% including 'internal' package for setting and running +%%% code examples with a single source +% +\usepackage{dry} + +%%% skip any indentation directly after a code block or macro signature +% +\makeatletter + \newcommand*{\@noindentnext}{\everypar{{\setbox\z@\lastbox}\everypar{}}} + \AfterEndEnvironment{codeframe}{\@noindentnext} + \AfterEndEnvironment{uninterestingcodeframe}{\@noindentnext} + \apptocmd{\marg}{\@noindentnext}{}{} + \apptocmd{\oarg}{\@noindentnext}{}{} + \apptocmd{\parg}{\@noindentnext}{}{} + \pretocmd{\DescribeMacro}{\noindent\\}{}{} +\makeatother + +%%% documentation options +% +\EnableCrossrefs +\CodelineIndex +\RecordChanges + +%%% title and author information +% +\GetFileInfo{concepts.sty} +\title{The \textsf{concepts} package\thanks{% + This document corresponds to \textsf{concepts}~\fileversion, dated \filedate. + Development of this package is organized at \texttt{http://latex-concepts.googlecode.com}. + I am happy to receive feedback.% +}} +\author{Michiel Helvensteijn \\ \texttt{mhelvens+latex@gmail.com}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Changes % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\changes{0.0.1}{2012/11/16}{initial version} +\changes{0.0.2}{2012/11/25}{put the package into a .dtx file} +\changes{0.0.3}{2012/12/01}{separated the .dtx file from the .sty file} +\changes{0.0.4}{2012/12/08}{finished the documentation and made a few fixes} +\changes{0.0.5}{2012/12/18}{implemented symbol-list commands and improved documentation} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\maketitle + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Introduction and Motivation} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Documents with a lot of formal notation (such as papers about mathematics or +theoretical computer science) can introduce a number of concepts that need +to be managed. They'll have \emph{names}, \emph{descriptions} and associated +\emph{symbols} that need to be typeset, as well as \emph{relations} between them. + +I'm now writing my PhD thesis in the field of Theoretical Computer Science. +It will be especially heavy with definitions. I need to make sure that every +symbol is associated with no more than one concept and that all names and +symbols are consistently used. I'll also need to generate a glossary with +this information. But I don't want to manually keep track +of all that. It's error-prone and it takes time. I'd rather focus on the theory. + +There are already techniques and packages that help lighten the load: +\begin{itemize} + \item Rather than use any names or symbols directly in the text, declare + a macro for each one. If you ever need to change one, you'll only + have to do it in one place. You'll also be far less likely to + introduce any typos. + \item There are packages out there to keep track of and output a glossary% + \footnote{It is sometimes called a nomenclature. + The distinction is subtle.}. +\end{itemize} +But I'm not aware of any technique or package to ensure I'm not +using a name or symbol inconsistently, thereby potentially +confusing the reader. And even if there was, using all these techniques at the +same time is still a lot of overhead. + +I wrote the \textsf{concepts} package to automate all this stuff for me. Every +time I introduce a new concept in my thesis I `declare' it once. The package +then defines all necessary macros for me and checks that I'm using them +properly. + +In \textsf{concepts}~\fileversion{}, most of the above already works but it +cannot generate a glossary yet. In future versions, it will interface with +the \textsf{glossaries} package to accomplish this, and more. + +I'm also planning to implement a rudimentary typesystem, to catch even more +kinds of mistakes in symbol usage. There will also be additional ways of +typesetting concept-related stuff, such as useful sentence fragments. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Usage Prep % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%% formatting the code blocks +% +\setlength{\FrameSep}{0pt} +\setlength{\MacroIndent}{16pt} +\setlength{\MacrocodeTopsep}{2pt} +\newenvironment{codeframe}{% + \definecolor{shadecolor}{rgb}{.9,.9,.9}% + \begin{framed}% + \begin{shaded}% +}{% + \end{shaded}\vspace{-2.8mm}% + \end{framed}% +} + +%%% meta-optional arguments (that means: without explicit []) +% +\makeatletter + \newcommand*{\movarg}[1]{[ \verb|#1| ]\@noindentnext} + \newcommand*{\momarg}[1]{[ \meta{#1} ]\@noindentnext} +\makeatother + +%%% listings language for examples +% +\lstdefinelanguage{latex}{ + language=[LaTeX]tex, + moretexcs={detokenize, + NewConcept,ConceptOption,ConceptName,ConceptSymbol, + ConceptSymbols,ConceptNameAndSymbols, + delta,product,p,d,prd} +} + +\makeatletter + +%%% adding a border around content without putting it in a TeX group (scope) +% +\newcounter{boxcount}[page] +\newcommand{\boxstart}{% + \stepcounter{boxcount}% + \raisebox{1.6ex}{\ensuremath{\vcenter{\hbox{% + \tikz[remember picture, overlay]{\coordinate (start box \arabic{boxcount});}% + }}}}% +} +\newcommand{\boxend}{% + \raisebox{-1.6ex}{\ensuremath{\vcenter{\hbox{% + \tikz[remember picture, overlay]{\coordinate (end box \arabic{boxcount});}% + }}}}% +} +\AtBeginShipout{\AtBeginShipoutUpperLeft{% + \ifthenelse{\value{boxcount} > 0}{% + \tikz[remember picture,overlay]{% + \foreach \boxmarker in {1,...,\arabic{boxcount}}% + \draw[black]% + (start box \boxmarker) +(.07mm,0mm) rectangle% + (end box \boxmarker);% + }% + }{}% +}} + +%%% TeX example environments +% +\newlength{\texexamplespace} +\setlength{\texexamplespace}{1.2mm} +\NewDRYer{latex-example-show}{}{% + \addvspace{\texexamplespace}% + \noindent\begin{minipage}{\textwidth} + \begin{codeframe}% + \renewcommand{\ttdefault}{pcr}% + \vspace{-1mm}% + \lstinputlisting[% + language=latex,basicstyle=\ttfamily\small,% + texcsstyle=*\bfseries,% + upquote=true,% + tabsize=1% + ]{\DRYFilename}% + \vspace{-1mm}% + \end{codeframe}% + \end{minipage}\\[-.45mm] + \boxstart$\ $\DRYContent$\ $\boxend% + \@noindentnext\par\addvspace{\texexamplespace}% +} +\NewDRYer{latex-example}{}{% + \addvspace{\texexamplespace}% + \noindent\begin{minipage}{\textwidth} + \begin{codeframe}% + \renewcommand{\ttdefault}{pcr}% + \vspace{-1mm}% + \lstinputlisting[% + language=latex,basicstyle=\ttfamily\small,% + texcsstyle=*\bfseries,% + upquote=true,% + tabsize=1% + ]{\DRYFilename}% + \vspace{-1mm}% + \end{codeframe}% + \end{minipage}% + \DRYContent% + \@noindentnext\par\addvspace{\texexamplespace}% +} + +\makeatother + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Usage} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +In short: every concept first has to be declared using the |\NewConcept| macro. +Afterwards, its name and associated symbols can by typeset using other macros. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\NewConcept} + \marg{concept key} \oarg{options}\\ + +Every concept needs a unique \meta{concept key}, by which it will be identified +for the rest of the document. This key can also be used to automatically +derive the name of the concept as well as the macro used to typeset the name. + +Usually, you'll also want to add \meta{options}. This optional argument takes +a comma-separated list of |key=value| pairs. The following is a list of available +options. Note that the option names are case-sensitive: +% +\begin{description} +\item[name] the name of the concept\\ + --- default: \meta{concept key} +\item[Name] the capitalized name of the concept, for use in the beginning of + a sentence\\ + --- default: \meta{name} with the first letter capitalized +\item[plural] the plural form of the name\\ + --- default: \meta{name}|s| +\item[Plural] the capitalized, pluralized name of the concept\\ + --- default: \meta{plural} with the first letter capitalized +\item[namecmd] the `short' command that may be used to typeset the name of + this concept; this option *has* to be specified for + any command to be defined, but the |=value| part may + be omitted to get the default\\ + --- default: |\|\meta{concept key} +\item[symbols] a comma-separated list of symbols that may represent instances + of this concept, delimited by curly brackets\\ + --- default: |{}| (the empty list) +\item[symbolcmd] the `short' command that may be used to typeset a + specific symbol of this concept, given a numeric index +\end{description} + +\noindent Here are a few examples which will also be used to illustrate the other commands: + +\begin{latex-example} + \NewConcept{swproduct}[ + name = software product, % options 'plural', 'Plural' + Name = Software Product, % are implicitly defined + namecmd = \product, % defines \product + symbols = {p}, % p represents a product + symbolcmd = \p % defines \p + ] +\end{latex-example} + +\begin{latex-example} + \let\delta\relax % I won't be using the greek letter + \let\d\relax % or the 'dot under a letter' macro + + \NewConcept{delta}[ + namecmd, % defines \delta + symbols = {x, y, z}, % x, y and z represent deltas + symbolcmd = \d % defines \d + ] +\end{latex-example} + +There are certain restrictions on new concept declarations. You may +not use the same \meta{concept key} more than once. You may not use the same +symbol for more than one concept (this is a feature; the package will +report an error if you do). Also, both \meta{namecmd} and \meta{symbolcmd} are +subject to the rules governing |\newcommand|. They may not be reused, or you +will see a standard \LaTeX{} error. Finally, any value you supply must behave +properly in an expansion-only context, e.g. be robust. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\ConceptOption} + \marg{concept key} \marg{option key}\\\nopagebreak + +This command can be used to get back any option value given a +specific \meta{concept~key} and \meta{option key}. For example: + +\begin{latex-example-show} + \ConceptOption{delta}{Plural} +\end{latex-example-show} + +\begin{latex-example-show} + \edef\prd{\ConceptOption{swproduct}{namecmd}}% + {\ttfamily\expandafter\detokenize\expandafter{\prd}}% + expands to ``\prd''. +\end{latex-example-show} + +|\ConceptOption| is `fully expandable', meaning that it can expand at +least down to the value that was given to the option. (This is not (yet) +guaranteed for the other commands.) + +As you can observe from the |\product| example above, options that expect a +command sequence are stored with an accompanying |\noexpand|. That means that +in an |\edef| context, |\ConceptOption| expands down to the stored command but +no further. After that you can expand it further if you wish. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\ConceptName} + \movarg{\textasciicircum} \movarg{*} \marg{concept key}\\\nopagebreak + +With this command you can typeset the name of the concept with \meta{concept key} +in any of four forms. The |^| modifier gives you the capitalized version. The |*| +modifier gives you the plural version. The combination gives you both. The order +between |^| and |*| doesn't matter. + +\begin{latex-example-show} + \ConceptName^*{delta} can transform a \ConceptName{swproduct}. +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\noindent\\\marginnote{\meta{namecmd}} + \movarg{\textasciicircum} \movarg{*}\\\nopagebreak + +This is the `short' version of |\ConceptName|, specific for each concept that +was declared with the |namecmd| option. It supports the same modifiers. + +\begin{latex-example-show} + \delta^* can easily transform a \product. +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\ConceptSymbol} + \marg{concept key} \oarg{symbol index}\\\nopagebreak + +This command typesets a specific symbol associated with a a given concept. It is +always typeset in math mode. Specify the concept with the \meta{concept key} +and the symbol with the \meta{symbol index}. + +The index is 1-based and points to a place in the symbol list provided with the +concept options. If a concept has only one allocated symbol the index may be +omitted. If there is more than one symbol, the index is mandatory. + +\begin{latex-example-show} + \product^* have symbols like \ConceptSymbol{swproduct}. +\end{latex-example-show} + +\begin{latex-example-show} + $\ConceptSymbol{delta}[2] \cdot \ConceptSymbol{delta}[1] = + \ConceptSymbol{delta}[1] \cdot \ConceptSymbol{delta}[2]$ +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\noindent\\\marginnote{\meta{symbolcmd}} + \momarg{symbol index}\\\nopagebreak + +This is the `short' version of |\ConceptSymbol|, specific for each concept that +was declared with the |symbolcmd| option. The optional index is given directly +following the command itself. It doesn't need any delimiters. However, you are +allowed to use square brackets. See the list-variation of this short command +below. + +\begin{latex-example-show} + $(\d2 \cdot \d1)(\p) = \d2(\d1(\p)) = \d2(\p') = \p''$ +\end{latex-example-show} + +\noindent As you can see, this short construct requires a lot less space than the +full |\ConceptSymbol| command, so its use is recommended for readability. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\ConceptSymbols} + \marg{concept key} \oarg{separator} + \oarg{last separator} \marg{symbol indices}\\\nopagebreak + +This command typesets a \meta{separator} separated list of symbols associated +with the given concept, optionally with a different \meta{last separator}. Specify +the concept with the \meta{concept key} and the symbol-list with the +\meta{symbol indices}. \meta{separator} defaults to |,| and \meta{last separator} +defaults to \meta{separator}. The whole list is typeset in math mode, so if +you'd like a non-math delimiter, you need to use \verb|$| tokens. + +The indices are 1-based and point to a place in the symbol list provided with the +concept options. The index-list is mandatory, but can be empty. + +\begin{latex-example-show} + The symbols \ConceptSymbols{delta}{1,2,3} represent \delta*. +\end{latex-example-show} + +\begin{latex-example-show} + $\{\ConceptSymbols{delta}[;]{1,1,1}\}$ contains only \d1. +\end{latex-example-show} + +\begin{latex-example-show} + What about \ConceptSymbols{delta}[,][$ and $]{3, 2, 1}? +\end{latex-example-show} + +\begin{latex-example-show} + xx\ConceptSymbols{delta}{}xx +\end{latex-example-show} + +If you need any symbol in the resulting list to have some decoration (like a +prime, subscript or superscript) you can decorate the corresponding index +accordingly. This currently only works for decorations that would be specified +\emph{after} the symbol. Each element of \meta{symbol indices} still needs to +start with the index itself: + +\begin{latex-example-show} + \ldots such as the symbols in + $(\ConceptSymbols{delta}{1_1, 2'', 3^{\d1(\p)}})$. +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\noindent\\\marginnote{\meta{symbolcmd}} + \oarg{symbol indices}\\\nopagebreak + +This is the `short' version of |\ConceptSymbols|, specific for each concept that +was declared with the |symbolcmd| option. The \meta{symbol indices} list needs +to be delimited by square brackets as shown below. + +\begin{latex-example-show} + $\forall \d[1,2] \in D:\ \d1 \| \d2\ \Rightarrow\ {} + \exists \d[3'] \in D:\ \d1 \prec \d3' \land \d2 \prec \d3'$ +\end{latex-example-show} + +\begin{latex-example-show} + xx\d[]xx\p[]xx +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\DescribeMacro{\ConceptNameAndSymbols} + \movarg{\textasciicircum} \marg{concept key} + \oarg{separator} \oarg{last separator} + \marg{symbol indices}\\\nopagebreak + +This command is the `hybrid' version of |\ConceptName| and |\ConceptSymbols|. +It typesets the name of the concept followed by a \meta{separator} separated list +of symbols associated with the given concept, optionally with a different +\meta{last separator}. Specify the concept with the \meta{concept key} and the +symbol-list with \meta{symbol~indices}. \meta{separator} defaults to |,| and +\meta{last separator} defaults to |$ and $|. The name is typeset in text mode and +the list is typeset in math mode. + +The indices are 1-based and point to a place in the symbol list provided with the +concept options. The index-list is mandatory and cannot be empty. + +You can still supply the |^| modifier to capitalize the name but the choice +between singular and plural form is determined by the number of \meta{symbol indices}. + +\begin{latex-example-show} + We use \ConceptNameAndSymbols{delta}[,][$ and also $]{1,2,3}. +\end{latex-example-show} + +For some other neat tricks, read the documentation of |\ConceptSymbols| above. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\noindent\\\marginnote{\meta{namecmd}} + \movarg{\textasciicircum} \oarg{symbol indices}\\\nopagebreak + +This is a `short' version of |\ConceptNameAndSymbols|, +specific for each concept that was declared with the |namecmd| option. +The \meta{symbol indices} list needs to be delimited by square brackets +as shown below. The list is comma-delimited and the last (or only) delimiter is +the word `and'. + +\begin{latex-example-show} + \delta^[1,2] come before \delta[3]. +\end{latex-example-show} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Future Work} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Everything up to this version of the package has been a bit of an experiment +for me. A way to get me started. I may still fix one or two issues for the +0.0.x series, but I will soon start from scratch with all I've learned. + +There will be two major changes starting from version 0.1.0. First of all, the +package will be built on top of the |glossaries| package, which already does +much of the work I'm now doing manually. This was always the plan, as we'll +want to typeset a glossary with our concepts, and I don't want to reinvent +the wheel. The |glossaries| package is actively developed and has a great +amount of features we can take advantage of. Secondly, I will program the +0.1.0 series using \LaTeX3. + +Here is an incomplete list of the features I am planning to implement: +\begin{itemize} + \item full integration with the \textsf{glossaries} package + \item commands to \emph{modify} existing concepts + \item typesetting a \emph{summary} of the concepts introduced in each chapter / section + \item management of \emph{tuples} and \emph{sets} of concept instances + \item management of \emph{subconcepts} plus a rudimentary \emph{typesystem} that + ensures concept instances are not used where a different concept is expected +\end{itemize} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Implementation Prep % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\makeatletter +\renewenvironment{codeframe}{% + \definecolor{shadecolor}{rgb}{.9,.9,.9}% + \begin{shaded}% +}{% + \end{shaded}% +} + +\newenvironment{uninterestingcodeframe}{% + \vspace{-5mm}% + \definecolor{shadecolor}{rgb}{.97,.97,.97}% + \begin{shaded}% + \definecolor{uninterestingcodecolor}{rgb}{.4,.4,.4}% + \let\old@macro@font\macro@font% + \def\macro@font{\color{uninterestingcodecolor}\old@macro@font}% +}{% + \end{shaded}% +} +\makeatother + +\StopEventually{ + \PrintChanges +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Implementation} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +We now show and explain the entire implementation in |concepts.sty|. + +\DocInput{concepts.sty} + +\Finale + +\PrintIndex + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\end{document} % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/source/latex/concepts/concepts.dtx b/Master/texmf-dist/source/latex/concepts/concepts.dtx deleted file mode 100644 index 2fd174bb89a..00000000000 --- a/Master/texmf-dist/source/latex/concepts/concepts.dtx +++ /dev/null @@ -1,434 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% Copyright (C) 2012 by Michiel Helvensteijn - www.mhelvens.net % -% % -% http://latex-concepts.googlecode.com % -% % -% This work may 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 2005/12/01 or later. % -% % -% This work has the LPPL maintenance status `author-maintained'. % -% % -% The Current Maintainer of this work is Michiel Helvensteijn. % -% % -% This work consists of the files concepts.dtx and concepts.sty. % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%% 'ltxdoc' to typeset the documentation -% -\documentclass[a4paper]{ltxdoc} - -%%% including the 'concepts' package itself -% -\usepackage{concepts}[2012/11/25] - -%%% including other packages we need -% -\usepackage{etextools} -\usepackage{etoolbox} -\usepackage{framed} -\usepackage{color} -\usepackage{marginnote} -\usepackage{listings} %1 syntax highlighting -\usepackage{lstautogobble} %2 ignore common indentation - -%%% skip any indentation directly after a code block or macro signature -% -\makeatletter - \newcommand*{\@noindentnext}{\everypar{{\setbox\z@\lastbox}\everypar{}}} - \AfterEndEnvironment{codeframe}{\@noindentnext} - \AfterEndEnvironment{uninterestingcodeframe}{\@noindentnext} - \apptocmd{\marg}{\@noindentnext}{}{} - \apptocmd{\oarg}{\@noindentnext}{}{} - \apptocmd{\parg}{\@noindentnext}{}{} - \pretocmd{\DescribeMacro}{\noindent\\}{}{} -\makeatother - -%%% documentation options -% -\EnableCrossrefs -\CodelineIndex -\RecordChanges - -%%% title and author information -% -\GetFileInfo{concepts.sty} -\title{The \textsf{concepts} package\thanks{% - This document corresponds to \textsf{concepts}~\fileversion, dated \filedate.% - Development of this package is organized at \texttt{http://latex-concepts.googlecode.com}.% - I am happy to receive feedback there.% -}} -\author{Michiel Helvensteijn \\ \texttt{mhelvens+latex@gmail.com}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Changes % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\changes{0.0.1}{2012/11/16}{initial version} -\changes{0.0.2}{2012/11/25}{put the package into a .dtx file} -\changes{0.0.3}{2012/12/01}{separated the .dtx file from the .sty file} -\changes{0.0.4}{2012/12/08}{finished the documentation and made a few fixes} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{document} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\maketitle - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Introduction and Motivation} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -Documents with a lot of formal notation (such as papers about mathematics or -theoretical computer science) can introduce a number of concepts that need -to be managed. They'll have \emph{names}, \emph{descriptions} and associated -\emph{symbols} that need to be typeset, as well as \emph{relations} between them. - -I'm now writing my PhD thesis in the field of Theoretical Computer Science. -It will be especially heavy with definitions. I need to make sure that every -symbol is associated with no more than one concept and that all names and -symbols are consistently used. I'll also need to generate a glossary with -this information. But I don't want to manually keeping track -of all that. It's error-prone and it takes time. I'd rather focus on the theory. - -There are already techniques and packages that help lighten the load: -\begin{itemize} - \item Rather than use any names or symbols directly in the text, declare - a macro for each one. If you ever need to change one, you'll only - have to do it in one place. You'll also be far less likely to - introduce any typos. - \item There are packages out there to keep track of and output a glossary% - \footnote{It is sometimes called a nomenclature. - The distinction is subtle.}. -\end{itemize} -But I'm not aware of any technique or package to ensure I'm not -using a name or symbol inconsistently, thereby potentially -confusing the reader. And even if there was, this is all still a lot of -overhead. - -I wrote the |concepts| package to automate all this stuff for me. Every -time I introduce a new concept in my thesis I `declare' it once. The package -then defines all necessary macros for me and checks that I'm using them -properly. - -In \textsf{concepts}~\fileversion{}, most of the above already works but it -cannot generate a glossary yet. In future versions, it will interface with -the \textsf{glossaries} package to accomplish this. - -I'm also planning to implement a rudimentary typesystem, to catch even more -kinds of mistakes in symbol usage. There will also be additional ways of -typesetting concept-related stuff, such as useful sentence fragments. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Usage Prep % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%%% formatting the code blocks -% -\setlength{\FrameSep}{0pt} -\setlength{\MacroIndent}{16pt} -\setlength{\MacrocodeTopsep}{2pt} - -%%% switching between relevant and uninteresting code block coloring -% -\makeatletter - \definecolor{uninterestingcodecolor}{rgb}{.4,.4,.4} - \let\old@macro@font\macro@font - - \newenvironment{codeframe}{% - \definecolor{shadecolor}{rgb}{.9,.9,.9}% - \begin{shaded}% - }{% - \end{shaded}% - } - - \newenvironment{uninterestingcodeframe}{% - \vspace{-5mm}% - \definecolor{shadecolor}{rgb}{.97,.97,.97}% - \begin{shaded}% - \def\macro@font{\color{uninterestingcodecolor}\old@macro@font}% - }{% - \end{shaded}% - } -\makeatother - -%%% meta-optional arguments (that means: without explicit []) -% -\makeatletter - \newcommand*{\movarg}[1]{[ \verb|#1| ]\@noindentnext} - \newcommand*{\momarg}[1]{[ \meta{#1} ]\@noindentnext} -\makeatother - -%%% code blocks for examples -% -\lstdefinelanguage{latex}{ - language=[LaTeX]tex, - moretexcs={detokenize, - NewConcept,ConceptOption,ConceptName,ConceptSymbol, - delta,product,p,d,prd}, - texcsstyle=*\bfseries -} - -\lstnewenvironment{latexcode}{% - \renewcommand{\ttdefault}{pcr}% - \lstset{language=latex,basicstyle=\ttfamily\small,autogobble=true}% -}{} - -\BeforeBeginEnvironment{latexcode}{\noindent\begin{codeframe}\noindent\begin{minipage}{\textwidth}\vspace{-2mm}} -\AfterEndEnvironment{latexcode}{\vspace{-2mm}\end{minipage}\end{codeframe}} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Usage} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -In short: every concept first has to be declared using the |\NewConcept| macro. -Afterwards, its name and associated symbols can by typeset using other macros. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\DescribeMacro{\NewConcept} - \marg{concept key} \oarg{options}\\ - -Every concept needs a unique \meta{concept key}, by which it will be identified -for the rest of the document. This key can also be used to automatically -derive the name of the concept as well as the macro used to typeset the name. - -Usually, you'll also want to add \meta{options}. This optional argument takes -a comma-separated list of |key=value| pairs. The following is a list of available -options. Note that the option names are case-sensitive: -% -\begin{description} -\item[name] the name of the concept\\ - --- default: \meta{concept key} -\item[Name] the capitalized name of the concept, for use in the beginning of - a sentence\\ - --- default: \meta{name} with the first letter capitalized -\item[plural] the plural form of the name\\ - --- default: \meta{name}|s| -\item[Plural] the capitalized, pluralized name of the concept\\ - --- default: \meta{plural} with the first letter capitalized -\item[namecmd] the `short' command that may be used to typeset the name of - this concept; this option *has* to be specified for - any command to be defined, but the |=value| part may - be omitted to get the default\\ - --- default: |\|\meta{concept key} -\item[symbols] a comma-separated list of symbols that may represent instances - of this concept, delimited by curly brackets\\ - --- default: |{}| (the empty list) -\item[symbolcmd] the `short' command that may be used to typeset a - specific symbol of this concept, given a numeric index -\end{description} - -\noindent Here are a few examples which will also be used to illustrate the other commands: - -\begin{latexcode} - \NewConcept{swproduct}[ - name = software product, % options 'plural', 'Plural' - Name = Software Product, % are implicitly defined - namecmd = \product, % defines \product - symbols = {p, q, r}, % p, q, r represent products - symbolcmd = \p % defines \p - ] -\end{latexcode}\vspace{-4mm} - - \NewConcept{swproduct}[ - name = software product, % options 'plural', 'Plural' - Name = Software Product, % are implicitly defined - namecmd = \product, % defines \product - symbols = {p, q, r}, % p, q, r represent products - symbolcmd = \p % defines \p - ] - -\begin{latexcode} - \let\delta\relax % I won't be using the greek letter - \let\d\relax % or the 'dot under a letter' macro - - \NewConcept{delta}[ - namecmd, % defines \delta - symbols = {x, y, z}, % x, y and z represent deltas - symbolcmd = \d % defines \d - ] -\end{latexcode} - - \let\delta\relax % I won't be using the greek letter - \let\d\relax % or the 'dot under a letter' macro - - \NewConcept{delta}[ - namecmd, % defines \delta - symbols = {x, y, z}, % x, y and z represent deltas - symbolcmd = \d % defines \d - ] - -\noindent There are certain restrictions on new concept declarations. You may -not use the same \meta{concept key} more than once. You may not use the same -symbol for more than one concept (this is a feature; the package will -report an error if you do). Also, both \meta{namecmd} and \meta{symbolcmd} are -subject to the rules governing |\newcommand|. They may not be reused, or you -will see a standard \LaTeX{} error. Finally, any value you supply must behave -properly in an expansion-only context, e.g. be robust. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\DescribeMacro{\ConceptOption} - \marg{concept key} \marg{option key}\\ - -This command can be used to get back any option value given a -specific \meta{concept key} and \meta{option key}. For example: - -\begin{latexcode} - \ConceptOption{delta}{Plural} -\end{latexcode} - -\noindent\fbox{\ConceptOption{delta}{Plural}} - -\begin{latexcode} - \edef\prd{\ConceptOption{swproduct}{namecmd}} - {\ttfamily\expandafter\detokenize\expandafter{\prd}}% - expands to ``\prd'' -\end{latexcode} - -\noindent\fbox{% - \edef\prd{\ConceptOption{swproduct}{namecmd}}% - {\ttfamily\expandafter\detokenize\expandafter{\prd}}% - expands to ``\prd''% -}\\ - -\noindent |\ConceptOption| is `fully expandable', meaning that it can expand at -least down to the value that was given to the option. This is not guaranteed for -the |\ConceptName| and |\ConceptSymbol| commands, for instance. - -As you can observe from the |\product| example above, options that expect a -command sequence are stored with an accompanying |\noexpand|. That means that -in an |\edef| context, |\ConceptOption| expands down to the stored command but -no further. After that you can expand it further if you wish. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\DescribeMacro{\ConceptName} - \movarg{\textasciicircum} \movarg{*} \marg{concept key}\\ - -With this command you can typeset the name of the concept with \meta{concept key} -in any of four forms. The |^| modifier gives you the capitalized version. The |*| -modifier gives you the plural version. The combination gives you both. The order -between |^| and |*| doesn't matter. - -\begin{latexcode} - \ConceptName^*{delta} can transform a \ConceptName{swproduct}. -\end{latexcode} - -\noindent\fbox{\ConceptName^*{delta} can transform a \ConceptName{swproduct}.} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\noindent\\\marginnote{\meta{namecmd}} - \movarg{\textasciicircum} \movarg{*}\\ - -This is the `short' version of |\ConceptName|, specific for each concept that -was declared with the |namecmd| option. It also supports the same modifiers. - -\begin{latexcode} - \delta^* can easily transform a \product. -\end{latexcode} - -\noindent\fbox{\delta^* can easily transform a \product.} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\DescribeMacro{\ConceptSymbol} - \marg{concept key} \oarg{symbol index}\\ - -This command typesets a specific symbol associated with a a given concept. Specify -the concept by providing the \meta{concept key} and the symbol by giving the -\meta{symbol index}. - -The index is 1-based and points to a place in the symbol list provided with the -concept options. If a concept has only one allocated symbol the index may be -omitted. If there is more than one symbol, the index is mandatory. - -\begin{latexcode} - $\ConceptSymbol{delta}[2] \cdot \ConceptSymbol{delta}[1] = - \ConceptSymbol{delta}[1] \cdot \ConceptSymbol{delta}[2]$ -\end{latexcode} - -\noindent\fbox{% - $\ConceptSymbol{delta}[2] \cdot \ConceptSymbol{delta}[1] = - \ConceptSymbol{delta}[1] \cdot \ConceptSymbol{delta}[2]$% -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\noindent\\\marginnote{\meta{symbolcmd}} - \momarg{symbol index}\\ - -This is the `short' version of |\ConceptSymbol|, specific for each concept that -was declared with the |symbolcmd| option. The optional index is given directly -following the command itself (optionally with whitespace inbetween). To be -clear: the index doesn't need any delimiters. - -\begin{latexcode} - $(\d2 \cdot \d1)(\p1) = \d2(\d1(\p1)) = \d2(\p1') = \p1''$ -\end{latexcode} - -\noindent\fbox{$(\d2 \cdot \d1)(\p1) = \d2(\d1(\p1)) = \d2(\p1') = \p1''$}\\ - -\noindent As you can see, this short construct requires a lot less space than the full -|\ConceptSymbol| command, so its use is recommended for readability. - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Future Work} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -Everything up to this version of the package has been a bit of an experiment -for me. A way to get me started. I may still fix one or two issues for the -0.0.x series, but I will soon start from scratch with all I've learned. - -There will be two major changes starting from version 0.1.0. First of all, the -package will be built on top of the |glossaries| package, which already does -much of the work I'm now doing manually. This was always the plan, as we'll -want to typeset a glossary with our concepts, and I don't want to reinvent -the wheel. The |glossaries| package is actively developed and has a great -amount of features we can take advantage of. Secondly, I will program the -0.1.0 series using \LaTeX$_3$. - -Here is an incomplete list of the features I am planning to implement: -\begin{itemize} - \item full integration with the \textsf{glossaries} package - \item commands to \emph{modify} existing concepts - \item typesetting a \emph{summary} of the concepts introduced in each chapter / section - \item typesetting \emph{sentence fragments} such as \fbox{\vphantom{W}$\d1, \d2, \d3$} - using only the code |\d[1,2,3]| - or \fbox{deltas $\d1, \d2, \d3$} using only |\delta[1,2,3]| - \item management of \emph{tuples} and \emph{sets} of concept instances - \item management of \emph{subconcepts} plus a rudimentary \emph{typesystem} that - ensures concept instances are not used where a different concept is expected -\end{itemize} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Implementation Prep % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\StopEventually{ - \PrintChanges -} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Implementation} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -We now show and explain the entire implementation in |concepts.sty|. - -\DocInput{concepts.sty} - -\Finale - -\PrintIndex - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\end{document} % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/latex/concepts/concepts.sty b/Master/texmf-dist/tex/latex/concepts/concepts.sty index a2f63f7f987..95e1c606d75 100644 --- a/Master/texmf-dist/tex/latex/concepts/concepts.sty +++ b/Master/texmf-dist/tex/latex/concepts/concepts.sty @@ -7,7 +7,7 @@ % This work may 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 % +% 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 2005/12/01 or later. % % % @@ -15,11 +15,11 @@ % % % The Current Maintainer of this work is Michiel Helvensteijn. % % % -% This work consists of the files concepts.dtx and concepts.sty. % +% This work consists of the files concepts.tex and concepts.sty. % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% -% \CheckSum{175} +% \CheckSum{0} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -38,16 +38,20 @@ % Right brace \} Tilde \~} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \subsection{Package Info} % +% \subsection{Package Info} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % \begin{codeframe}\begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{concepts}[2012/12/08 0.0.4 - managing names and symbols of document specific formal concepts] +\ProvidesPackage{concepts}[2012/12/18 0.0.5 + managing names and symbols of document specific formal concepts] % \end{macrocode}\end{codeframe} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -57,6 +61,8 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % These are the packages we'll need. % % \begin{codeframe}\begin{macrocode} @@ -68,9 +74,11 @@ \RequirePackage{xstring} % \end{macrocode}\end{codeframe} % -% We need a very recent version of |ltxkeys| in order to properly handle -% list-values. Note that |xparse| needs to be loaded before |ltxkeys| or -% things go wrong somehow. +% We need a very recent version of |ltxkeys| in order to +% properly handle list-values. Note that |xparse| needs +% to be loaded before |ltxkeys| or things go wrong somehow. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -82,11 +90,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{macro}{\cnc@d} \marg{identifier} -%%% \begin{macro}{\cnc@g} \marg{identifier}\\ +%%% \begin{macro}{\cnc@g} \marg{identifier}\\\nopagebreak % -% This package needs to store and retrieve a lot of data. To make the rest of -% the code more readable, we define the following commands. They allow a more -% freeform description of the data. +% This package needs to store and retrieve a lot of data. To make +% the rest of the code more readable, we define the following commands. +% They allow a more freeform description of the data. % % |\cnc@d| returns a control sequence name that resolves % to a specific piece of data in |\csname| context. @@ -99,12 +107,12 @@ % % Both take an identifier of one the following shapes: % \begin{itemize} -% \item |concepts| -% \item |concept|\parg{name}|.option|\parg{name} -% \item |concept|\parg{name}|.option|\parg{name}|.given| -% \item |concept|\parg{name}|.option|\parg{name}|.count| -% \item |concept|\parg{name}|.option|\parg{name}|.index|\parg{number} -% \item |symbol|\parg{name}|.concept| +% \item |concepts| +% \item |concept|\parg{name}|.option|\parg{name} +% \item |concept|\parg{name}|.option|\parg{name}|.given| +% \item |concept|\parg{name}|.option|\parg{name}|.count| +% \item |concept|\parg{name}|.option|\parg{name}|.index|\parg{number} +% \item |symbol|\parg{name}|.concept| % \end{itemize} % %\end{macro}\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -118,10 +126,11 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\cnc@upper} \marg{string}\\ +%%% \begin{macro}{\cnc@upper} \marg{string}\\\nopagebreak % -% We're going to need a command that capitalizes the first letter of a string -% which fully expands its argument. So here it is. +% We're going to need a command that capitalizes the first +% letter of a string which fully expands its argument. So +% here it is. % % \begin{codeframe}\begin{macrocode} \newcommand*{\cnc@upper}[1]{\ExpandAftercmds\MakeUppercase{#1}} @@ -132,17 +141,42 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\cnc@grabnumber} \marg{token sequence containing \#1} \momarg{number}\\ + % \begin{macro}{\cnc@grabnumber} \marg{token sequence containing \#1} +%%% \momarg{number}\\\nopagebreak % -% This is a command we're going to use for the automatically defined short -% symbol macros later. It has one 'real' mandatory argument and then it -% captures all numerals (0\ldots 9) that follow it. These numerals are then substituted -% for all occurrences of \#1 in the mandatory argument which is then `returned'. +% This is a command we're going to use for the automatically +% defined short symbol macros later. It has one 'real' +% mandatory argument and then it captures all numerals +% (0\ldots 9) that follow it. These numerals are then +% substituted for all occurrences of \#1 in the mandatory +% argument which is then `returned'. % % \begin{codeframe}\begin{macrocode} \newcommand{\cnc@grabnumber}[1]{% - \def\cnc@dowithnum##1{#1}% - \futuredef[0123456789]{\cnc@@n}{\cnc@dowithnum{\cnc@@n}}% + \def\cnc@dowithnum##1{#1}% + \futuredef[0123456789]{\cnc@@n}% + {\expandafter\cnc@dowithnum\expandafter{\cnc@@n}}% +} +% \end{macrocode}\end{codeframe} +% +%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % \begin{macro}{\cnc@csvlistsize} \marg{csvlist} +%%% \marg{command sequence}\\\nopagebreak +% +% This macro takes a comma-separated list of\ldots anything, +% and stores its size in the given macro as a simple decimal +% string. +% +% \begin{codeframe}\begin{macrocode} +\newcounter{cnc@listsize} +\newrobustcmd{\cnc@csvlistsize}[2]{% + \setcounter{cnc@listsize}{0}% + \def\do##1{\stepcounter{cnc@listsize}}\docsvlist{#1}% + \edef#2{\arabic{cnc@listsize}}% } % \end{macrocode}\end{codeframe} % @@ -158,7 +192,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{macro}{\cnc@conceptname} \marg{plural} \marg{capitalized} -%%% \marg{plural} \marg{concept key}\\ +%%% \marg{plural} \marg{concept key}\\\nopagebreak % % This typesets the name of a specific concept in one of four forms. It % can be capitalized or not; and it can be singular or plural. We define @@ -179,31 +213,31 @@ % package error. % % \begin{codeframe}\begin{macrocode} - \ifboolexpr{ test{\IfBooleanTF{#1}} and test{\IfBooleanTF{#3}} }{% - \PackageError{concepts}% - {You used the * modifier twice; once is enough}% - {I will pretend you just used one *.}% - }{}% + \ifboolexpr{ test{\IfBooleanTF{#1}} and test{\IfBooleanTF{#3}} }{% + \PackageError{concepts}% + {You used the * modifier twice; once is enough}% + {I will pretend you just used one *.}% + }{}% % \end{macrocode}\end{codeframe} % % And then we simply typeset the correct value from our datastore. % % \begin{codeframe}\begin{macrocode} - \ifboolexpr{ test{\IfBooleanTF{#1}} or test{\IfBooleanTF{#3}} }{% - \IfBooleanTF{#2}% - {\cnc@g{concept(#4).option(Plural)}}% - {\cnc@g{concept(#4).option(plural)}}% - }{% - \IfBooleanTF{#2}% - {\cnc@g{concept(#4).option(Name)}}% - {\cnc@g{concept(#4).option(name)}}% - }% + \ifboolexpr{ test{\IfBooleanTF{#1}} or test{\IfBooleanTF{#3}} }{% + \IfBooleanTF{#2}% + {\cnc@g{concept(#4).option(Plural)}}% + {\cnc@g{concept(#4).option(plural)}}% + }{% + \IfBooleanTF{#2}% + {\cnc@g{concept(#4).option(Name)}}% + {\cnc@g{concept(#4).option(name)}}% + }% % \end{macrocode}\end{codeframe} % % We end with an |\xspace| because the public command may need one. % % \begin{codeframe}\begin{macrocode} - \xspace% + \xspace% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} } @@ -214,94 +248,219 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\cnc@conceptsymbol} \marg{concept key} \marg{index}\\ + % \begin{macro}{\cnc@conceptsymbol} \marg{concept key} +%%% \marg{index}\\\nopagebreak % % This is the private macro which takes a concept key and an index and returns % the corresponding symbol from our data-store. We use it in the public macros % that offer this functionality. +% +% The first thing we do is grab the prefix of the second argument that +% consists of numerals. The rest of the argument is simply left in +% the input stream afterwards. % % \begin{codeframe}\begin{macrocode} \newcommand*{\cnc@conceptsymbol}[2]{% + \cnc@grabnumber{% % \end{macrocode}\end{codeframe} % % We check if an actual numerical value was passed. % % \begin{codeframe}\begin{macrocode} - \IfInteger{#2}{% + \ifstrempty{##1}{% +% \end{macrocode}\end{codeframe} +% +% No, we didn't get a numerical index. If there is only one symbol +% allocated to this concept, we don't care and return that symbol. +% +% \begin{codeframe}\begin{macrocode} + \edef\cnc@symbolcount{\cnc@g{concept(#1).option(symbols).count}}% + \ifnumcomp{\cnc@symbolcount}{=}{1}{% + \ensuremath{\cnc@g{concept(#1).option(symbols).index(1)}}% + }% +% \end{macrocode}\end{codeframe} +% +% If there are multiple symbols, the lack of an index is ambiguous and +% we report a package error. +% +% \begin{codeframe}\begin{macrocode} + {% + \PackageError{concepts}% + {You didn't specify a number, but the '#1' + \MessageBreak concept has more than one symbol + allocated; please\MessageBreak specify a number + to typeset a specific symbol}% + {I will pretend you didn't ask for a symbol here.}% + }% +% \end{macrocode}\end{codeframe} +% \begin{uninterestingcodeframe}\begin{macrocode} + }% +% \end{macrocode}\end{uninterestingcodeframe} +% +% Now follows the `else' branch: we did get a numerical index! +% +% \begin{codeframe}\begin{macrocode} + {% % \end{macrocode}\end{codeframe} % -% If we got one, we check whether it is larger than the number of symbols +% We check whether it is larger than the number of symbols % allocated to the concept. % % \begin{codeframe}\begin{macrocode} - \edef\cnc@symbolcount{\cnc@g{concept(#1).option(symbols).count}}% - \ifnumcomp{#2}{>}{\cnc@symbolcount}{% + \edef\cnc@symbolcount{\cnc@g{concept(#1).option(symbols).count}}% + \ifnumcomp{##1}{>}{\cnc@symbolcount}{% % \end{macrocode}\end{codeframe} % % If it is, we report an `index out of bounds' error. We first prepare an % appropriate sentence fragment so the error message becomes more readable. % % \begin{codeframe}\begin{macrocode} - \edef\cnc@nth{#2\nthSuff0#2\delimiter}% - \ExpandNext\IfStrEq{\cnc@symbolcount}{0}{% - \edef\cnc@somany{no symbols}% - }{\ExpandNext\IfStrEq{\cnc@symbolcount}{1}{% - \edef\cnc@somany{only 1 symbol}% - }{% - \edef\cnc@somany{only \cnc@symbolcount\space symbols}% - }}% - \PackageError{concepts}% - {You asked for the \cnc@nth\space '#1' symbol, - but\MessageBreak the '#1' concept has - \cnc@somany\space allocated}% - {I will pretend you didn't ask for a symbol here.}% + \edef\cnc@nth{##1\nthSuff0##1\delimiter}% + \ExpandNext\IfStrEq{\cnc@symbolcount}{0}{% + \edef\cnc@somany{no symbols}% + }{\ExpandNext\IfStrEq{\cnc@symbolcount}{1}{% + \edef\cnc@somany{only 1 symbol}% + }{% + \edef\cnc@somany{only \cnc@symbolcount\space symbols}% + }}% + \PackageError{concepts}% + {You asked for the \cnc@nth\space '#1' symbol, + but\MessageBreak the '#1' concept has + \cnc@somany\space allocated}% + {I will pretend you didn't ask for a symbol here.}% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} - }% + }% % \end{macrocode}\end{uninterestingcodeframe} % % But if the number is within bounds, great! We just return the stored symbol. % % \begin{codeframe}\begin{macrocode} - {% - \cnc@g{concept(#1).option(symbols).index(#2)}% - }% + {% + \ensuremath{\cnc@g{concept(#1).option(symbols).index(##1)}}% + }% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} }% % \end{macrocode}\end{uninterestingcodeframe} -% -% Now follows the `else' branch: we didn't get a numerical index. -% +% +% Now ends our |\cnc@grabnumber| command, and we supply the second argument +% that may contain the numbers. Just in case it's empty, we make sure we +% don't grab anything that comes after the second argument by adding a +% |\relax|. +% % \begin{codeframe}\begin{macrocode} - {% + }#2\relax% % \end{macrocode}\end{codeframe} +% \begin{uninterestingcodeframe}\begin{macrocode} +} +% \end{macrocode}\end{uninterestingcodeframe} +% +%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % \begin{macro}{\cnc@conceptsymbols} \marg{concept key} + % \marg{separator} + % \marg{last separator} +%%% \oarg{indices}\\\nopagebreak +% +% This is the private macro which takes a concept key and a +% comma-separated list of symbol-indices and returns a +% string-separated list of corresponding concept symbols from +% our data-store, possibly with a different token as the last +% separator. We use it in the public macros that offer this +% functionality. The last argument is optional to make it +% easier to define our `short' symbol-list command later. +% +% \begin{codeframe}\begin{macrocode} +\newcounter{cnc@separatorcount}% +\NewDocumentCommand{\cnc@conceptsymbols}{m m m O{1}}{% + \def\cnc@result{}% +% \end{macrocode}\end{codeframe} +% +% We loop through the list of indices and produce the +% symbols one-by-one. We use a rather ugly trick to +% possibly have a different \meta{last separator}. +% Each separator is stored in a separate macro, and we +% simply redefine the last one after the loop. This causes +% one macro to be defined for every single separator in +% the document, but we don't care, since most of this +% will be rewritten when we switch to \LaTeX3. +% +% \begin{codeframe}\begin{macrocode} + \def\do##1{% + \stepcounter{cnc@separatorcount}% + \edef\cnc@sepcsname{cnc@separator\arabic{cnc@separatorcount}}% + \csdef{\cnc@sepcsname}{#2}% + \expandafter\expandafter\expandafter\def\expandafter% + \expandafter\expandafter\cnc@result\expandafter% + \expandafter\expandafter{\expandafter\cnc@result% + \csname\cnc@sepcsname\endcsname% + \cnc@conceptsymbol{#1}{##1}}% + }\docsvlist{#4}% + \edef\cnc@sepcsname{cnc@separator\arabic{cnc@separatorcount}}% + \csdef{\cnc@sepcsname}{#3}% + \ensuremath{\expandafter\@gobble\cnc@result{}}% +% \end{macrocode}\end{codeframe} +% \begin{uninterestingcodeframe}\begin{macrocode} +} +% \end{macrocode}\end{uninterestingcodeframe} +% +%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % \begin{macro}{\cnc@nameandsymbols} \marg{concept key} + % \marg{star} + % \marg{capitalized} + % \marg{star}\\\nopagebreak + % \marg{separator} + % \marg{last separator} +%%% \marg{indices}\\\nopagebreak % -% If there is only one symbol allocated to this concept, we don't care -% and return that symbol. -% +% This is the private macro which takes a concept key, a few +% modifiers, a comma-separated list of symbol-indices and +% custom separators and returns a separated list of the corresponding +% concept symbols from our data-store. We use it in the public +% macros that offer this functionality. +% % \begin{codeframe}\begin{macrocode} - \edef\cnc@symbolcount{\cnc@g{concept(#1).option(symbols).count}}% - \ifnumcomp{\cnc@symbolcount}{=}{1}{% - \cnc@g{concept(#1).option(symbols).index(1)}% - }% +\newrobustcmd{\cnc@nameandsymbols}[7]{% % \end{macrocode}\end{codeframe} -% -% If there are multiple symbols, the lack of an index is ambiguous and -% we report a package error. -% +% +% We first check if any |*| modifiers were given and, if so, +% generate an error. +% % \begin{codeframe}\begin{macrocode} - {% - \PackageError{concepts}% - {You didn't specify a number, but the '#1' - \MessageBreak concept has more than one symbol - allocated; please\MessageBreak specify a number - to typeset a specific symbol}% - {I will pretend you didn't ask for a symbol here.}% - }% + \ifboolexpr{ test{\IfBooleanTF{#2}} or test{\IfBooleanTF{#4}} }{% + \PackageError{concepts}% + {You used the * modifier, but pluralization\MessageBreak + will be decided by the size of the index list}% + {I will pretend you didn't use the * modifier.}% + }{}% +% \end{macrocode}\end{codeframe} +% +% We then typeset the name of the concept. We check pluralization +% and pass along the capitalization. +% +% \begin{codeframe}\begin{macrocode} + \cnc@csvlistsize{#7}{\cnc@symbollistsize}% + \ifnumcomp{\cnc@symbollistsize}{=}{1}{% + \cnc@conceptname{\BooleanFalse}{#3}{\BooleanFalse}{#1}% + }{% + \cnc@conceptname{\BooleanTrue}{#3}{\BooleanFalse}{#1}% + } % <-- intentional space +% \end{macrocode}\end{codeframe} +% +% Finally, we print the symbol list. +% +% \begin{codeframe}\begin{macrocode} + \cnc@conceptsymbols{#1}{#5}{#6}[#7]% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} - }% } % \end{macrocode}\end{uninterestingcodeframe} % @@ -319,7 +478,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\NewConcept} \marg{concept key} \oarg{options}\\ +%%% \begin{macro}{\NewConcept} \marg{concept key} \oarg{options}\\\nopagebreak % % The |\NewConcept| macro is defined using |xparse|, since we want the % optional argument after the mandatory one (it's just nicer). @@ -331,24 +490,24 @@ % Is this concept key already defined? If so, we report a package error. % % \begin{codeframe}\begin{macrocode} - \xifinlist{#1}{\cnc@g{concepts}}{% - \PackageError{concepts}% - {The concept key '#1' is already taken}% - {I will pretend that this '\protect\newconcept'% - didn't happen.}% - }% + \xifinlist{#1}{\cnc@g{concepts}}{% + \PackageError{concepts}% + {The concept key '#1' is already taken}% + {I will pretend that this '\protect\newconcept'% + didn't happen.}% + }% % \end{macrocode}\end{codeframe} % % Otherwise, we start the actual processing of this new concept. % % \begin{codeframe}\begin{macrocode} - {% + {% % \end{macrocode}\end{codeframe} % % We add the concept to the concepts list in our datastore. % % \begin{codeframe}\begin{macrocode} - \listcsxadd{\cnc@d{concepts}}{#1}% + \listcsxadd{\cnc@d{concepts}}{#1}% % \end{macrocode}\end{codeframe} % % We then check which options were explicitly specified by the user. @@ -356,38 +515,38 @@ % be used by other code. % % \begin{codeframe}\begin{macrocode} - \DeclareRobustCommand*{\cnc@registertoggle}[1]{% - \newtoggle{\cnc@d{concept(#1).option(##1).given}}% - \togglefalse{\cnc@d{concept(#1).option(##1).given}}% - \ltxkeys@newordkey[cnc@toggle]{#1}{##1}[]% - {\toggletrue{\cnc@d{concept(#1).option(##1).given}}}% - } - \cnc@registertoggle{name}% - \cnc@registertoggle{Name}% - \cnc@registertoggle{plural}% - \cnc@registertoggle{Plural}% - \cnc@registertoggle{namecmd}% - \cnc@registertoggle{symbols}% - \cnc@registertoggle{symbolcmd}% - \ltxkeys@setkeys*[cnc@toggle]{#1}{#2}% + \DeclareRobustCommand*{\cnc@registertoggle}[1]{% + \newtoggle{\cnc@d{concept(#1).option(##1).given}}% + \togglefalse{\cnc@d{concept(#1).option(##1).given}}% + \ltxkeys@newordkey[cnc@toggle]{#1}{##1}[]% + {\toggletrue{\cnc@d{concept(#1).option(##1).given}}}% + } + \cnc@registertoggle{name}% + \cnc@registertoggle{Name}% + \cnc@registertoggle{plural}% + \cnc@registertoggle{Plural}% + \cnc@registertoggle{namecmd}% + \cnc@registertoggle{symbols}% + \cnc@registertoggle{symbolcmd}% + \ltxkeys@setkeys*[cnc@toggle]{#1}{#2}% % \end{macrocode}\end{codeframe} % % We now register the concept name options |name|, |Name|, % |plural| and |Plural|. This is also where we set their default values. % % \begin{codeframe}\begin{macrocode} - \ltxkeys@newordkey[cnc]{#1}{name}% - [#1]% - {\csdef{\cnc@d{concept(#1).option(name)}}{##1}}% - \ltxkeys@newordkey[cnc]{#1}{Name}% - [\cnc@upper{\cnc@g{concept(#1).option(name)}}]% - {\csdef{\cnc@d{concept(#1).option(Name)}}{##1}}% - \ltxkeys@newordkey[cnc]{#1}{plural}% - [\cnc@g{concept(#1).option(name)}s]% - {\csdef{\cnc@d{concept(#1).option(plural)}}{##1}}% - \ltxkeys@newordkey[cnc]{#1}{Plural}% - [\cnc@upper{\cnc@g{concept(#1).option(plural)}}]% - {\csdef{\cnc@d{concept(#1).option(Plural)}}{##1}}% + \ltxkeys@newordkey[cnc]{#1}{name}% + [#1]% + {\csdef{\cnc@d{concept(#1).option(name)}}{##1}}% + \ltxkeys@newordkey[cnc]{#1}{Name}% + [\cnc@upper{\cnc@g{concept(#1).option(name)}}]% + {\csdef{\cnc@d{concept(#1).option(Name)}}{##1}}% + \ltxkeys@newordkey[cnc]{#1}{plural}% + [\cnc@g{concept(#1).option(name)}s]% + {\csdef{\cnc@d{concept(#1).option(plural)}}{##1}}% + \ltxkeys@newordkey[cnc]{#1}{Plural}% + [\cnc@upper{\cnc@g{concept(#1).option(plural)}}]% + {\csdef{\cnc@d{concept(#1).option(Plural)}}{##1}}% % \end{macrocode}\end{codeframe} % % We next register the |namecmd| option. Its default value is the @@ -397,30 +556,38 @@ % contains the test. % % \begin{codeframe}\begin{macrocode} - \expandaftercmds{\ltxkeys@newordkey[cnc]{#1}{namecmd}% - [}{\csname#1\endcsname}]{% - \iftoggle{\cnc@d{concept(#1).option(namecmd).given}}{% + \expandaftercmds{\ltxkeys@newordkey[cnc]{#1}{namecmd}% + [}{\csname#1\endcsname}]{% + \iftoggle{\cnc@d{concept(#1).option(namecmd).given}}{% % \end{macrocode}\end{codeframe} % % We register the option value as given. % % \begin{codeframe}\begin{macrocode} - \csdef{\cnc@d{concept(#1).option(namecmd)}}{\noexpand##1} + \csdef{\cnc@d{concept(#1).option(namecmd)}}{\noexpand##1} % \end{macrocode}\end{codeframe} % -%%% \vphantom{x}\marginnote{\meta{namecmd}} |[*]| |[^]| |[*]|\\ +%%% \vphantom{x}\marginnote{\meta{namecmd}} \movarg{*} \movarg{\textasciicircum} +% \movarg{*} +% \oarg{indices}\\\nopagebreak % % \noindent If the option is processed, we define the concept-specific -% name command with the following code: +% name command. We distinguish between two cases: whether an index-list +% was provided or not. % % \begin{codeframe}\begin{macrocode} - \NewDocumentCommand{##1}{t* t^ t*}{% - \cnc@conceptname{####1}{####2}{####3}{#1}% - }% + \NewDocumentCommand{##1}{t* t^ t* +o}{% + \IfValueTF{####4}{% + \cnc@nameandsymbols{#1}{####1}{####2}{####3}% + {,}{$ and $}{####4}% + }{% + \cnc@conceptname{####1}{####2}{####3}{#1}% + }% + }% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} - }{}% - }% + }{}% + }% % \end{macrocode}\end{uninterestingcodeframe} % % We now register the |symbols| option. This option expects a list. @@ -429,8 +596,8 @@ % empty % % \begin{codeframe}\begin{macrocode} - \csdef{\cnc@d{concept(#1).option(symbols).count}}{0}% - \ltxkeys@newlistkey[cnc]{#1}{symbols}[]{% + \csdef{\cnc@d{concept(#1).option(symbols).count}}{0}% + \ltxkeys@newlistkey[cnc]{#1}{symbols}[]{% % \end{macrocode}\end{codeframe} % % We check if this particular symbol is already defined. We don't want @@ -440,73 +607,79 @@ % the reverse map we use for checking duplicates. % % \begin{codeframe}\begin{macrocode} - \ifcsundef{\cnc@d{symbol(\detokenize{##1}).concept}}{% - \csedef{\cnc@d{concept(#1)% - .option(symbols)% - .count}}{\ltxkeys@listcount}% - \csdef{\cnc@d{concept(#1)% - .option(symbols)% - .index(\ltxkeys@listcount)}}{##1}% - \csedef{\cnc@d{symbol(\detokenize{##1}).concept}}{#1}% - }% + \ifcsundef{\cnc@d{symbol(\detokenize{##1}).concept}}{% + \csedef{\cnc@d{concept(#1)% + .option(symbols)% + .count}}{\ltxkeys@listcount}% + \csdef{\cnc@d{concept(#1)% + .option(symbols)% + .index(\ltxkeys@listcount)}}{##1}% + \csedef{\cnc@d{symbol(\detokenize{##1}).concept}}{#1}% + }% % \end{macrocode}\end{codeframe} % % If the symbol is already in use we report a package error. % % \begin{codeframe}\begin{macrocode} - {% - \PackageError{concepts}% - {The symbol '\detokenize{##1}' is already allocated - to the '\cnc@g{symbol(\detokenize{##1}).concept}' - concept}% - {I will pretend that you did not - try to add this symbol.}% - }% + {% + \PackageError{concepts}% + {The symbol '\detokenize{##1}' is already allocated + to the '\cnc@g{symbol(\detokenize{##1}).concept}' + concept}% + {I will pretend that you did not + try to add this symbol.}% + }% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} - }% + }% % \end{macrocode}\end{uninterestingcodeframe} % % We register the |symbolcmd| option. It does not really have a default, % but we give an empty default so we can test for the empty string inside. % % \begin{codeframe}\begin{macrocode} - \ltxkeys@newordkey[cnc]{#1}{symbolcmd}[]{% - \ifblank{##1}{}{% + \ltxkeys@newordkey[cnc]{#1}{symbolcmd}[]{% + \ifblank{##1}{}{% % \end{macrocode}\end{codeframe} % % We register the option value as given. % % \begin{codeframe}\begin{macrocode} - \csdef{\cnc@d{concept(#1).option(symbolcmd)}}{\noexpand##1} + \csdef{\cnc@d{concept(#1).option(symbolcmd)}}{\noexpand##1} % \end{macrocode}\end{codeframe} % -%%% \vphantom{x}\marginnote{\meta{symbolcmd}} \momarg{index}\\ +%%% \vphantom{x}\marginnote{\meta{symbolcmd}} \momarg{index}\\\nopagebreak % % \noindent If the option is processed, we now define the concept-specific -% `short' command used to typeset one of the allocated symbols. It doesn't have a -% conventional argument, but it grabs all numerals following it and uses that -% as an index to the symbol. +% `short' command used to typeset one or more of the allocated symbols. It +% doesn't have a conventional argument, but it grabs all numerals following +% it and uses that as an index to the symbol. If a number was not detected, +% we pass control to the |\cnc@conceptsymbols| command, which is still able +% to grab a square bracket delimited list of indices. % % \begin{codeframe}\begin{macrocode} - \newrobustcmd*{##1}{% - \cnc@grabnumber{% - \cnc@conceptsymbol{#1}{########1}% - }% - }% -% \end{macrocode}\end{codeframe} -% \begin{uninterestingcodeframe}\begin{macrocode} + \newrobustcmd*{##1}{% + \cnc@grabnumber{% + \IfInteger{########1}{% + \cnc@conceptsymbol{#1}{########1}% + }{% + \cnc@conceptsymbols{#1}{,}{,}% }% + }% }% +% \end{macrocode}\end{codeframe} +% \begin{uninterestingcodeframe}\begin{macrocode} + }% + }% % \end{macrocode}\end{uninterestingcodeframe} % % Finally, we issue the command to parse and process all options. % % \begin{codeframe}\begin{macrocode} - \ltxkeys@launchkeys[cnc]{#1}{#2}% + \ltxkeys@launchkeys[cnc]{#1}{#2}% % \end{macrocode}\end{codeframe} % \begin{uninterestingcodeframe}\begin{macrocode} - }% + }% } % \end{macrocode}\end{uninterestingcodeframe} % @@ -515,7 +688,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\ConceptOption} \marg{concept key} \marg{option key}\\ + % \begin{macro}{\ConceptOption} \marg{concept key} +%%% \marg{option key}\\\nopagebreak % % The point of this command is that it can retrieve any option value % in an expandable way. That means we can't use |xparse|, but we don't @@ -523,7 +697,7 @@ % % \begin{codeframe}\begin{macrocode} \newcommand*{\ConceptOption}[2]{% - \cnc@g{concept(#1).option(#2)}% + \cnc@g{concept(#1).option(#2)}% } % \end{macrocode}\end{codeframe} % @@ -535,14 +709,16 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\ConceptName} |[*]| |[^]| |[*]| \marg{concept key}\\ + % \begin{macro}{\ConceptName} \movarg{*} \movarg{\textasciicircum} + % \movarg{*} +%%% \marg{concept key}\\\nopagebreak % % This implementation simply calls our private macro for retrieving % the name in one of four forms. % % \begin{codeframe}\begin{macrocode} \NewDocumentCommand{\ConceptName}{t* t^ t* m}{% - \cnc@conceptname{#1}{#2}{#3}{#4}% + \cnc@conceptname{#1}{#2}{#3}{#4}% } % \end{macrocode}\end{codeframe} % @@ -551,15 +727,59 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\ConceptSymbol} \marg{concept key} \oarg{index}\\ + % \begin{macro}{\ConceptSymbol} \marg{concept key} +%%% \oarg{index}\\\nopagebreak % % This implementation simply calls our private macro for retrieving -% the symbol with the given index. The index is optional (as it is -% in the `short' version) and defaults to 1. +% the symbol with the given index. The index is optional and +% defaults to 1. % % \begin{codeframe}\begin{macrocode} \NewDocumentCommand{\ConceptSymbol}{m O{1}}{% - \cnc@conceptsymbol{#1}{#2}% + \cnc@conceptsymbol{#1}{#2}% +} +% \end{macrocode}\end{codeframe} +% +%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % \begin{macro}{\ConceptSymbols} \marg{concept key} + % \oarg{separator} + % \oarg{last separator} +%%% \marg{indices}\\\nopagebreak +% +% This implementation simply calls our private macro for retrieving +% the symbol list with the given indices. The index-list is mandatory +% but can be empty. +% +% \begin{codeframe}\begin{macrocode} +\NewDocumentCommand{\ConceptSymbols}{m +O{,} +o m}{% + \IfValueTF{#3}{% + \cnc@conceptsymbols{#1}{#2}{#3}[#4]% + }{% + \cnc@conceptsymbols{#1}{#2}{#2}[#4]% + }% +} +% \end{macrocode}\end{codeframe} +% +%\end{macro}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % \begin{macro}{\ConceptNameAndSymbols} \marg{concept key} +%%% \marg{indices}\\\nopagebreak +% +% This implementation simply calls our private macro for typesetting +% the concept name and the symbol list with the given indices. The +% index-list is mandatory and cannot be empty. +% +% \begin{codeframe}\begin{macrocode} +\NewDocumentCommand{\ConceptNameAndSymbols}{t^ m +O{,} +O{$ and $} m}{% + \cnc@nameandsymbols{#2}{\BooleanFalse}{#1}{\BooleanFalse}% + {#3}{#4}{#5}% } % \end{macrocode}\end{codeframe} % diff --git a/Master/texmf-dist/tex/latex/concepts/dry.sty b/Master/texmf-dist/tex/latex/concepts/dry.sty new file mode 100644 index 00000000000..2ff5646046a --- /dev/null +++ b/Master/texmf-dist/tex/latex/concepts/dry.sty @@ -0,0 +1,66 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%% +% % +% Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) % +% % +% http://latex-concepts.googlecode.com % +% % +% This work may 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 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the file dry.sty. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% + +% I will 'officially' release this package at some point in the future. For +% now I'm just using it to document the concepts package. Still, it's +% released under LPPL, so use it as you will. +% +% -- Michiel Helvensteijn + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{dry} + [2012/12/16 convenience macros for reusing LaTeX code] + +\RequirePackage{filecontents} +\RequirePackage{xparse} +\RequirePackage{etoolbox} +\RequirePackage{with} + +\newcommand\minput[1]{% + \input{#1}% + \ifhmode\ifnum\lastnodetype=11% + \unskip% + \fi\fi% +} + +\NewDocumentCommand{\NewDRYer}{m m +m}{% + \WithUniqueCsname[#1]{% + \csgdef{dry@filebase@##1}{##1}% + \csgdef{dry@filename@##1}{\csuse{dry@filebase@##1}.tmp}% + % + % WARNING: Custom argument specs #2, but cannot end with an optional argument! + \NewDocumentEnvironment{#1}{#2}{% + \begingroup% + \@tempswafalse\filec@ntents{\csuse{dry@filename@##1}}% + }{% + \endfilecontents% + \endgroup% + }% + % + \AfterEndEnvironment{#1}{% + \def\DRYFilename{\csuse{dry@filename@##1}}% + \def\DRYContent{\minput{\csuse{dry@filename@##1}}}% + #3% + \let\DRYFilename\relax% + \let\DRYContent\relax% + }% + }% +} diff --git a/Master/texmf-dist/tex/latex/concepts/with.sty b/Master/texmf-dist/tex/latex/concepts/with.sty new file mode 100644 index 00000000000..4e94ac02516 --- /dev/null +++ b/Master/texmf-dist/tex/latex/concepts/with.sty @@ -0,0 +1,103 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \iffalse %%%% +% % +% Copyright (c) 2012 - Michiel Helvensteijn (www.mhelvens.net) % +% % +% http://latex-concepts.googlecode.com % +% % +% This work may 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 2005/12/01 or later. % +% % +% This work has the LPPL maintenance status `author-maintained'. % +% % +% The Current Maintainer of this work is Michiel Helvensteijn. % +% % +% This work consists of the file with.sty. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% + +% I will 'officially' release this package at some point in the future. For +% now I'm just using it to document the concepts package. Still, it's +% released under LPPL, so use it as you will. +% +% -- Michiel Helvensteijn + +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\ProvidesExplPackage{with}{2012/12/16}{0.0.1} + {an inline construct for passing token lists as ##1-type arguments} + +\cs_new_eq:NN \qnv \q_no_value + +\cs_new:Nn \with:nn { + \with:nnnnnnnnn {#1}\qnv\qnv\qnv\qnv\qnv\qnv\qnv{#2} +} + +\cs_new:Nn \with:nnn { + \with:nnnnnnnnn {#1}{#2}\qnv\qnv\qnv\qnv\qnv\qnv{#3} +} + +\cs_new:Nn \with:nnnn { + \with:nnnnnnnnn {#1}{#2}{#3}\qnv\qnv\qnv\qnv\qnv{#4} +} + +\cs_new:Nn \with:nnnnn { + \with:nnnnnnnnn {#1}{#2}{#3}{#4}\qnv\qnv\qnv\qnv{#5} +} + +\cs_new:Nn \with:nnnnnn { + \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}\qnv\qnv\qnv{#6} +} + +\cs_new:Nn \with:nnnnnnn { + \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}\qnv\qnv{#7} +} + +\cs_new:Nn \with:nnnnnnnn { + \with:nnnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}\qnv{#8} +} + +\cs_new:Nn \with:nnnnnnnnn { + \cs_set:Nn \with_aux:nnnnnnnn {#9} + \with_aux:nnnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} +} + +\cs_generate_variant:Nn \with:nn {xn} +\cs_generate_variant:Nn \with:nnn {xxn} +\cs_generate_variant:Nn \with:nnnn {xxxn} +\cs_generate_variant:Nn \with:nnnnn {xxxxn} +\cs_generate_variant:Nn \with:nnnnnn {xxxxxn} +\cs_generate_variant:Nn \with:nnnnnnn {xxxxxxn} +\cs_generate_variant:Nn \with:nnnnnnnn {xxxxxxxn} +\cs_generate_variant:Nn \with:nnnnnnnnn {xxxxxxxxn} + +\NewDocumentCommand{\With}{+o+o+o+o+o+o+o+o+m}{ + \IfValueTF{#8}{ \with:xxxxxxxxn{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{#9} }{ + \IfValueTF{#7}{ \with:xxxxxxxn {#1}{#2}{#3}{#4}{#5}{#6}{#7} {#9} }{ + \IfValueTF{#6}{ \with:xxxxxxn {#1}{#2}{#3}{#4}{#5}{#6} {#9} }{ + \IfValueTF{#5}{ \with:xxxxxn {#1}{#2}{#3}{#4}{#5} {#9} }{ + \IfValueTF{#4}{ \with:xxxxn {#1}{#2}{#3}{#4} {#9} }{ + \IfValueTF{#3}{ \with:xxxn {#1}{#2}{#3} {#9} }{ + \IfValueTF{#2}{ \with:xxn {#1}{#2} {#9} }{ + \IfValueTF{#1}{ \with:xn {#1} {#9} } + {#9} + }}}}}}} +} + +\int_new:c{g_with_uniquecsname_count} + +\cs_new:Nn \with_uniquecsname:n { + \with_uniquecsname:xn {uniquecsname} {#1} +} + +\cs_new:Nn \with_uniquecsname:xn { + \int_incr:c {g_with_uniquecsname_count} + \with:xn {#1\int_use:c{g_with_uniquecsname_count}} {#2} +} + +\NewDocumentCommand{\WithUniqueCsname}{O{uniquecsname}+m}{ + \with_uniquecsname:xn {#1} {#2} +} diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 24b62181b6d..3bd84a248a1 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -4971,10 +4971,10 @@ sub POSTcstex { } &SYSTEM ("$MV doc/README README-doc"); &SYSTEM ("$MV doc/cstexman.tex ."); - &SYSTEM ("$MV doc/jemny.* doc/parpozn.* doc/prvni.* ."); - &SYSTEM ("$RM -rf *.ps *.zip"); - &SYSTEM ("$RM -rf README base doc"); + &SYSTEM ("$MV doc/jemny.* doc/prvni.* ."); + &SYSTEM ("$RM -rf README *.zip base/ doc/"); &SYSTEM ("$MV * $DEST/doc/cstex/"); # move all to same dir + &SYSTEM ("$RM $DEST/doc/cstex/*.ps $DEST/doc/cstex/*.dvi"); } sub POSTctex { -- cgit v1.2.3