diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/generic/yax/README | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/yax/yax-doc.pdf | bin | 118088 -> 122921 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/yax/yax-doc.tex | 70 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/yax/t-yax.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/yax/yax.sty | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/yax/yax.tex | 80 |
6 files changed, 121 insertions, 39 deletions
diff --git a/Master/texmf-dist/doc/generic/yax/README b/Master/texmf-dist/doc/generic/yax/README index 21040a05a00..8a87c10a42a 100644 --- a/Master/texmf-dist/doc/generic/yax/README +++ b/Master/texmf-dist/doc/generic/yax/README @@ -2,7 +2,7 @@ This is the README file for the YaX package. Author: Paul Isambert. E-mail: zappathustra AT free DOT fr Comments and suggestions are welcome. -Date: June 2010. +Date: July 2010. The package is a format-independent key system, with some peculiarities. diff --git a/Master/texmf-dist/doc/generic/yax/yax-doc.pdf b/Master/texmf-dist/doc/generic/yax/yax-doc.pdf Binary files differindex 23eef84a30c..c0de8b0ddb4 100644 --- a/Master/texmf-dist/doc/generic/yax/yax-doc.pdf +++ b/Master/texmf-dist/doc/generic/yax/yax-doc.pdf diff --git a/Master/texmf-dist/doc/generic/yax/yax-doc.tex b/Master/texmf-dist/doc/generic/yax/yax-doc.tex index 45ce047d1ee..8ac6af50695 100644 --- a/Master/texmf-dist/doc/generic/yax/yax-doc.tex +++ b/Master/texmf-dist/doc/generic/yax/yax-doc.tex @@ -4,7 +4,7 @@ author = "Paul Isambert" title = \yax pdftitle = YaX - version = 1.0 + version = \yaxversion date = "\the\month/\the\day/\the\year" display = outlines subject = "The YaX documentation." @@ -57,7 +57,8 @@ \def#1{\arg{#2}\kern1pt\antigobblespace}% } \defarg\param{parameter} \defarg\paralist{list of parameters} -\defarg\attr{attribute} \def\paramatt{\param\kern-1pt\tcode:\attr\antigobblespace} +\defarg\attr{attribute} \defarg\attrlist{list of attributes} +\def\paramatt{\param\kern-1pt\tcode:\attr\antigobblespace} \defarg\attrlist{list of attributes} \defarg\vallist{list of values} \defarg\value{value} \defarg\ospace{optional space} \defarg\andvalue{value exists} \defarg\orvalue{no value} @@ -146,6 +147,11 @@ or \verb/\usemodule[yax]/ respectively; anywhere else just use \verb/\input yax/ +\describe!\yaxversion. +Starting with version 1.01, this macro holds \yax's version. Current is \yaxversion. + + + \section{Setting parameters} @@ -169,8 +175,8 @@ Its simplified syntax is as follows: \syntax \noindent\com\setparameter \paralist\ : - \attr\ = \value - \attr\ = \value + \attrlist\ = \value + \attrlist\ = \value ... \noindent\com\par \syntax/ @@ -211,24 +217,25 @@ by default it does the same thing as using one big \com\setparameter. I say parameter might be active and have deleted its own attributes after the first call, which anyway is something we'll see later. -Each \attr is made of the same thing as \param: i.e. anything expandable. -However, an \attr cannot have a name beginning with the strings \verb/e:/, -\verb/g:/ and \verb/x:/. Indeed, these prefixes are used to specify -how an attribute is to be defined, and they are similar to \com\edef, +Like \paralist, \attrlist is a list of space-delimited attributes. +Each \attr is made of the same thing as a \param: i.e. anything expandable. +However, at the beginning of a \attrlist, the strings \verb/e:/, \verb/g:/ and \verb/x:/ +have a special meaning: these prefixes are used to specify +how an attribute or list of attributes is to be defined, and they are similar to \com\edef, \com\gdef and \com\xdef (with no prefix meaning \com\def), i.e.: \example \setparameter foo : - one = \whatever - e: two = \whatever - g: three = \whatever - x: four = \whatever + one = \whatever + e: two = \whatever + g: three = \whatever + x: four five = \whatever \example/ \noindent defines, for the parameter \verb/foo/, the attributes \verb/one/ -and \verb/three/ as \com\whatever and the attributes \verb/two/ and \verb/four/ +and \verb/three/ as \com\whatever and the attributes \verb/two/, \verb/four/ and \verb/five/ as the full expansion of \com\whatever; moreover, \verb/one/ and \verb/two/ -are locally defined, whereas \verb/three/ and \verb/four/ are globally +are locally defined, whereas \verb/three/, \verb/four/ and \verb/five/ are globally defined. The space between the prefix and the name of the parameter is optional. @@ -237,7 +244,7 @@ a space, e.g.: \example \setparameter Zappa : - first name = Frank + firstname = Frank motto = {Music is the best} ... \example/ @@ -253,7 +260,7 @@ Otherwise, \arg{value} can be given between double quotes: \example \setparameter Zappa : - first name = "Frank" + firstname = "Frank" motto = "Music is the best" hairstyle = "\mustache" \example/ @@ -262,7 +269,7 @@ Otherwise, \arg{value} can be given between double quotes: end of the line is optional and the following can be done: \example -\setparameter Zappa:first name="Frank"motto="Music is the best"...\par +\setparameter Zappa:firstname="Frank"motto="Music is the best"...\par \example/ \noindent Finally, there's a special rule. Control sequences gobble the @@ -318,8 +325,9 @@ in an orderly fasion, e.g.: \example \setparameter page : - pagewidth = 32cm - pageheight = 30cm + pagewidth = 30cm + pageheight = 32cm + top bottom = 2cm lines = 45 whatever = \foo ... @@ -333,9 +341,21 @@ in an orderly fasion, e.g.: \noindent Thus, I find commas to delimit values equally superfluous and find the odd quote better. Anyway setting parameters is far from the whole story. +But before turning to how to use them, here's on fast way of setting a single attribute: - - +\describe\setattribute\paramatt=\value\arg{space}. +\describe\esetattribute\paramatt=\value\arg{space}. +\describe\gsetattribute\paramatt=\value\arg{space}. +\describe\xsetattribute\paramatt=\value\arg{space}. +This sets \attr (no list) for \param (no list) to \value; see +below for the \paramatt syntax. Note that the \arg{space} is for real, +so don't forget it. The `=' sign may be surrounded by optional space. +This command can be used instead of \com\setparameter for two reasons: +first, it is much faster (because it doesn't take lists into account); +second, if \param is active it is \ital{not} executed (see the section +\pdfstartlink attr{/B [0 0 0]} goto name{defpar} \ital{Defining parameters}\pdfendlink). +The \verb"e-", \verb"g-" and \verb"x-"versions sets the attribute +with the \verb"e:", \verb"g:" and \verb"x:" prefixes respectively. @@ -692,6 +712,7 @@ you redefine the default commands, which is dangerous. To be precise, the commands copied are (omitting the \verb/-or/ and \verb/-and/ variants, which are created too, if any): +\com\setattribute, \com\esetattribute, \com\gsetattribute, \com\xsetattribute, \com\ifattribute, \com\usevalue, \com\passvalue, \com\passvaluenobraces, \com\settovalue, \com\storevalue, \com\ifvalue, \com\ifcasevalue, \com\deleteattribute and \com\restrictattribute (which you'll learn @@ -779,8 +800,8 @@ only the former restriction holds. E.g.: - \section{Defining parameters} +\pdfdest name {defpar} xyz \describe\defparameter\paralist\barg{definition}. Parameters aren't just a way of organizing attributes. They @@ -848,7 +869,10 @@ Fascinating. Once again? Cool. \Example/ -\vskip-2\baselineskip + +{\it\noindent See next page for the last example.} + + \Example \setparameter metasection : skip = 2 diff --git a/Master/texmf-dist/tex/generic/yax/t-yax.tex b/Master/texmf-dist/tex/generic/yax/t-yax.tex index 49d6af4a0b5..11aaacab5da 100644 --- a/Master/texmf-dist/tex/generic/yax/t-yax.tex +++ b/Master/texmf-dist/tex/generic/yax/t-yax.tex @@ -5,11 +5,11 @@ % Author: Paul Isambert. % E-mail: zappathustra AT free DOT fr % Comments and suggestions are welcome. -% Date: June 2010. +% Date: July 2010. % %D \module %D [ file=t-yax, -%D version=2010.06.17, +%D version=2010.07.10, %D title=\CONTEXT\ User Module, %D subtitle=YaX, %D author=Paul Isambert, diff --git a/Master/texmf-dist/tex/generic/yax/yax.sty b/Master/texmf-dist/tex/generic/yax/yax.sty index 58477727ee7..a537c3d92fc 100644 --- a/Master/texmf-dist/tex/generic/yax/yax.sty +++ b/Master/texmf-dist/tex/generic/yax/yax.sty @@ -5,10 +5,10 @@ % Author: Paul Isambert. % E-mail: zappathustra AT free DOT fr % Comments and suggestions are welcome. -% Date: June 2010. +% Date: July 2010. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{yax}[2010/06/17 v.1.0 Yet Another Key System.] +\ProvidesPackage{yax}[2010/07/10 v.1.01 Yet Another Key System.] \chardef\formatnumber=4 \input yax.tex \endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/yax/yax.tex b/Master/texmf-dist/tex/generic/yax/yax.tex index f799557634d..36cf486f02a 100644 --- a/Master/texmf-dist/tex/generic/yax/yax.tex +++ b/Master/texmf-dist/tex/generic/yax/yax.tex @@ -4,12 +4,25 @@ % Author: Paul Isambert. % E-mail: zappathustra AT free DOT fr % Comments and suggestions are welcome. -% Date: June 2010. +% Date: July 2010. % \input texapi % Everything I need. It figures: I wrote it for this. +\ifcsname yax@already_loaded\endcsname + \expandafter\endinput +\fi + +% No need to test texapi's version, since \texapiversion was +% defined in v.1.01 and that's the one needed. +\unless\ifdefined\texapiversion + \senderror{YaX}{You need texapi with version at least 1.01. I quit} + \expandafter\endinput +\fi + \setcatcodes{@_=11} -\def\yax@error{\senderror{YAX}} +\def\yaxversion{1.01} +\let\yax@already_loaded\relax +\def\yax@error{\senderror{YaX}} % % Retrieval of parameter and attribute. @@ -66,6 +79,7 @@ } \newfor\yax@setattributes_loop#1={% \passtrim{#1}\yax@setattributes_checkprefix + \addright\yax@attribute{ }% Final space delimiter \pausefor\yax@setattributes_howgiven }[\iffcs{yax@\yax@parameter @active} {\usecs{yax@\yax@parameter @def}}] @@ -83,14 +97,24 @@ \yax@setattributes_getquote % No need for a new nospace: it has been removed {\ifcatnext\foo - \yax@setattributes_do % Since one visible \cs is supposed to be the only token in value. + \yax@setattributes_getcommand \yax@setattributes_getspace}% } -\long\def\yax@setattributes_getquote"#1"{% +\long\def\yax@setattribute_single#1#2{% + \def\yax@attribute{#2}% \yax@setattributes_do{#1}% } +\long\def\yax@setattributes_getquote"#1"{% + \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}% + \nospace{\resumefor\yax@setattributes_loop}% Better not to forget this! + } +\long\def\yax@setattributes_getcommand#1{% + \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}% + \nospace{\resumefor\yax@setattributes_loop}% + } \long\def\yax@setattributes_getspace#1 {% - \yax@setattributes_do{#1}% + \passexpanded{\yax@space_loop{\yax@setattribute_single{#1}}}{\yax@attribute}% + \nospace{\resumefor\yax@setattributes_loop}% } \newif\ifyax@makedef \long\def\yax@setattributes_do#1{% @@ -116,7 +140,6 @@ \ifyax@makedef \yax@dodef{yax@\yax@parameter:\yax@attribute}{#1}% \fi - \resumefor\yax@setattributes_loop% Better not to forget this! } % % @@ -229,6 +252,34 @@ \letcs{yax@#1:#2}\yax@undefined } % +% \setattribute <parameter> : <attribute> = <value> +% +\def\yax@removesign#1#2#3#4={#1{#2}{#3}}% +\def\setattribute{% + \let\yax@dodef\defcs + \yax@getall{\yax@removesign\yax@setattribute}% + } +\def\esetattribute{% + \let\yax@dodef\edefcs + \yax@getall{\yax@removesign\yax@setattribute}% + } +\def\gsetattribute{% + \let\yax@dodef\gdefcs + \yax@getall{\yax@removesign\yax@setattribute}% + } +\def\xsetattribute{% + \let\yax@dodef\xdefcs + \yax@getall{\yax@removesign\yax@setattribute}% + } +\def\yax@setattribute#1#2{% + \def\yax@parameter{#1}% + \def\yax@attribute{#2}% + \nospace\yax@setattribute_getvalue + } +\def\yax@setattribute_getvalue#1 {% + \yax@setattributes_do{#1}% + } +% % % % @@ -406,13 +457,12 @@ % \ifvalue % \def\ifvalue{% - \yax@getall{\yax@ifvalue_removesign\yax@ifvalue_getvalue}% + \yax@getall{\yax@removesign\yax@ifvalue_getvalue}% }% \def\yax@ifvalue_nometa{% - \yax@getall{\yax@ifvalue_removesign\yax@ifvaluenometa_getvalue}% + \yax@getall{\yax@removesign\yax@ifvaluenometa_getvalue}% }% -\def\yax@ifvalue_removesign#1#2#3#4={#1{#2}{#3}}% \long\def\yax@ifvalue_getvalue#1#2#3 {% \ifemptystring{#3} {\yax@ifvalue_getvalue{#1}{#2}} @@ -488,6 +538,10 @@ \long\def\yax@newsyntax#1#2{% \defcs{#2restrictattribute}#1{\yax@restrictattribute_getrestrictions{##1}{##2}}% \defcs{#2deleteattribute}#1{\letcs{yax@##1:##2}\yax@undefined}% + \defcs{#2setattribute}#1{\let\yax@dodef\defcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}% + \defcs{#2esetattribute}#1{\let\yax@dodef\edefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}% + \defcs{#2gsetattribute}#1{\let\yax@dodef\gdefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}% + \defcs{#2xsetattribute}#1{\let\yax@dodef\xdefcs\yax@removesign{\nospace\yax@setattribute}{##1}{##2}}% \defcs{#2ifattribute}#1{\yax@ifattribute_and{}\gobbleone{##1}{##2}}% \defcs{yax@#2ifattribute_nometa}#1{\yax@ifattributenometa_and\gobbleone{##1}{##2}}% \yax@newsyntax_noarg{#2usevalue}{#1}\usecs @@ -496,8 +550,8 @@ \passexpanded{\yax@newsyntax_onearg{#2passvaluenobraces}}{\yax@temp{##2}{##3}}\yax@passvalue_nobrace \passexpanded{\yax@newsyntax_onearg{#2settovalue}}{\yax@temp{##2}{##3}}\yax@settovalue \passexpanded{\yax@newsyntax_onearg{#2storevalue}}{\yax@temp{##2}{##3}}\yax@storevalue - \defcs{#2ifvalue}#1{\yax@ifvalue_removesign\yax@ifvalue_getvalue{##1}{##2}}% - \defcs{yax@#2ifvalue_nometa}#1{\yax@ifvalue_removesign\yax@ifvaluenometa_getvalue{##1}{##2}}% + \defcs{#2ifvalue}#1{\yax@removesign\yax@ifvalue_getvalue{##1}{##2}}% + \defcs{yax@#2ifvalue_nometa}#1{\yax@removesign\yax@ifvaluenometa_getvalue{##1}{##2}}% \defcs{#2ifcasevalue}#1{\yax@ifcasevalue_getvalue{##1}{##2}}% \defcs{yax@#2ifcasevalue_nometa}#1{\expandafter\nometa\yax@ifcasevalue_getvalue{##1}{##2}}% } @@ -512,6 +566,10 @@ \def\copysyntax#1#2{% \letcstocs{#1restrictattribute}{#2restrictattribute}% \letcstocs{#1deleteattribute}{#2deleteattribute}% + \letcstocs{#1setattribute}{#2setattribute}% + \letcstocs{#1esetattribute}{#2esetattribute}% + \letcstocs{#1gsetattribute}{#2gsetattribute}% + \letcstocs{#1xsetattribute}{#2xsetattribute}% \yax@let{ifattribute}{#1}{#2}% \yax@let_all{usevalue}{#1}{#2}\yax@let_all{passvalue}{#1}{#2}\yax@let_all{passvaluenobraces}{#1}{#2}% \yax@let_all{settovalue}{#1}{#2}\yax@let_all{storevalue}{#1}{#2}% |