summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-06 23:58:19 +0000
committerKarl Berry <karl@freefriends.org>2013-01-06 23:58:19 +0000
commitaa65893614c2e0df298ca15aaacbf845658546b1 (patch)
tree7ddb06195cc8d1f2ef3b9bdb3da1bf257eb46257
parent208cd16bb64c9544452e82df4d9251076fef8323 (diff)
concepts (6jan13)
git-svn-id: svn://tug.org/texlive/trunk@28752 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/concepts/concepts.pdfbin326899 -> 307423 bytes
-rw-r--r--Master/texmf-dist/doc/latex/concepts/concepts.tex20
-rw-r--r--Master/texmf-dist/tex/latex/concepts/concepts.sty76
3 files changed, 50 insertions, 46 deletions
diff --git a/Master/texmf-dist/doc/latex/concepts/concepts.pdf b/Master/texmf-dist/doc/latex/concepts/concepts.pdf
index b4418f5522e..1f4682c3c6b 100644
--- a/Master/texmf-dist/doc/latex/concepts/concepts.pdf
+++ b/Master/texmf-dist/doc/latex/concepts/concepts.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/concepts/concepts.tex b/Master/texmf-dist/doc/latex/concepts/concepts.tex
index 7a26c65024c..70c2c5c1f51 100644
--- a/Master/texmf-dist/doc/latex/concepts/concepts.tex
+++ b/Master/texmf-dist/doc/latex/concepts/concepts.tex
@@ -33,7 +33,7 @@
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Changes %
+% Global Changes %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\changes{0.0.1}{2012/11/16}{initial version}
@@ -41,6 +41,7 @@
\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}
+\changes{0.0.6}{2013/1/1}{made concept `options' mandatory + fixed some spacing bugs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document} %
@@ -91,7 +92,10 @@ 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.
+kinds of mistakes in symbol usage. Also, I may want to integrate the
+|ligature| option from the \textsf{semantic} package, which allows you to
+choose arbitrary characters to typeset your symbols in math mode (with some
+restrictions).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Usage} %
@@ -103,14 +107,14 @@ Afterwards, its name and associated symbols can by typeset using other macros.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\describemacro{\NewConcept}{
- \marg{concept key} \oarg{options}
+ \marg{concept key} \marg{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
+Then you'll want to add \meta{options}. This 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:
%
@@ -139,22 +143,22 @@ options. Note that the option names are case-sensitive:
Here are a few examples which will also be used to illustrate the other commands:
\begin{latex-example}
-\NewConcept{swproduct}[
+\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 \let\d\relax % I won't be using these
-\NewConcept{delta}[
+\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
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}
%