From aa65893614c2e0df298ca15aaacbf845658546b1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 6 Jan 2013 23:58:19 +0000 Subject: concepts (6jan13) git-svn-id: svn://tug.org/texlive/trunk@28752 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/concepts/concepts.sty | 76 +++++++++++------------ 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'Master/texmf-dist/tex/latex/concepts') diff --git a/Master/texmf-dist/tex/latex/concepts/concepts.sty b/Master/texmf-dist/tex/latex/concepts/concepts.sty index 7cb1e4a07e1..e7093ebd7b4 100644 --- a/Master/texmf-dist/tex/latex/concepts/concepts.sty +++ b/Master/texmf-dist/tex/latex/concepts/concepts.sty @@ -19,7 +19,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% -% \CheckSum{265} +% \CheckSum{266} % % \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 @@ -47,7 +47,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{concepts}[2012/12/25 0.0.5-r1 +\ProvidesPackage{concepts}[2012/12/29 0.0.6 managing names and symbols of document specific formal concepts] % \end{macrocode} % @@ -233,17 +233,6 @@ {\cnc@g{concept(#4).option(name)}}% }% % \end{macrocode} -% -% We end with an |\xspace| because the public command may need one. -% And first we cancel out any extra spacing (for example, -% when one concept name ends with another). -% -% \changes{0.0.5-r1}{2012/12/25} -% {fixed spacing for when one concept name ends with another} -% -% \begin{macrocode} - \unskip\xspace% -% \end{macrocode} % \uninteresting\begin{macrocode} } % \end{macrocode} @@ -385,6 +374,10 @@ \def\cnc@result{}% % \end{macrocode} % +% \changes{0.0.6}{2012/12/29} +% {removed unnecessary \{\} from the definition which would break +% correct placement of subscript and superscript} +% % 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}. @@ -395,19 +388,21 @@ % will be rewritten when we switch to \LaTeX3. % % \begin{macrocode} - \def\do##1{% - \stepcounter{cnc@separatorcount}% + \ifblank{#4}{}{% + \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}{#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{}}% + \csdef{\cnc@sepcsname}{#3}% + \ensuremath{\expandafter\@gobble\cnc@result}% + }% % \end{macrocode} % \uninteresting\begin{macrocode} } @@ -457,13 +452,16 @@ \cnc@conceptname{\BooleanFalse}{#3}{\BooleanFalse}{#1}% }{% \cnc@conceptname{\BooleanTrue}{#3}{\BooleanFalse}{#1}% - } % <-- intentional space + }% % \end{macrocode} % -% Finally, we print the symbol list. +% Finally, we print the symbol list. We take away any whitespace +% at the end of the name (possible if the name is itself defined +% in terms of a public concept-name command that introduced an +% |\xspace|) and introduce a single space of our own. % % \begin{macrocode} - \cnc@conceptsymbols{#1}{#5}{#6}[#7]% + \unskip{} \cnc@conceptsymbols{#1}{#5}{#6}[#7]% % \end{macrocode} % \uninteresting\begin{macrocode} } @@ -483,13 +481,15 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% \begin{macro}{\NewConcept} \marg{concept key} \oarg{options}\\\nopagebreak\noindentnext -% -% The |\NewConcept| macro is defined using |xparse|, since we want the -% optional argument after the mandatory one (it's just nicer). +%%% \begin{macro}{\NewConcept} \marg{concept key} \marg{options}\\\nopagebreak\noindentnext +% +% \changes{0.0.6}{2012/12/29} +% {made the options mandatory} +% +% We now define the |\NewConcept| command. It should (obviously) be robust. % % \begin{macrocode} -\NewDocumentCommand{\NewConcept}{m O{}}{% +\newrobustcmd*{\NewConcept}[2]{% % \end{macrocode} % % Is this concept key already defined? If so, we report a package error. @@ -525,7 +525,7 @@ \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}% @@ -569,7 +569,7 @@ % We register the option value as given. % % \begin{macrocode} - \csdef{\cnc@d{concept(#1).option(namecmd)}}{\noexpand##1} + \csdef{\cnc@d{concept(#1).option(namecmd)}}{\noexpand##1}% % \end{macrocode} % %%% \vphantom{x}\marginnote{\meta{namecmd}} \movarg{*} \movarg{\textasciicircum} @@ -586,7 +586,7 @@ \cnc@nameandsymbols{#1}{####1}{####2}{####3}% {,}{$ and $}{####4}% }{% - \cnc@conceptname{####1}{####2}{####3}{#1}% + \cnc@conceptname{####1}{####2}{####3}{#1}\unskip\xspace% }% }% % \end{macrocode} @@ -667,7 +667,7 @@ \cnc@grabnumber{% \IfInteger{########1}{% \cnc@conceptsymbol{#1}{########1}% - }{% + }{% TODO: check for square bracket (we still may want to report an error) \cnc@conceptsymbols{#1}{,}{,}% }% }% @@ -723,7 +723,7 @@ % % \begin{macrocode} \NewDocumentCommand{\ConceptName}{t* t^ t* m}{% - \cnc@conceptname{#1}{#2}{#3}{#4}% + \cnc@conceptname{#1}{#2}{#3}{#4}\unskip\xspace% } % \end{macrocode} % -- cgit v1.2.3