From 2a02b4779d0acc1e6bfd719c6c19e12940617bec Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 27 Apr 2010 01:01:05 +0000 Subject: xpackages update (26apr10) git-svn-id: svn://tug.org/texlive/trunk@18019 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/xpackages/xbase/ldcsetup.pdf | Bin 339721 -> 339725 bytes .../doc/latex/xpackages/xbase/template-test.tex | 77 ++ .../doc/latex/xpackages/xbase/template-test2.tex | 110 +++ .../doc/latex/xpackages/xbase/template.pdf | Bin 498456 -> 498459 bytes .../doc/latex/xpackages/xbase/tprestrict-test.tex | 80 ++ .../doc/latex/xpackages/xbase/xparse-test.tex | 296 +++++++ .../doc/latex/xpackages/xbase/xparse.pdf | Bin 557652 -> 564406 bytes .../doc/latex/xpackages/xbase/xtemplate.pdf | Bin 633436 -> 632958 bytes .../doc/latex/xpackages/xhead/xhead-test.tex | 245 +++++ .../texmf-dist/doc/latex/xpackages/xhead/xhead.pdf | Bin 0 -> 464753 bytes .../doc/latex/xpackages/xtras/l3keys2e-demo.tex | 46 + .../doc/latex/xpackages/xtras/l3keys2e.pdf | Bin 388054 -> 388054 bytes .../source/latex/xpackages/xbase/template-test.tex | 77 -- .../latex/xpackages/xbase/template-test2.tex | 110 --- .../latex/xpackages/xbase/tprestrict-test.tex | 80 -- .../source/latex/xpackages/xbase/xparse-test.tex | 296 ------- .../source/latex/xpackages/xbase/xparse.dtx | 156 +++- .../source/latex/xpackages/xbase/xtemplate.dtx | 46 +- .../source/latex/xpackages/xhead/xhead.dtx | 986 +++++++++++++++++++++ .../source/latex/xpackages/xhead/xhead.ins | 73 ++ .../source/latex/xpackages/xtras/l3keys2e-demo.tex | 46 - .../tex/latex/xpackages/xbase/xparse.sty | 73 +- .../tex/latex/xpackages/xbase/xtemplate.sty | 46 +- .../texmf-dist/tex/latex/xpackages/xhead/xhead.sty | 376 ++++++++ 24 files changed, 2509 insertions(+), 710 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/xpackages/xbase/template-test.tex create mode 100644 Master/texmf-dist/doc/latex/xpackages/xbase/template-test2.tex create mode 100644 Master/texmf-dist/doc/latex/xpackages/xbase/tprestrict-test.tex create mode 100644 Master/texmf-dist/doc/latex/xpackages/xbase/xparse-test.tex create mode 100644 Master/texmf-dist/doc/latex/xpackages/xhead/xhead-test.tex create mode 100644 Master/texmf-dist/doc/latex/xpackages/xhead/xhead.pdf create mode 100644 Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e-demo.tex delete mode 100644 Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex delete mode 100644 Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex delete mode 100644 Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex delete mode 100644 Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex create mode 100644 Master/texmf-dist/source/latex/xpackages/xhead/xhead.dtx create mode 100644 Master/texmf-dist/source/latex/xpackages/xhead/xhead.ins delete mode 100644 Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex create mode 100644 Master/texmf-dist/tex/latex/xpackages/xhead/xhead.sty (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/ldcsetup.pdf b/Master/texmf-dist/doc/latex/xpackages/xbase/ldcsetup.pdf index b0215e5557e..b62d9fa5e56 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xbase/ldcsetup.pdf and b/Master/texmf-dist/doc/latex/xpackages/xbase/ldcsetup.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/template-test.tex b/Master/texmf-dist/doc/latex/xpackages/xbase/template-test.tex new file mode 100644 index 00000000000..5684ce7a90f --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xbase/template-test.tex @@ -0,0 +1,77 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: template-test.tex 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% +\RequirePackage{template} + +\DeclareTemplateType{xxx}{0} + +\DeclareTemplate{xxx}{test}{0} + { + xkey=n \xkey, + key =i {yyy} \value + } + { + \DoParameterAssignments + \show\xkey + \show\value + \value + } + +\DeclareTemplateType{yyy}{0} + +\DeclareTemplate{yyy}{foo}{0} + { + keya =L \foo + } + { + \DoParameterAssignments + \show\foo + } + + +\DeclareInstance{xxx}{bar}{test} + { + xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, + key = \UseTemplate{yyy}{foo}{ keya = 10pt } + } + +\ShowInstance{xxx}{bar} + +\UseInstance{xxx}{bar} + +\stop diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/template-test2.tex b/Master/texmf-dist/doc/latex/xpackages/xbase/template-test2.tex new file mode 100644 index 00000000000..489e9f2304a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xbase/template-test2.tex @@ -0,0 +1,110 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: template-test2.tex 585 2006-12-12 17:31:48Z morten $ +%% +% \fi +% + + +\RequirePackage{template} +\RequirePackage{trace} + +\DeclareTemplateType{xxx}{0} + +\def\MultiSelection{\MultiSelectionError} +%\def\foo{bar} + +%\traceon + +\DeclareTemplate{xxx}{test}{0} + { + xkey=n [\foo] \xkey, + ykey=n [\DelayEvaluation\foo] \ykey, + zkey=n \zkey, + last=n [last] \lastkey, + set =i {xxx} \xxx + } + { + \DoParameterAssignments + \typeout{abc} + } +\ShowTemplate{xxx}{test} + + +\DeclareInstance{xxx}{bar}{test} + { + zkey = foo, + xkey = baz, + } + +\DeclareInstance{xxx}{baz}{test} + { + last = first, + set = \UseTemplate{xxx}{test}{zkey=rrr}, + zkey = foo + } + + +\ShowInstance{xxx}{bar} +\ShowInstance{xxx}{baz} + +\DeclareTemplateType{yyy}{0} + +\DeclareTemplate{yyy}{foo}{0} + { + keya =L \foo + } + { + \DoParameterAssignments + \show\foo + } + + +\DeclareInstance{xxx}{bar}{test} + { + xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, + key = \UseTemplate{yyy}{foo}{ keya = 10pt } + } + +\ShowInstance{xxx}{bar} + +\UseInstance{xxx}{bar} + +\stop + +%%% Local Variables: +%%% mode: plain-tex +%%% TeX-master: t +%%% End: diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/template.pdf b/Master/texmf-dist/doc/latex/xpackages/xbase/template.pdf index f5ba3fe63f2..397e456e3e4 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xbase/template.pdf and b/Master/texmf-dist/doc/latex/xpackages/xbase/template.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/tprestrict-test.tex b/Master/texmf-dist/doc/latex/xpackages/xbase/tprestrict-test.tex new file mode 100644 index 00000000000..d981888d450 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xbase/tprestrict-test.tex @@ -0,0 +1,80 @@ +% \iffalse +%% (C) Copyright 2000-2004 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: tprestrict-test.tex 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% + +\makeatletter +\RequirePackage{template} +\IgnoreWhiteSpace + +\newcount\ca +\newdimen\da + + +\DeclareTemplateType{type}{0} + +\DeclareTemplate{type}{Ta}{0}{ + one =l [2in] \da, + two =c [5] \ca} + {\DoParameterAssignments\typeout{\da=\the\da,\@spaces \ca=\the\ca}} + +\ShowTemplate{type}{Ta} + +\typeout{1^^J==} +\UseTemplate{type}{Ta}{} + +\typeout{2^^J==} +\UseTemplate{type}{Ta}{one=44pt, two=7} + + +\DeclareRestrictedTemplate{type}{Tb}{Ta}{one=33pt} + +\ShowTemplate{type}{Tb} + +\typeout{RESTRICT^^J3^^J==} + +\DeclareInstance{type}{foo}{Tb}{two=9} + +\ShowInstance{type}{foo} + +\UseInstance{type}{foo} + +\typeout{4^^J==} +\UseTemplate{type}{Tb}{two=7} + +\stop + diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/xparse-test.tex b/Master/texmf-dist/doc/latex/xpackages/xbase/xparse-test.tex new file mode 100644 index 00000000000..8614c4ed06a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xbase/xparse-test.tex @@ -0,0 +1,296 @@ +% \iffalse +%% (C) Copyright 2000-2009 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3a of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xbase bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: xparse-test.tex 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% + +\documentclass{minimal} + +\usepackage{xparse,l3box} + + +\typeout{Testing the complicated makebox setup} +\typeout{*****************************} +\typeout{* look at dvi output for this part} +\typeout{*****************************} + +\ExplSyntaxOn +\makeatletter +% Let's just take the error messages for a ride: +\cs_set_nopar:Npn \makebox{} +% Here should be an error because it is defined +\NewDocumentCommand \makebox {m}{Gobbledygook} +\cs_gundefine:N \makebox +% And now one for being undefined +\RenewDocumentCommand \makebox {m}{More~gobbledygook} +\cs_set_eq:NN \makebox \scan_stop: +% Another one for being undefined +\RenewDocumentCommand \makebox {m}{Even~more~gobbledygook} +% Now it should work +\DeclareDocumentCommand \makebox + { >{\xparse_process_comma_split:n}d() o O{c} m} + {\IfNoValueTF{#1} + { \ltx@maketextbox{#2}{#3}{#4}\mbox } + { \ltx@makepicbox #1 {#2}{#4}\@firstofone } + } + +\DeclareDocumentCommand \framebox + { >{\xparse_process_comma_split:n} d() o O{c} m} + { + \IfNoValueTF{#1} + { \ltx@maketextbox{#2}{#3}{#4}\fbox } + { \ltx@makepicbox #1 {#2}{#4}\frame } + } + +\def\ltx@maketextbox#1#2#3#4{ + \IfNoValueTF{#1} + {#4{#3}} + { + \leavevmode + \@begin@tempboxa\hbox{#3} + \setlength\@tempdima{#1} + \if_meaning:w #4\fbox + \setbox\@tempboxa\hb@xt@\@tempdima{ + \kern\fboxsep + \use:c{bm@#2} + \kern\fboxsep + } + \@frameb@x{\kern-\fboxrule} + \else: + \hb@xt@\@tempdima{\use:c{bm@#2}} + \fi: + \@end@tempboxa + } +} + +\def\ltx@makepicbox#1#2#3#4#5{ + #5 + { + \vbox to#2\unitlength { + \cs_set_eq:NN \mb@b\vss \cs_set_eq:NN \mb@l\hss + \cs_set_eq:NN \mb@r\hss \cs_set_eq:NN \mb@t\vss + \IfNoValueF{#3}{ + \tl_map_variable:nNn {#3}\l_tmpa_tl { + \if:w s\l_tmpa_tl + \cs_set_eq:NN \mb@l \scan_stop: + \cs_set_eq:NN \mb@r \scan_stop: + \else: + \cs_set_eq:cN {mb@\l_tmpa_tl}\scan_stop: + \fi: + } + } + \mb@t + \hb@xt@ #1\unitlength{\mb@l #4\mb@r} + \mb@b + \kern\z@ + } + } +} + +\makeatother +\ExplSyntaxOff + +\begin{document} + + +\thicklines + +\makebox{A} +\makebox(1,2){B} +\makebox(0,0)[lt]{C} +\makebox[20pt]{D} +\makebox[30pt][r]{E} + +\vspace{1cm} + + +\framebox{A} +\framebox(1,2){B} +\framebox(0,0)[lt]{C} +\framebox[20pt]{D} +\framebox[30pt][r]{E} + + +\typeout{Testing optional coordinates} + +\DeclareDocumentCommand \foo { mmo } +{ \typeout{1:#1} + \typeout{2:#2} +} + +\show\foo + +\ExplSyntaxOn +\DeclareDocumentCommand \foo + { m >{\xparse_process_comma_split:n} D(){0,0} m } +{ \typeout{1:#1} + \typeout{2:#2} + \typeout{3:#3} +} +\ExplSyntaxOff + +\show\foo + +\foo A(1,2)B + +\foo A B + +\typeout{Testing mandatory coordinates (gives error on second examples)} + +\ExplSyntaxOn +\DeclareDocumentCommand \foo { m >{\xparse_process_comma_split:n} d() m } +{ \IfNoValueTF {#2} { + \ERROR + }{ + \typeout{1:#1} + \typeout{2:#2} + \typeout{3:#3} + } +} +\ExplSyntaxOff + +\show\foo + +\foo A(1,2)B + +\foo A B + +\typeout{Testing normal optional arguments} + + +\DeclareDocumentCommand \foo { mmmm o mm o } +{ \typeout{1:#1} + \typeout{2:#2} + \typeout{3:#3} + \typeout{4:#4} + \typeout{5:#5} + \typeout{6:#6} + \typeout{7:#7} + \typeout{8:#8} +} + +\foo 1234 [5]67[8] +\foo 1234 [5]67 [8] % 8 should not be picked up here +\foo 123467 + +\show\foo +\expandafter\show\csname\string\foo\endcsname + + +\typeout{Testing optional arguments with default} + +\DeclareDocumentCommand \baz { O{?}mmm o mm m } +{ \typeout{1:#1} + \typeout{2:#2} + \typeout{3:#3} + \typeout{4:#4} + \typeout{5:#5} + \typeout{6:#6} + \typeout{7:#7} + \typeout{8:#8} +} + +\show\baz +\expandafter\show\csname\string\baz\endcsname + +\baz [1]234[5]678 +\baz 234678 + +%\tracingall\tracingassigns=1 +\DeclareDocumentCommand \bar { mmmm mmmm m} +{ \typeout{1:#1} + \typeout{2:#2} + \typeout{3:#3} + \typeout{4:#4} + \typeout{5:#5} + \typeout{6:#6} + \typeout{7:#7} + \typeout{8:#8} + \typeout{9:#9} +} + +\show\bar +\expandafter\show\csname\string\bar\endcsname + +\bar 123456789 + +\DeclareDocumentCommand\chapter{soom} +{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}} + +\show\chapter +\expandafter\show\csname\string\chapter\endcsname + +\typeout{1:} +\chapter*[xxx][yyy]{zzz} + +\typeout{2:} +\chapter[xxx][yyy]{zzz} + +\typeout{3:} +\chapter*[xxx]{zzz} + +\typeout{4:} +\typeout{\chapter*[xxx][yyy]{zzz}} + + + + +\DeclareDocumentCommand\chapter{soom} +{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}} + +\DeclareDocumentEnvironment{hello}{ooo} + {\typeout{B1(#1)^^JB2(#2)^^JB3(#3)^^J}} + {\typeout{E1(#1)^^JE2(#2)^^JE3(#3)^^J}} + + +\show\hello +\expandafter\show\csname\string\hello\endcsname + +\show\endhello +\expandafter\show\csname end\string\\hello\endcsname + +\begin{hello}[abc][aabbcc] +\typeout{body} +\typeout{5:} +\chapter[xxx][yyy]{zzz} +\end{hello} + +\begin{hello}[1] +\typeout{outer body} +\hello[2]\typeout{inner body}\endhello +\end{hello} + +\stop diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/xparse.pdf b/Master/texmf-dist/doc/latex/xpackages/xbase/xparse.pdf index d40f6ffbb14..e8937251978 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xbase/xparse.pdf and b/Master/texmf-dist/doc/latex/xpackages/xbase/xparse.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xbase/xtemplate.pdf b/Master/texmf-dist/doc/latex/xpackages/xbase/xtemplate.pdf index 6a3929a5f02..464cf177937 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xbase/xtemplate.pdf and b/Master/texmf-dist/doc/latex/xpackages/xbase/xtemplate.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xhead/xhead-test.tex b/Master/texmf-dist/doc/latex/xpackages/xhead/xhead-test.tex new file mode 100644 index 00000000000..f845a1f077a --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xhead/xhead-test.tex @@ -0,0 +1,245 @@ +\documentclass[twoside,check-declarations]{article} + +\pagestyle{headings} +\usepackage{xparse,xtemplate} + + +\usepackage{xgalley} + +\ExplSyntaxOn + +\DeclareTemplateInterface { parshape } { rectangle } { 0 } { + forbid-page-break : boolean = false , +} + +\DeclareTemplateCode { parshape } { rectangle } { 0 } + { + forbid-page-break = \l_xgalley_parshape_no_break_bool , + } + { + \AssignTemplateKeys + \xgalley_measure_adjust_parshape: + } + +\DeclareInstance { parshape } { plain } { rectangle } { + forbid-page-break = false +} + +\DeclareInstance {measure} {fullwidth} {absolute} { + left-margin = 0pt , + right-margin = 0pt +} + +\ExplSyntaxOff + + +\usepackage{xhead} + + +\DeclareDocumentCommand \sectionII {som} + { \UseInstance{heading}{sectionII} {#1}{#2}\BooleanFalse\NoValue\BooleanFalse{#3}{} } + +\DeclareDocumentCommand \subsectionII {som} + { \UseInstance{heading}{subsectionII} {#1}{#2}\BooleanFalse\NoValue\BooleanFalse{#3}{} } + +\DeclareDocumentCommand \subsubsectionII {som} + { \UseInstance{heading}{subsubsectionII} {#1}{#2}\BooleanFalse\NoValue\BooleanFalse{#3}{} } + + + +\DeclareInstance {heading} {sectionII} {2e-vertical} + { + name = section, + level = 1, + indent = 0pt, + above-skip = 3.5ex plus 1ex minus 0.2ex, + below-skip = 2.3ex plus 0.2ex, + title-decl = \normalfont\Large\bfseries, + indent-after = false, + } +\DeclareInstance {heading} {subsectionII} {2e-vertical} + { + name = subsection, + level = 2, + indent = 0pt, + above-skip = 3.25ex plus 1ex minus 0.2ex, + below-skip = 1.5ex plus 0.2ex, + title-decl = \normalfont\large\bfseries, + indent-after = false, + } + +\DeclareInstance {heading} {subsubsectionII} {2e-vertical} + { + name = subsubsection, + level = 3, + indent = 0pt, + above-skip = 3.25ex plus 1ex minus 0.2ex, + below-skip = 1.5ex plus 0.2ex, + title-decl = \normalfont\normalsize\bfseries, + indent-after = false, + } + + +\DeclareDocumentCommand \section {D<>{} sososm} + { \UseInstance{heading}{section} {#2}{#3}{#4}{#5}{#6}{#7}{#1} } + +\DeclareDocumentCommand \subsection {D<>{} sososm} + { \UseInstance{heading}{subsection} {#2}{#3}{#4}{#5}{#6}{#7}{#1} } + +\DeclareDocumentCommand \subsubsection {D<>{} sososm} + { \UseInstance{heading}{subsubsection} {#2}{#3}{#4}{#5}{#6}{#7}{#1} } + + +\DeclareInstance {heading} {section} {3a-vertical} + { + name = section, + level = 1, + indent = 0pt, + above-skip = 3.5ex plus 1ex minus 0.2ex, + below-skip = 2.3ex plus 0.2ex, + font = \normalfont\Large\bfseries, + indent-after = false, + } +\DeclareInstance {heading} {subsection} {3a-vertical} + { + name = subsection, + level = 2, + indent = 0pt, + above-skip = 3.25ex plus 1ex minus 0.2ex, + below-skip = 1.5ex plus 0.2ex, + font = \normalfont\large\bfseries, + indent-after = false, + } + +\DeclareInstance {heading} {subsubsection} {3a-vertical} + { + name = subsubsection, + level = 3, + indent = 0pt, + above-skip = 3.25ex plus 1ex minus 0.2ex, + below-skip = 1.5ex plus 0.2ex, + font = \normalfont\normalsize\bfseries, + indent-after = false, + } + +\DeclareInstance {heading} {section} {3b-vertical} + { + name = section, + level = 1, + indent = 0pt, + above-skip = 3.25ex plus 1ex minus 0.2ex, + below-skip = 1.5ex plus 0.2ex, + indent-after = false, + title-format = \UseTemplate{textblock-2}{hangfrom} + { + font-1 = \normalfont\Huge\sffamily , + font-2 = \normalfont\Large\bfseries, + parshape = plain , + justification = flush-left , + } + } + + +\setcounter{secnumdepth}{2} + +\begin{document} + + +\tableofcontents + + +\sectionII{2e section test} +Some text + +\subsectionII*{2e subsection test - star} +Some text + +\subsectionII{2e subsection test} +Some text + +\subsectionII{2e subsection test - very long very long very long very long + very long very long very long very long very long very long very with some + variance in text long very long very long very long very long very long } +Some text + +\subsubsectionII{2e subsubsection test} +Some text + +\subsectionII[2e subsection short]{2e subsection test - optional arg} +Some text + +\newpage + +\subsubsectionII*{2e subsubsection test - star} +Some text + +\subsubsectionII[2e subsubsection short]{2e subsubsection test - optional arg} +Some text + + +\sectionII[2e section short]{2e section test - optional arg} +Some text + +\sectionII*{2e section test - star} +Some text + +\newpage + + +\section{3a section test} +Some text + +\subsection*{3a subsection test - star} +Some text + +\subsection*[subsection star - forced]*{3a subsection test - star - forced} +Some text + +\subsection{3a subsection test} +Some text + +\subsection{3a subsection test - very long very long very long very long + very long very long very long very long very long very long very with some + variance in text long very long very long very long very long very long } +Some text + +\subsubsection{3a subsubsection test} +Some text + +\subsection[3a subsection short]{3a subsection test - optional arg} +Some text + +\newpage + +\subsubsection*{3a subsubsection test - star} +Some text + +\subsubsection*[subsubsection star - forced]*{3a subsubsection test - star - forced} +Some text + +\subsubsection[3a subsubsection short]{3a subsubsection test - optional arg} +Some text + +\section[3a section short]{3a section test - optional arg} +Some text + +\section*{3a section test - star} +Some text + +\section***{3a section test - 3 stars} +Some text + +\section*[][]*{3a section test - 2 stars} +Some text + +\section[3a section short2][3a section run]{3a section test - 2 optional args} +Some text + +\newpage + +Some more text + +\section{3a section test - angles} +Some text + +\end{document} diff --git a/Master/texmf-dist/doc/latex/xpackages/xhead/xhead.pdf b/Master/texmf-dist/doc/latex/xpackages/xhead/xhead.pdf new file mode 100644 index 00000000000..c7859c06146 Binary files /dev/null and b/Master/texmf-dist/doc/latex/xpackages/xhead/xhead.pdf differ diff --git a/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e-demo.tex b/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e-demo.tex new file mode 100644 index 00000000000..a00531e0741 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e-demo.tex @@ -0,0 +1,46 @@ +% !TEX encoding = ISO-8859-1 +% !TEX program = pdflatex +% +% This file demonstrates the use of the l3keys2e module to allow +% LaTeX3 keyvals (created using l3keys) to be used as LaTeX2e +% package or class options. +% + +% First, create a class +\begin{filecontents}{l3keys2e-class.cls} + \LoadClass{article} + \RequirePackage{l3keys2e} + \ProvidesExplClass{l3keys2e-class}{0000/00/00}{0.0}{test} + \keys_define:nn { test1 } { + option1 .code:n = {\wlog{You~gave~`#1'~for~option1}} + } + \ProcessKeysOptions { test1 } +\end{filecontents} + +% Load the class with some options. +% The class itself recognises `option1', leaving `option2' and +% `option3' as global optons which are not yet used. +\documentclass[option1=check,option2=more stuff,option3=unused] + {l3keys2e-class} + +%Now create a package +\begin{filecontents}{l3keys2e-package.sty} + \RequirePackage{l3keys2e} + \ProvidesExplPackage{l3keys2e-package}{0000/00/00}{0.0}{test} + \keys_define:nn { test2 } { + option1 .code:n = {\wlog{You~gave~`#1'~for~option1~(again)}}, + option2 .code:n = {\wlog{You~gave~`#1'~for~option2}}, + option4 .code:n = {\wlog{You~gave~`#1'~for~option4}}, + } + \ProcessKeysOptions { test2 } +\end{filecontents} + +% Load the package. +\usepackage[option4={extra stuff},option5=undefined!] + {l3keys2e-package} + +\begin{document} +% The log should show that option3 is an unused global option, and that +% option5 is not known by the l3keys2e-demo package. Everything else +% should simply be listed in the log. +\end{document} diff --git a/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e.pdf b/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e.pdf index 6c4f6b306a1..7654ce77360 100644 Binary files a/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e.pdf and b/Master/texmf-dist/doc/latex/xpackages/xtras/l3keys2e.pdf differ diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex deleted file mode 100644 index 5684ce7a90f..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xbase/template-test.tex +++ /dev/null @@ -1,77 +0,0 @@ -% \iffalse -%% (C) Copyright 2000-2004 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xbase bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: template-test.tex 1628 2009-10-25 09:54:34Z mittelba $ -%% -% \fi -% -\RequirePackage{template} - -\DeclareTemplateType{xxx}{0} - -\DeclareTemplate{xxx}{test}{0} - { - xkey=n \xkey, - key =i {yyy} \value - } - { - \DoParameterAssignments - \show\xkey - \show\value - \value - } - -\DeclareTemplateType{yyy}{0} - -\DeclareTemplate{yyy}{foo}{0} - { - keya =L \foo - } - { - \DoParameterAssignments - \show\foo - } - - -\DeclareInstance{xxx}{bar}{test} - { - xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, - key = \UseTemplate{yyy}{foo}{ keya = 10pt } - } - -\ShowInstance{xxx}{bar} - -\UseInstance{xxx}{bar} - -\stop diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex b/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex deleted file mode 100644 index 489e9f2304a..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xbase/template-test2.tex +++ /dev/null @@ -1,110 +0,0 @@ -% \iffalse -%% (C) Copyright 2000-2004 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xbase bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/cgi-bin/cvsweb.cgi/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: template-test2.tex 585 2006-12-12 17:31:48Z morten $ -%% -% \fi -% - - -\RequirePackage{template} -\RequirePackage{trace} - -\DeclareTemplateType{xxx}{0} - -\def\MultiSelection{\MultiSelectionError} -%\def\foo{bar} - -%\traceon - -\DeclareTemplate{xxx}{test}{0} - { - xkey=n [\foo] \xkey, - ykey=n [\DelayEvaluation\foo] \ykey, - zkey=n \zkey, - last=n [last] \lastkey, - set =i {xxx} \xxx - } - { - \DoParameterAssignments - \typeout{abc} - } -\ShowTemplate{xxx}{test} - - -\DeclareInstance{xxx}{bar}{test} - { - zkey = foo, - xkey = baz, - } - -\DeclareInstance{xxx}{baz}{test} - { - last = first, - set = \UseTemplate{xxx}{test}{zkey=rrr}, - zkey = foo - } - - -\ShowInstance{xxx}{bar} -\ShowInstance{xxx}{baz} - -\DeclareTemplateType{yyy}{0} - -\DeclareTemplate{yyy}{foo}{0} - { - keya =L \foo - } - { - \DoParameterAssignments - \show\foo - } - - -\DeclareInstance{xxx}{bar}{test} - { - xkey = \UseTemplate{yyy}{foo}{ keya = 20pt }, - key = \UseTemplate{yyy}{foo}{ keya = 10pt } - } - -\ShowInstance{xxx}{bar} - -\UseInstance{xxx}{bar} - -\stop - -%%% Local Variables: -%%% mode: plain-tex -%%% TeX-master: t -%%% End: diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex deleted file mode 100644 index d981888d450..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xbase/tprestrict-test.tex +++ /dev/null @@ -1,80 +0,0 @@ -% \iffalse -%% (C) Copyright 2000-2004 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xbase bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: tprestrict-test.tex 1628 2009-10-25 09:54:34Z mittelba $ -%% -% \fi -% - -\makeatletter -\RequirePackage{template} -\IgnoreWhiteSpace - -\newcount\ca -\newdimen\da - - -\DeclareTemplateType{type}{0} - -\DeclareTemplate{type}{Ta}{0}{ - one =l [2in] \da, - two =c [5] \ca} - {\DoParameterAssignments\typeout{\da=\the\da,\@spaces \ca=\the\ca}} - -\ShowTemplate{type}{Ta} - -\typeout{1^^J==} -\UseTemplate{type}{Ta}{} - -\typeout{2^^J==} -\UseTemplate{type}{Ta}{one=44pt, two=7} - - -\DeclareRestrictedTemplate{type}{Tb}{Ta}{one=33pt} - -\ShowTemplate{type}{Tb} - -\typeout{RESTRICT^^J3^^J==} - -\DeclareInstance{type}{foo}{Tb}{two=9} - -\ShowInstance{type}{foo} - -\UseInstance{type}{foo} - -\typeout{4^^J==} -\UseTemplate{type}{Tb}{two=7} - -\stop - diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex b/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex deleted file mode 100644 index 8614c4ed06a..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xbase/xparse-test.tex +++ /dev/null @@ -1,296 +0,0 @@ -% \iffalse -%% (C) Copyright 2000-2009 LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3a of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the ``xbase bundle'' (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX Project Team. -%% -%% ----------------------------------------------------------------------- -%% -%% $Id: xparse-test.tex 1628 2009-10-25 09:54:34Z mittelba $ -%% -% \fi -% - -\documentclass{minimal} - -\usepackage{xparse,l3box} - - -\typeout{Testing the complicated makebox setup} -\typeout{*****************************} -\typeout{* look at dvi output for this part} -\typeout{*****************************} - -\ExplSyntaxOn -\makeatletter -% Let's just take the error messages for a ride: -\cs_set_nopar:Npn \makebox{} -% Here should be an error because it is defined -\NewDocumentCommand \makebox {m}{Gobbledygook} -\cs_gundefine:N \makebox -% And now one for being undefined -\RenewDocumentCommand \makebox {m}{More~gobbledygook} -\cs_set_eq:NN \makebox \scan_stop: -% Another one for being undefined -\RenewDocumentCommand \makebox {m}{Even~more~gobbledygook} -% Now it should work -\DeclareDocumentCommand \makebox - { >{\xparse_process_comma_split:n}d() o O{c} m} - {\IfNoValueTF{#1} - { \ltx@maketextbox{#2}{#3}{#4}\mbox } - { \ltx@makepicbox #1 {#2}{#4}\@firstofone } - } - -\DeclareDocumentCommand \framebox - { >{\xparse_process_comma_split:n} d() o O{c} m} - { - \IfNoValueTF{#1} - { \ltx@maketextbox{#2}{#3}{#4}\fbox } - { \ltx@makepicbox #1 {#2}{#4}\frame } - } - -\def\ltx@maketextbox#1#2#3#4{ - \IfNoValueTF{#1} - {#4{#3}} - { - \leavevmode - \@begin@tempboxa\hbox{#3} - \setlength\@tempdima{#1} - \if_meaning:w #4\fbox - \setbox\@tempboxa\hb@xt@\@tempdima{ - \kern\fboxsep - \use:c{bm@#2} - \kern\fboxsep - } - \@frameb@x{\kern-\fboxrule} - \else: - \hb@xt@\@tempdima{\use:c{bm@#2}} - \fi: - \@end@tempboxa - } -} - -\def\ltx@makepicbox#1#2#3#4#5{ - #5 - { - \vbox to#2\unitlength { - \cs_set_eq:NN \mb@b\vss \cs_set_eq:NN \mb@l\hss - \cs_set_eq:NN \mb@r\hss \cs_set_eq:NN \mb@t\vss - \IfNoValueF{#3}{ - \tl_map_variable:nNn {#3}\l_tmpa_tl { - \if:w s\l_tmpa_tl - \cs_set_eq:NN \mb@l \scan_stop: - \cs_set_eq:NN \mb@r \scan_stop: - \else: - \cs_set_eq:cN {mb@\l_tmpa_tl}\scan_stop: - \fi: - } - } - \mb@t - \hb@xt@ #1\unitlength{\mb@l #4\mb@r} - \mb@b - \kern\z@ - } - } -} - -\makeatother -\ExplSyntaxOff - -\begin{document} - - -\thicklines - -\makebox{A} -\makebox(1,2){B} -\makebox(0,0)[lt]{C} -\makebox[20pt]{D} -\makebox[30pt][r]{E} - -\vspace{1cm} - - -\framebox{A} -\framebox(1,2){B} -\framebox(0,0)[lt]{C} -\framebox[20pt]{D} -\framebox[30pt][r]{E} - - -\typeout{Testing optional coordinates} - -\DeclareDocumentCommand \foo { mmo } -{ \typeout{1:#1} - \typeout{2:#2} -} - -\show\foo - -\ExplSyntaxOn -\DeclareDocumentCommand \foo - { m >{\xparse_process_comma_split:n} D(){0,0} m } -{ \typeout{1:#1} - \typeout{2:#2} - \typeout{3:#3} -} -\ExplSyntaxOff - -\show\foo - -\foo A(1,2)B - -\foo A B - -\typeout{Testing mandatory coordinates (gives error on second examples)} - -\ExplSyntaxOn -\DeclareDocumentCommand \foo { m >{\xparse_process_comma_split:n} d() m } -{ \IfNoValueTF {#2} { - \ERROR - }{ - \typeout{1:#1} - \typeout{2:#2} - \typeout{3:#3} - } -} -\ExplSyntaxOff - -\show\foo - -\foo A(1,2)B - -\foo A B - -\typeout{Testing normal optional arguments} - - -\DeclareDocumentCommand \foo { mmmm o mm o } -{ \typeout{1:#1} - \typeout{2:#2} - \typeout{3:#3} - \typeout{4:#4} - \typeout{5:#5} - \typeout{6:#6} - \typeout{7:#7} - \typeout{8:#8} -} - -\foo 1234 [5]67[8] -\foo 1234 [5]67 [8] % 8 should not be picked up here -\foo 123467 - -\show\foo -\expandafter\show\csname\string\foo\endcsname - - -\typeout{Testing optional arguments with default} - -\DeclareDocumentCommand \baz { O{?}mmm o mm m } -{ \typeout{1:#1} - \typeout{2:#2} - \typeout{3:#3} - \typeout{4:#4} - \typeout{5:#5} - \typeout{6:#6} - \typeout{7:#7} - \typeout{8:#8} -} - -\show\baz -\expandafter\show\csname\string\baz\endcsname - -\baz [1]234[5]678 -\baz 234678 - -%\tracingall\tracingassigns=1 -\DeclareDocumentCommand \bar { mmmm mmmm m} -{ \typeout{1:#1} - \typeout{2:#2} - \typeout{3:#3} - \typeout{4:#4} - \typeout{5:#5} - \typeout{6:#6} - \typeout{7:#7} - \typeout{8:#8} - \typeout{9:#9} -} - -\show\bar -\expandafter\show\csname\string\bar\endcsname - -\bar 123456789 - -\DeclareDocumentCommand\chapter{soom} -{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}} - -\show\chapter -\expandafter\show\csname\string\chapter\endcsname - -\typeout{1:} -\chapter*[xxx][yyy]{zzz} - -\typeout{2:} -\chapter[xxx][yyy]{zzz} - -\typeout{3:} -\chapter*[xxx]{zzz} - -\typeout{4:} -\typeout{\chapter*[xxx][yyy]{zzz}} - - - - -\DeclareDocumentCommand\chapter{soom} -{\typeout{a{#1}^^Jb{#2}^^Jc{#3}^^Jd{#4}^^Je}} - -\DeclareDocumentEnvironment{hello}{ooo} - {\typeout{B1(#1)^^JB2(#2)^^JB3(#3)^^J}} - {\typeout{E1(#1)^^JE2(#2)^^JE3(#3)^^J}} - - -\show\hello -\expandafter\show\csname\string\hello\endcsname - -\show\endhello -\expandafter\show\csname end\string\\hello\endcsname - -\begin{hello}[abc][aabbcc] -\typeout{body} -\typeout{5:} -\chapter[xxx][yyy]{zzz} -\end{hello} - -\begin{hello}[1] -\typeout{outer body} -\hello[2]\typeout{inner body}\endhello -\end{hello} - -\stop diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx index 6966f9f1e5a..32514be2fe1 100644 --- a/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xbase/xparse.dtx @@ -41,7 +41,7 @@ \RequirePackage{l3names} % %\fi -\GetIdInfo$Id: xparse.dtx 1876 2010-03-27 07:20:51Z joseph $ +\GetIdInfo$Id: xparse.dtx 1897 2010-04-26 05:56:56Z joseph $ {Generic document command parser} %\iffalse %<*driver> @@ -50,6 +50,7 @@ [\filedate\space v\fileversion\space\filedescription] %\iffalse \documentclass{l3doc} +\usepackage{amstext} \begin{document} \DocInput{xparse.dtx} \end{document} @@ -393,39 +394,38 @@ % \end{verbatim} %\end{function} % -%\begin{function}{\xparse_process_comma_split:n} +%\begin{function}{ \ReverseBoolean } % \begin{syntax} -% "\xparse_process_comma_split:n" -% ~~~~\Arg{grabbed argument} +% \cs{ReverseBoolean} % \end{syntax} -% The \cs{xparse_process_comma_split:n} processor splits the -% grabbed argument at the first comma, returning the two -% parts of the result in braces. If no comma is found, the second -% part of the returned value \cs{NoValue}. This function is intended to -% aid the processing of co-ordinate pairs. For example, to create -% a co-ordinate argument which raises an error if not given: +% This processor reverses the logic of \cs{BooleanTrue} and +% \cs{BooleanFalse}, so that the the example from earlier would become % \begin{verbatim} -% \DeclareDocumentCommand \foo -% { >{\xparse_process_comma_split:n} d() } { -% \IfNoValueTF #1 { -% \ERROR -% }{ -% \foo_internal:nn #1 -% } -% } +% \DeclareDocumentCommand \foo { > { \ReverseBoolean } s m } { +% \IfBooleanTF #1 +% { \DoSomethingWithoutStar {#2} } +% { \DoSomethingWithStar {#2} } +% } % \end{verbatim} -% For the input |\foo(1.1,2.2)|, |#1| here would equal |{1.1}{2.2}|, -% and so \cs{foo_internal:nn} receives exactly the correct number of -% arguments. A similar function which takes an optional co-ordinate -% pair, could be created as: +%\end{function} +% +%\begin{function}{ \SplitArgument } +% \begin{syntax} +% \cs{SplitArgument} \Arg{number} \Arg{token} +% \end{syntax} +% This processor splits the argument given at each occurrence of the +% \meta{token} up to a maximum of \meta{number} tokens (thus +% dividing the input into \( \text{\meta{number}} + 1 \) parts). +% An error is given if too many \meta{tokens} are present in the +% input. The processed input is places inside +% \( \text{\meta{number}} + 1 \) sets of braces for further use. % \begin{verbatim} % \DeclareDocumentCommand \foo -% { >{\xparse_process_comma_split:n} D(){0,0} } { -% \foo_internal:nn #1 -% } +% { > { \SplitArgument { 2 } { ; } } m } +% { \InternalFunctionOfThreeArguments #1 } % \end{verbatim} -% This illustrates that the processor function will be applied to the -% default value, which therefore includes a comma. +% Any category code \( 13 \) (active) \meta{tokens} will be replaced +% before the split takes place. %\end{function} % %\subsection{Separating interface and implementation} @@ -2059,22 +2059,79 @@ % \end{macrocode} %\end{macro} % -%\begin{macro}{\xparse_process_comma_split:n} -%\begin{macro}[aux]{\xparse_process_comma_split_aux:w} -% Turns a co-ordinate pair into two separate values. +%\begin{macro}{\_parse_bool_reverse:N} +% A simple reversal. % \begin{macrocode} -\cs_new:Npn \xparse_process_comma_split:n #1 { - \tl_if_in:nnTF {#1} { , } { - \xparse_process_comma_split_aux:w #1 \q_stop - }{ - \tl_set:Nn \ProcessedArgument { {#1} { \NoValue } } - } -} -\cs_new:Npn \xparse_process_comma_split_aux:w #1 , #2 \q_stop { - \tl_set:Nn \ProcessedArgument { {#1} {#2} } +\cs_new_protected:Npn \_xparse_bool_reverse:N #1 { + \bool_if:NTF #1 + { \tl_set:Nn \ProcessedArgument { \c_false_bool } } + { \tl_set:Nn \ProcessedArgument { \c_true_bool } } } % \end{macrocode} %\end{macro} +% +%\begin{macro}{\_l_xparse_split_argument_tl} +%\begin{macro}{\_xparse_split_argument:nnn} +%\begin{macro}[aux]{\_xparse_split_argument_aux_i:w} +%\begin{macro}[aux]{\_xparse_split_argument_aux_ii:w} +%\begin{macro}[aux]{\_xparse_split_argument_aux_iii:w} +% The idea of this function is to split the input \( n + 1 \) times using +% a given token. +% \begin{macrocode} +\tl_new:N \_l_xparse_split_argument_tl +\group_begin: + \char_make_active:N \@ + \cs_gset_protected:Npn \_xparse_split_argument:nnn #1#2#3 + { + \tl_set:Nn \_l_xparse_split_argument_tl {#3} + \group_begin: + \char_set_lccode:nn { `\@ } { `#2} + \tl_to_lowercase:n + { + \group_end: + \tl_replace_all_in:Nnn \_l_xparse_split_argument_tl { @ } {#2} + } + \cs_set_protected:Npn \_xparse_split_argument_aux_i:w + ##1 \q_nil ##2 #2 ##3 \q_stop + { + \tl_put_right:Nn \ProcessedArgument { {##2} } + ##1 \q_nil ##3 \q_stop + } + \cs_set_protected:Npn \_xparse_split_argument_aux_iii:w + ##1 #2 ##2 \q_stop + { + \IfNoValueF {##1} + { + \msg_kernel_error:nnxxx { xparse } { split-excess-tokens } + { \exp_not:n {#2} } {#1} { \exp_not:n {#3} } + } + } + \tl_set:Nx \_l_xparse_tmp_tl + { + \prg_replicate:nn { #1 + 1 } + { \_xparse_split_argument_aux_i:w } + \_xparse_split_argument_aux_ii:w + \exp_not:N \q_nil + \exp_not:V \_l_xparse_split_argument_tl + \prg_replicate:nn {#1} { \exp_not:n {#2} \NoValue } + \exp_not:n { #2 \q_stop } + } + \_l_xparse_tmp_tl + } +\group_end: +\cs_set_protected:Npn \_xparse_split_argument_aux_i:w { } +\cs_set_protected:Npn \_xparse_split_argument_aux_ii:w + #1 \q_nil #2 \q_stop + { + \tl_if_empty:nF {#2} + { \_xparse_split_argument_aux_iii:w #2 \q_stop } + } +\cs_set_protected:Npn \_xparse_split_argument_aux_iii:w { } +% \end{macrocode} +%\end{macro} +%\end{macro} +%\end{macro} +%\end{macro} %\end{macro} % %\subsection{Creating expandable functions} @@ -2473,6 +2530,13 @@ Argument~specification~'#1'~contains~a~processor~function:\\ this~is~only~supported~for~standard~robust~functions. } +\msg_kernel_set:nnnn { xparse } { split-excess-tokens } + { Too~many~'#1'~tokens~when~trying~to~split~argument. } + { + LaTeX~was~asked~to~split~the~input~'#3'\\ + at~each~occurrence~of~the~token~'#1',~up~to~a~maximum~of~#2~tokens.\\ + There~were~too~many~'#1'~tokens. + } \msg_kernel_new:nnnn { xparse } { unknown-argument-type } { Unknown~argument~type~'#1'~replaced~by~'m'.~Fingers~crossed~... } { @@ -2684,6 +2748,20 @@ % \end{macrocode} %\end{macro} % +%\begin{macro}{\ReverseBoolean} +% A processor to reverse the logic for token detection. +% \begin{macrocode} +\cs_new_eq:NN \ReverseBoolean \_xparse_bool_reverse:N +% \end{macrocode} +%\end{macro} +% +%\begin{macro}{\SplitArgument} +% Another simple copy. +% \begin{macrocode} +\cs_new_eq:NN \SplitArgument \_xparse_split_argument:nnn +% \end{macrocode} +%\end{macro} +% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx index 0287282d898..d6f317c1072 100644 --- a/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/xpackages/xbase/xtemplate.dtx @@ -38,7 +38,7 @@ \RequirePackage{l3names} % %\fi -\GetIdInfo$Id: xtemplate.dtx 1879 2010-03-29 17:48:38Z mittelba $ +\GetIdInfo$Id: xtemplate.dtx 1896 2010-04-14 17:40:38Z joseph $ {Prototype document functions} %\iffalse %<*driver> @@ -1902,7 +1902,7 @@ \cs_new:Npn \xtemplate_split_keytype:n #1 { \bool_set_false:N \l_xtemplate_error_bool \tl_set:Nn \l_xtemplate_tmp_tl {#1} - \tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { ~ } { } + \tl_remove_all_in:Nn \l_xtemplate_tmp_tl { ~ } \tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { : } { @ } \tl_if_in:VnTF \l_xtemplate_tmp_tl { @ } { \exp_after:wN \xtemplate_split_keytype_aux:w \l_xtemplate_tmp_tl @@ -2699,9 +2699,9 @@ % \begin{macrocode} \cs_new_nopar:Npn \xtemplate_assign_code: { \tl_put_left:Nx \l_xtemplate_assignments_tl { - \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n ##1 { - \exp_not:V \l_xtemplate_var_tl - } + \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n + \exp_not:n {##1} + { \exp_not:V \l_xtemplate_var_tl } \exp_not:N \xtemplate_assign_code:n { \exp_not:V \l_xtemplate_value_tl } } @@ -3024,7 +3024,7 @@ % The text for error messages: short and long text for all of them. % \begin{macrocode} \msg_kernel_new:nnnn { xtemplate } { argument-number-mismatch } - { Object~type~'#1'~takes~'#2' ~not~'#3'~argument(s). } + { Object~type~'#1'~takes~'#2'~not~'#3'~argument(s). } { Objects~of~type~'#1'~require~'#2'~arguments.\\ You~have~tried~to~make~a~template~for~'#1'\\ @@ -3058,7 +3058,7 @@ { The~choice~'unknown'~cannot~be~given~for~a~template~key.} { The~'unknown'~choice~is~automatically~checked~by~template~when \\ - a~choice~key~is~given with~an~unknown~value.~It~should~not~be \\ + a~choice~key~is~given~with~an~unknown~value.~It~should~not~be \\ included~in~the~list~of~named~choices~for~a~key,~and~is~always \\ given~last~in~the~implementation~of~choices. } @@ -3085,24 +3085,23 @@ \msg_kernel_new:nnnn { xtemplate } { key-no-variable } { The~key~'#1'~requires~implementation~details~\msg_line_context:. } { - When~creating~template~code~using~ - \token_to_str:N \DeclareTemplateCode,\\ + When~creating~template~code~using~\DeclareTemplateCode,\\ each~key~name~must~have~an~associated~implementation.\\ This~should~be~given~after~a~'='~sign:~I~did~not~find~one. } \msg_kernel_new:nnnn { xtemplate } { key-not-implemented } { Key~'#1'~has~no~implementation~\msg_line_context:. } { - The~definition~of key implementations~for~template~'#2'\\ + The~definition~of~key~implementations~for~template~'#2'\\ of~object~type~'#3'~does not~include~any~details~for~key~'#1'.\\ - The~key was declared~in~the~interface definition,\\ + The~key~was~declared~in~the~interface~definition,\\ and~so~an~implementation~is~required. } \msg_kernel_new:nnnn { xtemplate } { keytype-requires-argument } { The~keytype~'#1'~requires~an~argument~\msg_line_context:. } { You~should~have~put:\\ - \c_space_tl \c_space_tl ~:~#1 + \c_space_tl \c_space_tl ~:~#1~ \token_to_str:N {~~\token_to_str:N } \\ but~I~did~not~find~an~. } @@ -3119,21 +3118,17 @@ or~has~no~implementation. } { - You~need~to~declare~a~templat~with - \token_to_str:N \DeclareTemplateInterface \\ - and~its~code~with - \token_to_str:N \DeclareTemplateCode \c_space_tl - prior~to~using~it. + You~need~to~declare~a~template~with~\DeclareTemplateInterface \\ + and~its~code~with~\DeclareTemplateCode prior~to~using~it. } \msg_kernel_new:nnnn { xtemplate } { type-mismatch } { Object~types~'#1'~and~'#2'~do~not~agree. } { - You~are~trying~to~use~a~template~directly~with - \token_to_str:N \UseInstance \\ + You~are~trying~to~use~a~template~directly~with~\UseInstance \\ (or~a~similar~function),~but~the~object~types~do~not~match. } \msg_kernel_new:nnnn { xtemplate } { undeclared-variable } - {The~variable~#1~has~not~been~declared. } + { The~variable~#1~has~not~been~declared. } { Before~declaring~an~instance,~all~of~the~required~variables\\ used~in~template~keys~must~be~created. @@ -3149,13 +3144,13 @@ \msg_kernel_new:nnnn { xtemplate } { unknown-choice } { The~choice~'#1'~was~not~declared~for~key~'#2'~\msg_line_context:. } { - The~key '#2'~takes~a~fixed~number~of~choices:\\ + The~key~'#2'~takes~a~fixed~number~of~choices:\\ \clist_map_function:NN #3 \xtemplate_unknown_choice_aux:n and~this~list~does~not~include~'#1'. } \cs_new:Npn \xtemplate_unknown_choice_aux:n #1 { -~ #1 ;\\} \msg_kernel_new:nnnn { xtemplate } { unknown-keytype } - { The~keytype '#1'~is~unknown~\msg_line_context:. } + { The~keytype~'#1'~is~unknown~\msg_line_context:. } { Valid~keytypes~are:\\ -~boolean;\\ @@ -3170,11 +3165,10 @@ -~tokenlist. } \msg_kernel_new:nnnn { xtemplate } { unknown-object-type } - { The ~object~type~'#1'~is~unknown~\msg_line_context:. } + { The~object~type~'#1'~is~unknown~\msg_line_context:. } { - An~object~type~needs~to~be~declared~with - \token_to_str:N \DeclareObjectType \c_space_tl - prior~to~using~it. + An~object~type~needs~to~be~declared~with~ + \DeclareObjectType prior~to~using~it. } \msg_kernel_new:nnnn { xtemplate } { unknown-instance } { The~instance~'#2'~of~type~'#1'~is~unknown. } diff --git a/Master/texmf-dist/source/latex/xpackages/xhead/xhead.dtx b/Master/texmf-dist/source/latex/xpackages/xhead/xhead.dtx new file mode 100644 index 00000000000..b5a980b8ee1 --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xhead/xhead.dtx @@ -0,0 +1,986 @@ +% \iffalse +%% File xhead.dtx (C) Copyright 2010 Frank Mittelbach, LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xhead bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%<*driver|package> +\RequirePackage{expl3} +\GetIdInfo$Id: xhead.dtx 1686 2009-11-03 08:19:19Z joseph $ + {Templates heading commands} +% +%<*driver> +%\fi +\ProvidesFile{\filename.\filenameext} + [\filedate\space v\fileversion\space\filedescription] +%\iffalse +\documentclass{l3doc} + + +% next three definitions are big hacks to run the file +% without the above packages +% +\makeatother + +\newcommand\key[1]{\textbf{#1}} + + \begin{document} + \DocInput{xhead.dtx} + \end{document} +% +% \fi +% +% ^^A\CheckSum{343} +% +% +% \title{The \textsf{xhead} package\thanks{This file +% has version number \fileversion, last +% revised \filedate.}} +% \author{FMi} +% \date{\filedate} +% \maketitle +% +% \tableofcontents +% +% \bigskip +% +% \begin{abstract} +% This module contains basic templates generating typical headings for +% various levels. This is very much work in progress and none of its content +% should be considered stable. Concepts and implementation are still under +% development. +% \end{abstract} +% +% +% \newcommand\NOVALUE{\texttt{\string\NoValue}} +% \newcommand\EMPTY{\textit{}} +% \newcommand\STRING{\textit{}} +% \newcommand\TRUE{\texttt{true}} +% \newcommand\FALSE{\texttt{false}} +% \newcommand\KEYVALS{\textit{}} +% \newcommand\HASH[1]{\texttt{\##1}} +% +% \makeatletter +% \renewenvironment{TemplateInterfaceDescription}[1] +% {\subsection{The~object~type~`#1'}% +% \begingroup +% \@beginparpenalty\@M +% \description +% \def\TemplateArgument##1##2{\item[Arg:~##1 (##2)]}^^A +% \def\TemplateSemantics{\enddescription\endgroup +% \subsubsection*{Semantics:}}^^A +% } +% {\par\bigskip} +% \makeatother +% +% \section{Introduction} +% +% +% \section{Interfaces} +% +% \begin{TemplateInterfaceDescription}{heading} +% +% +% \TemplateArgument{1}{boolean} +% If \TRUE{} generate an unnumbered heading, otherwise a number is +% generated up to a certain heading level. If \TRUE{} TOC entries and +% running headers are suppressed unless explicitly forced by other +% arguments below. +% +% \TemplateArgument{2} +% {\STRING/\NOVALUE/\EMPTY} +% Specifies an alternate heading text for the TOC if one is produced. If +% \NOVALUE{} or \EMPTY{} the TOC receives the the main title text. +% +% \TemplateArgument{3} +% {boolean} +% If \TRUE{} a TOC entry is forced (i.e., generated even if normally supressed). +% +% \TemplateArgument{4} +% {\STRING/\NOVALUE/\EMPTY} +% Specifies an alternate heading text for the running header if one is +% produced. If \NOVALUE{} or \EMPTY{} the running header receives the the +% main title text. +% +% \TemplateArgument{5} +% {boolean} +% If \TRUE{} a running header is forced (i.e., generated even if normally +% supressed). +% +% \TemplateArgument{6} +% {\STRING} +% The title of the heading in the document. Also used for the TOC entry and +% running header (if produced) unless overwritten by other arguments. +% +% \TemplateArgument{7} +% {\KEYVALS} +% Extension argument to receive less use key value pairs to manipulate the +% heading. Exact syntax and semantics still need to be defined. +% +% \TemplateSemantics +% This template type defines the basic interface for headings both display +% headings as well as run-in headings. +% +% A TOC entry is generated if \HASH{1} is \FALSE{} or \HASH{3} being +% \TRUE{}. The heading title for the TOC entry is \HASH{6} unless +% overwritten by a non-empty HASH{2}. Whether or not this TOC entry +% actually appears in the TOC depends on settings for the TOC +% generation. (However, if not generated if will obviously not appear.) +% +% A running header is generated if \HASH{1} is \FALSE{} or \HASH{5} or +% \TRUE{}. The heading title for the determined as follows: if \HASH{4} is +% non-empty it will be used, otherwise if \HASH{2} is non-empty it will be +% used, otherwise HASH{6} will be used. +% +% \HASH{7} will hold additional key/value pairs that define more specific +% semantics. This isn't implemented yet. +% +% The above describes my current thinking about how those arguments should +% interact. In simpler templates (based on 2e semantics) the arguments +% \HASH{3} to \HASH{5} and \HASH{7} will get ignored. +% +% +% \end{TemplateInterfaceDescription} +% +% +% \begin{TemplateDescription}{heading}{2e-vertical} +% +% +% \TemplateKey{name}{tokenlist} +% {Name of the heading. Used to refer to parts of its data structure, +% e.g., the counter associated with the heading will have this name. Must +% be set to a suitable string like ``section''} +% {none} +% +% \TemplateKey{level}{integer} +% {The level of the heading in the hierarchy. Required.} +% {none} +% +% \TemplateKey{break-penalty}{penalty} +% {Penlty to break in front of the heading unless it is immediately +% preceeded a higher-level heading in which case breaking is prohibited.} +% {-300} +% +% \TemplateKey{indent}{length} +% {Indentation of the heading from the left margin.} +% {0pt} +% +% \TemplateKey{above-skip}{skip} +% {Vertical space above the heading.} +% {0pt} +% +% \TemplateKey{below-skip}{skip} +% {Vertical space below the heading.} +% {0pt} +% +% \TemplateKey{title-decl}{function 0} +% {Declarations to format the heading, e.g., font changes.} +% {\EMPTY} +% +% \TemplateKey{number-format}{function 1} +% {Formatting instruction for the heading number (if present), receiving +% the heading counter representation as an argument.} +% {\cs{xhead_default_number_format:n}} +% +% \TemplateKey{indent-after}{boolean} +% {Should the first paragraph after the heading be indented?} +% {\FALSE} +% +% \TemplateSemantics +% +% This is, or should be, a reimplementation of the 2e |\@startsection| +% command for generating vertical headings. |\@startsection| is also able +% to produce run-in headings, but this is not covered by the current +% template. +% +% \end{TemplateDescription} +% +% +% +% +% +% \StopEventually{} +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +\RequirePackage{expl3,xtemplate} +% \end{macrocode} +% +% \begin{macrocode} +\GetIdInfo$Id: xhead.dtx 1771 2010-02-05 20:51:22Z frank $ + {heading module} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +% \end{macrocode} +% +% +% \subsection{The heading object type} +% +% Arguments: +%\begin{verbatim} +% #1 (boolean) : produce no number +% #2 (string/\NoValue/empty) : toc-title if different from title +% #3 (boolean) : force toc entry +% #4 (string/\NoValue/empty) : mark-title if different from toc-title +% #5 (Boolean) : force mark entry +% #6 (string) : title +% #7 (extra key vals) +%\end{verbatim} +% +% \begin{macrocode} +\DeclareObjectType {heading} {7} +% \end{macrocode} +% +% +% \subsection{Interfaces to other components} +% +% This section holds code that is (or should be) common between different +% heading templates, for example, code for passing a title to the TOC system +% will always use the same TOC interface so it is encapsulated +% here. Effectively this means that this section should be the only part that +% needs modification if we update these other components and intorduce new +% interfaces for them. +% +% At the moment everything is set up to use the old 2e interfaces, but this +% will change over time. +% +% +% +% \subsubsection{Generating TOC and mark entries} +% +% +% \begin{macro}{\xhead_generate_toc:NNNNN} +% \begin{macro}{\xhead_generate_toc:NNNNo} +% This command provides the interface to the TOC system (currently the 2e +% one). It uses its first two arguments to decide if a TOC entry should be produced +% and if so generates the entry from the remaining arguments. +% +% Arguments: +%\begin{verbatim} +% #1 (boolean) : produce no number +% #2 (boolean) : force toc entry +% #3 (string) : heading name (\l_xhead_name_tl) +% #4 (string) : heading number if any (\l_xhead_number_tl) +% #5 (string) : toc-title (\l_xhead_toc_title_tl) +%\end{verbatim} +% +% \begin{macrocode} +\cs_new:Npn \xhead_generate_toc:NNNNN #1#2#3#4#5 { +%<*trace> + \typeout{xhead_generate_toc:NNNNN=#1:#2:#3:#4:#5} +% +% \end{macrocode} +% A TOC entry is produced if the heading number was not suppressed (|!#1|) +% or it is forced (|#2|). +% \begin{macrocode} + \bool_if:nT + { #2 || ! #1 } + { + \group_begin: +% \end{macrocode} +% Guard against use of mark commands in the heading title (from old sources). +% \begin{macrocode} + \cs_set_eq:NN \@mkboth \use_none:nn + \cs_set_eq:NN \markboth \use_none:nn + \cs_set_eq:NN \markright \use_none:n +% \end{macrocode} +% Use the old 2e |\addcontentsline| interface: +% \begin{macrocode} + \addcontentsline{toc}{#3} + { + \tl_if_empty:NF #4 + { \protect\numberline{ #4 } } + #5 + } + \group_end: + } +} +% \end{macrocode} +% In the templates we really want to make sure that the title in the last +% argument is passed and not a tokenlist in which it is saved. After all, +% this text will get passed around over long distances. We therefore +% provide the following variant for use in templates: +% \begin{macrocode} +\cs_generate_variant:Nn \xhead_generate_toc:NNNNN {NNNNo} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% +% \begin{macro}{\xhead_generate_mark:NNNNN} +% \begin{macro}{\xhead_generate_mark:NNNNo} +% This command provides the interface to the mark system for running +% headers(currently the 2e one). It uses its first two arguments to decide +% if a mark entry should be produced and if so generates the entry from the +% remaining arguments. +% +% Arguments: +%\begin{verbatim} +% #1 (boolean) : produce no number +% #2 (boolean) : force running header entry +% #3 (string) : heading name (\l_xhead_name_tl) +% #4 (string) : heading number if any (\l_xhead_number_tl) +% #5 (string) : mark-title (\l_xhead_mark_title_tl) +%\end{verbatim} +% +% \begin{macrocode} +\cs_new:Npn \xhead_generate_mark:NNNNN #1#2#3#4#5 { +%<*trace> + \typeout{xhead_generate_mark:NNNNN=#1:#2:#3:#4:#5} +% +% \end{macrocode} +% A running header entry is produced if the heading number was not +% suppressed (|!#1|) or it is forced (|#2|). +% \begin{macrocode} + \bool_if:nT + { #2 || ! #1 } + { + \group_begin: +% \end{macrocode} +% Guard against use of mark command in heading titles (from old +% sources)\footnote{This is wrong here, needs thought.} +% \begin{macrocode} + \cs_set_eq:NN \@mkboth \use_none:nn +% \end{macrocode} +% Again we use the original 2e interface. |\markright|, etc.\ currently adds +% the section number so we do not add it here---for now. +% \begin{macrocode} + \use:c {#3 mark} {#5} + \group_end: + } +} +% \end{macrocode} +% In the templates we really want to make sure that the title in the last +% argument is passed and not a tokenlist in which it is saved. After all, +% this text will get passed around over long distances. We therefore +% provide the following variant for use in templates: +% \begin{macrocode} +\cs_generate_variant:Nn \xhead_generate_mark:NNNNN {NNNNo} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% +% +% \begin{macro}{\xhead_generate_toc_and_mark:NNNNNNN} +% +% This is just putting it all together, may not be worth having. +% +% Arguments: +%\begin{verbatim} +% #1 (boolean) : produce no number +% #2 (boolean) : force toc entry +% #3 (boolean) : force running header entry +% #4 (string) : heading name (\l_xhead_name_tl) +% #5 (string) : heading number or empty (\l_xhead_number_tl) +% #6 (string) : toc-title (\l_xhead_toc_title_tl) +% #7 (string) : mark-title (\l_xhead_mark_title_tl) +%\end{verbatim} +% +% \begin{macrocode} +\cs_new:Npn \xhead_generate_toc_and_mark:NNNNNNN #1#2#3#4#5#6#7 { + \xhead_generate_toc:NNNNo + #1 #2 #4 #5 #6 + \xhead_generate_mark:NNNNo + #1 #3 #4 #5 #7 +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsubsection{Prepare heading number} +% +% +% +% \begin{macro}{\xhead_update_prepare_number:N} +% +% This command checks if a number should be produced and if so increments +% the corresponding counter and stores the number in +% |\l_xhead_number_tl|. Otherwise |\l_xhead_number_tl| will be set to empty +% to indicate that no number should be displayed. +% +% Arguments: +%\begin{verbatim} +% #1 (boolean) : produce no number +%\end{verbatim} + +% Assumptions: +%\begin{verbatim} +% \l_xhead_name_tl : holds heading name +% \l_xhead_level_int : holds heading level +%\end{verbatim} +% +% Outputs: +%\begin{verbatim} +% \l_xhead_number_tl : holds heading number or returns empty +%\end{verbatim} +% +% \begin{macrocode} +\cs_new:Npn \xhead_update_prepare_number:N #1 { + \bool_if:nTF + { #1 || \intexpr_compare_p:n { \l_xhead_level_int > \c@secnumdepth } } + { \tl_clear:N \l_xhead_number_tl } + { + \refstepcounter \l_xhead_name_tl + \tl_set:Nx \l_xhead_number_tl { \use:c {the \l_xhead_name_tl} } + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsubsection{Prepare indentation after heading} +% +% To set the paragraph indentation after a heading we need to interact with +% the galley mechanism, which at one point will be \texttt{xgalley}. Right +% now we use the 2e interface. +% +% \begin{macro}{\xhead_set_after_indention:N} +% Here we set the 2e flag depending +% \begin{macrocode} +\cs_new:Npn \xhead_set_after_indention:N #1 { + \bool_if:NTF #1 \@afterindenttrue \@afterindentfalse +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% +% \subsubsection{Evaluating the title arguments} +% +% According to the heading object type spec the title text for the toc and +% running header may differ from the main title in dependence of the +% arguments passed to the template. +% The code below implements the documented logic. +% +% \begin{macro}{\xhead_set_titles:nnn} +% +% Arguments: +%\begin{verbatim} +% #1 (string/\NoValue/empty) : toc-title if different from title +% #2 (string/\NoValue/empty) : mark-title if different from toc-title +% #3 (string) : title +%\end{verbatim} +% +% \begin{macrocode} +\cs_new:Npn \xhead_set_titles:nnn #1#2#3 { +% \end{macrocode} +% Determine title for toc: +% If \HASH{1} is \NOVALUE{} or \EMPTY{} use \HASH{3} for the toc-title. +% Otherwise use \HASH{1}. +% \begin{macrocode} + \IfNoValueTF{#1} + { \tl_set:Nn \l_xhead_toc_title_tl {#3} } + { \tl_if_empty:nTF {#1} + { \tl_set:Nn \l_xhead_toc_title_tl {#3} } + { \tl_set:Nn \l_xhead_toc_title_tl {#1} } + } +% \end{macrocode} +% Determine title for mark: If \HASH{2} is \NOVALUE{} then use whatever was +% determined for the toc-title as value (i.e., if a special toc-title was +% used this will be also used for the running header, if not the main title +% is used). Otherwise, if \HASH{2} is \EMPTY{} use \HASH{3}. Otherwise use +% \HASH{2} (i.e., a special title was passed for the running header). +% \begin{macrocode} + \IfNoValueTF{#2} + { \tl_set_eq:NN \l_xhead_mark_title_tl \l_xhead_toc_title_tl } + { \tl_if_empty:nTF {#2} + { \tl_set:Nn \l_xhead_mark_title_tl {#3} } + { \tl_set:Nn \l_xhead_mark_title_tl {#2} } + } +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \subsection{Support variables for template code} +% +% +% \begin{macrocode} +\dim_new:N \l_xhead_indent_dim +% \end{macrocode} +% +% +% +% \begin{macrocode} +\skip_new:N \l_xhead_above_skip +\skip_new:N \l_xhead_below_skip +% \end{macrocode} +% +% +% +% \begin{macrocode} +\int_new:N \l_xhead_level_int +\int_new:N \l_xhead_break_penalty_int +% \end{macrocode} +% +% \begin{macrocode} +\tl_new:N \l_xhead_name_tl +\tl_new:N \l_xhead_number_tl +\tl_new:N \l_xhead_toc_title_tl +\tl_new:N \l_xhead_mark_title_tl +% \end{macrocode} +% +% \begin{macrocode} +\bool_new:N \l_xhead_indent_after_bool + +\cs_new:Npn \xhead_title_decl: {} + +\cs_new:Npn \xhead_number_format:n #1 {} + +\cs_new:Npn \xhead_default_number_format:n #1 { #1 \quad} +% \end{macrocode} +% +% +% +% +% \subsection{The template \texttt{2e-vertical}} +% +% \begin{macrocode} +\DeclareTemplateInterface {heading} {2e-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty: integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + title-decl : function {0} = , + number-format: function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } +% \end{macrocode} +% +% \begin{macrocode} +\DeclareTemplateCode {heading} {2e-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + title-decl = \xhead_title_decl: , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys +% \end{macrocode} +% Determine title for toc and mark using the 2e logic: Do not generate +% them if the star-form of the heading is used and always use the same text +% for TOC and mark: +% \begin{macrocode} + \bool_if:NF #1 + { + \IfNoValueTF{#2} + { \tl_set:Nn \l_xhead_toc_title_tl {#6} } + { \tl_set:Nn \l_xhead_toc_title_tl {#2} } + \tl_set_eq:NN \l_xhead_mark_title_tl \l_xhead_toc_title_tl + } +% \end{macrocode} +% If heading number increment counter and set |\l_xhead_number_tl| +% \begin{macrocode} + \xhead_update_prepare_number:N #1 +% \end{macrocode} +% Indent after heading if requested (use old mechanism): +% \begin{macrocode} + \xhead_set_after_indention:N \l_xhead_indent_after_bool +% \end{macrocode} +% Produce the space above the heading (using old 2e methods): +% \begin{macrocode} + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: +% \end{macrocode} +% Produce the title of the heading (using old 2e methods) +% \begin{macrocode} + \group_begin: + \xhead_title_decl: + { + \@hangfrom{\hskip \l_xhead_indent_dim \scan_stop: + \tl_if_empty:NF \l_xhead_number_tl + { \xhead_number_format:n \l_xhead_number_tl } + } + \interlinepenalty \@M #6\@@par + } + \group_end: +% \end{macrocode} +% Generate toc entry and mark if required: +% \begin{macrocode} + \xhead_generate_toc_and_mark:NNNNNNN + #1 \BooleanFalse \BooleanFalse % no forcing in 2e + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl +% \end{macrocode} +% Produce the space below the heading and the handling of following +% paragraph (using old 2e methods): +% \begin{macrocode} + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } +% \end{macrocode} +% +% +% +% +% \subsection{The template \texttt{3a-vertical}} +% +% Right now this template is more or less equal to \texttt{2e-vertical} +% except that it supports the extended heading arguments with the exception +% of \HASH{7}. +% +% \begin{macrocode} +\DeclareTemplateInterface {heading} {3a-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty : integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + format : tokenlist = indent-by-number , + parshape : instance {parshape} = plain , + justification : instance {justification} = flush-left , + font : tokenlist = , + number-format : function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } +% \end{macrocode} +% + +% \begin{macro}{\l_xhead_title_format_tl} +% +% \begin{macrocode} +\tl_new:N \l_xhead_title_format_tl +\tl_new:N \l_xhead_title_font_tl + +\cs_new:Npn \xhead_title_parshape: {} +\cs_new:Npn \xhead_title_justification: {} + +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} +\DeclareTemplateCode {heading} {3a-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + format = \l_xhead_title_format_tl , + parshape = \xhead_title_parshape: , + justification = \xhead_title_justification: , + font = \l_xhead_title_font_tl , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys +% \end{macrocode} +% Set title text for TOC and mark entry: +% \begin{macrocode} + \xhead_set_titles:nnn {#2} {#4} {#6} +% \end{macrocode} +% If heading gets a number, increment counter and set +% |\l_xhead_number_tl|. +% \begin{macrocode} + \xhead_update_prepare_number:N #1 +% \end{macrocode} +% Indent after heading if requested (use old mechanism) +% \begin{macrocode} + \xhead_set_after_indention:N \l_xhead_indent_after_bool +% \end{macrocode} +% +% Produce the space above the heading (using old 2e methods) +% +% \begin{macrocode} + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: +% \end{macrocode} +% +% Produce the title of the heading +% +% \begin{macrocode} + \xhead_use_title_format:nn \l_xhead_title_format_tl {#6} + +% \end{macrocode} +% Generate toc entry and mark: +% \begin{macrocode} + \xhead_generate_toc_and_mark:NNNNNNN + #1 #3 #5 + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl +% \end{macrocode} +% Produce the space below the heading and the handling of following +% paragraph (using old 2e methods) +% \begin{macrocode} + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } +% \end{macrocode} +% +% +% +% \begin{macro}{\xhead_use_title_format:nn} +% Select a formatting command (based on first arg string) and use it to +% format the title (second arg). +% +% The formatting command makes a bunch of +% assumptions with respect to the variable names used by the templates (it +% might ignore some of them): +%\begin{verbatim} +% \l_xhead_title_font_tl : font declarations for title text +% \l_xhead_indent_dim : indentation from the left of title +% \xhead_title_parshape: : parshape instance to use for title +% \xhead_title_justification: : justification instance to use for title +% \l_xhead_number_tl : raw title number or empty +% \xhead_number_format:n : formatting command for title number +%\end{verbatim} +% In addition it takes a single mandatory argument holding the title text. +% +% \begin{macrocode} +\cs_new:Npn \xhead_use_title_format:nn #1 { + \cs_if_exist:cTF {xhead_format_ #1:n} + { \use:c{xhead_format_ #1:n} } + { \ERROR xhead format not defined } +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\xhead_format_indent-by-number:n} +% Implementing vertical version of |\@startsection| \ldots +% \begin{macrocode} +\cs_new:cpn {xhead_format_indent-by-number:n} #1 { + \group_begin: + \l_xhead_title_font_tl + \hbox_set:Nn \l_tmpa_box + { + \tl_if_empty:NF \l_xhead_number_tl + { \xhead_number_format:n \l_xhead_number_tl } + } + + \UseInstance{measure}{fullwidth} + {\l_xhead_indent_dim + \box_wd:N \l_tmpa_box } + + \xhead_title_parshape: + \xhead_title_justification: + \interlinepenalty \@M + + \noindent \hbox_overlap_left:n { \box_use:N \l_tmpa_box } + #1\@@par + \group_end: +} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \begin{macro}{\xhead_format_number-above-text:n} +% +% \begin{macrocode} +\cs_new:cpn {xhead_format_number-above-text:n} #1 { + \group_begin: + \l_xhead_title_font_tl + \xhead_title_parshape: + \xhead_title_justification: + \interlinepenalty \@M + + \tl_if_empty:NF \l_xhead_number_tl + { + \xhead_number_format:n \l_xhead_number_tl + } + + #1\@@par + \group_end: +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macrocode} + +\input{xtextblock.sty} + + +\DeclareTemplateInterface {heading} {3b-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty : integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + title-format : instance {textblock-2} = heading , + number-format : function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } + +\cs_new:Npn \xhead_title_format:nn #1#2 {} + +\DeclareTemplateCode {heading} {3b-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + title-format = \xhead_title_format:nn , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys + + \xhead_set_titles:nnn {#2} {#4} {#6} + + \xhead_update_prepare_number:N #1 + + \xhead_set_after_indention:N \l_xhead_indent_after_bool + + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: + + \xhead_title_format:nn \l_xhead_number_tl {#6} + + \xhead_generate_toc_and_mark:NNNNNNN + #1 #3 #5 + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl + + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } + + +% \end{macrocode} +% +% \Finale +% +% +% \begin{macrocode} +\endinput +% +% \end{macrocode} +% +% \endinput +% +% +% +% +% \begin{TemplateInterfaceDescription}{} +% +% \TemplateArgument{1} +% {} +% +% \TemplateSemantics +% +% \end{TemplateInterfaceDescription} +% +% + + + - motto/quote text to display alongside the heading title + - flag to number heading + -label name for cross-reference + +% +% \begin{InstanceDescription}[\textbf{no-page-break-boolean}xx] +% {pshape}{staggered}{cutout} +% +% \InstanceKey{no-page-break-boolean}{true} +% +% \InstanceKey{left-side-boolean}{true} +% +% \InstanceKey{normal-lines-int}{1} +% +% \InstanceKey{parshape-list}{20pt,40pt,60pt} +% +% \InstanceSemantics +% This instance will indent each line by an additional 20pt (up to +% the fourth line). A possible application would be a heading text +% (with a maximum number of four lines). +% This should then perhaps be combined with a special justification +% instance which does ragged right except for the last line which is +% set to full measure. +% +% \end{InstanceDescription} +% +% + diff --git a/Master/texmf-dist/source/latex/xpackages/xhead/xhead.ins b/Master/texmf-dist/source/latex/xpackages/xhead/xhead.ins new file mode 100644 index 00000000000..7d4286021a7 --- /dev/null +++ b/Master/texmf-dist/source/latex/xpackages/xhead/xhead.ins @@ -0,0 +1,73 @@ +% \iffalse +%% +%% This file will generate fast loadable files and documentation +%% driver files from the dtx files in this package when run through +%% LaTeX or TeX. +%% +%% (C) Copyright 2009-2010 LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xhead bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +%% $Id: xhead.ins 1628 2009-10-25 09:54:34Z mittelba $ +%% +% \fi +% + +\input docstrip +\keepsilent +\askforoverwritefalse + +\preamble + +(C) Copyright The LaTeX3 Project and any individual authors +listed elsewhere in this file. + +This is a generated file. + +This file was generated from file(s) of the xhead bundle. +----------------------------------------------------------- + +This file may only be distributed together with a copy of this bundle. +You may however distribute the bundle without such generated files. + +====================================================================== + +\endpreamble + + +\generate{% + \file{xhead.sty}{\from{xhead.dtx}{package,trace}} +% \file{xhead-sample.tex}{\from{xhead.dtx}{sample}} +} + +\endbatchfile + diff --git a/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex b/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex deleted file mode 100644 index a00531e0741..00000000000 --- a/Master/texmf-dist/source/latex/xpackages/xtras/l3keys2e-demo.tex +++ /dev/null @@ -1,46 +0,0 @@ -% !TEX encoding = ISO-8859-1 -% !TEX program = pdflatex -% -% This file demonstrates the use of the l3keys2e module to allow -% LaTeX3 keyvals (created using l3keys) to be used as LaTeX2e -% package or class options. -% - -% First, create a class -\begin{filecontents}{l3keys2e-class.cls} - \LoadClass{article} - \RequirePackage{l3keys2e} - \ProvidesExplClass{l3keys2e-class}{0000/00/00}{0.0}{test} - \keys_define:nn { test1 } { - option1 .code:n = {\wlog{You~gave~`#1'~for~option1}} - } - \ProcessKeysOptions { test1 } -\end{filecontents} - -% Load the class with some options. -% The class itself recognises `option1', leaving `option2' and -% `option3' as global optons which are not yet used. -\documentclass[option1=check,option2=more stuff,option3=unused] - {l3keys2e-class} - -%Now create a package -\begin{filecontents}{l3keys2e-package.sty} - \RequirePackage{l3keys2e} - \ProvidesExplPackage{l3keys2e-package}{0000/00/00}{0.0}{test} - \keys_define:nn { test2 } { - option1 .code:n = {\wlog{You~gave~`#1'~for~option1~(again)}}, - option2 .code:n = {\wlog{You~gave~`#1'~for~option2}}, - option4 .code:n = {\wlog{You~gave~`#1'~for~option4}}, - } - \ProcessKeysOptions { test2 } -\end{filecontents} - -% Load the package. -\usepackage[option4={extra stuff},option5=undefined!] - {l3keys2e-package} - -\begin{document} -% The log should show that option3 is an unused global option, and that -% option5 is not known by the l3keys2e-demo package. Everything else -% should simply be listed in the log. -\end{document} diff --git a/Master/texmf-dist/tex/latex/xpackages/xbase/xparse.sty b/Master/texmf-dist/tex/latex/xpackages/xbase/xparse.sty index a5204eeef15..18e704e88cd 100644 --- a/Master/texmf-dist/tex/latex/xpackages/xbase/xparse.sty +++ b/Master/texmf-dist/tex/latex/xpackages/xbase/xparse.sty @@ -57,7 +57,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: xparse.dtx 1876 2010-03-27 07:20:51Z joseph $ +\GetIdInfo$Id: xparse.dtx 1897 2010-04-26 05:56:56Z joseph $ {Generic document command parser} \ProvidesExplPackage {\filename}{\filedate}{\fileversion}{\filedescription} @@ -654,16 +654,60 @@ \tl_to_str:n {#1} } } -\cs_new:Npn \xparse_process_comma_split:n #1 { - \tl_if_in:nnTF {#1} { , } { - \xparse_process_comma_split_aux:w #1 \q_stop - }{ - \tl_set:Nn \ProcessedArgument { {#1} { \NoValue } } - } -} -\cs_new:Npn \xparse_process_comma_split_aux:w #1 , #2 \q_stop { - \tl_set:Nn \ProcessedArgument { {#1} {#2} } +\cs_new_protected:Npn \_xparse_bool_reverse:N #1 { + \bool_if:NTF #1 + { \tl_set:Nn \ProcessedArgument { \c_false_bool } } + { \tl_set:Nn \ProcessedArgument { \c_true_bool } } } +\tl_new:N \_l_xparse_split_argument_tl +\group_begin: + \char_make_active:N \@ + \cs_gset_protected:Npn \_xparse_split_argument:nnn #1#2#3 + { + \tl_set:Nn \_l_xparse_split_argument_tl {#3} + \group_begin: + \char_set_lccode:nn { `\@ } { `#2} + \tl_to_lowercase:n + { + \group_end: + \tl_replace_all_in:Nnn \_l_xparse_split_argument_tl { @ } {#2} + } + \cs_set_protected:Npn \_xparse_split_argument_aux_i:w + ##1 \q_nil ##2 #2 ##3 \q_stop + { + \tl_put_right:Nn \ProcessedArgument { {##2} } + ##1 \q_nil ##3 \q_stop + } + \cs_set_protected:Npn \_xparse_split_argument_aux_iii:w + ##1 #2 ##2 \q_stop + { + \IfNoValueF {##1} + { + \msg_kernel_error:nnxxx { xparse } { split-excess-tokens } + { \exp_not:n {#2} } {#1} { \exp_not:n {#3} } + } + } + \tl_set:Nx \_l_xparse_tmp_tl + { + \prg_replicate:nn { #1 + 1 } + { \_xparse_split_argument_aux_i:w } + \_xparse_split_argument_aux_ii:w + \exp_not:N \q_nil + \exp_not:V \_l_xparse_split_argument_tl + \prg_replicate:nn {#1} { \exp_not:n {#2} \NoValue } + \exp_not:n { #2 \q_stop } + } + \_l_xparse_tmp_tl + } +\group_end: +\cs_set_protected:Npn \_xparse_split_argument_aux_i:w { } +\cs_set_protected:Npn \_xparse_split_argument_aux_ii:w + #1 \q_nil #2 \q_stop + { + \tl_if_empty:nF {#2} + { \_xparse_split_argument_aux_iii:w #2 \q_stop } + } +\cs_set_protected:Npn \_xparse_split_argument_aux_iii:w { } \cs_new:Npn \xparse_exp_add_type_d:w #1#2 { \xparse_exp_add_type_D:w #1 #2 { \NoValue } } @@ -938,6 +982,13 @@ Argument~specification~'#1'~contains~a~processor~function:\\ this~is~only~supported~for~standard~robust~functions. } +\msg_kernel_set:nnnn { xparse } { split-excess-tokens } + { Too~many~'#1'~tokens~when~trying~to~split~argument. } + { + LaTeX~was~asked~to~split~the~input~'#3'\\ + at~each~occurrence~of~the~token~'#1',~up~to~a~maximum~of~#2~tokens.\\ + There~were~too~many~'#1'~tokens. + } \msg_kernel_new:nnnn { xparse } { unknown-argument-type } { Unknown~argument~type~'#1'~replaced~by~'m'.~Fingers~crossed~... } { @@ -1036,6 +1087,8 @@ } \cs_new_protected:Npn \NoValue { -NoValue- } \cs_new:Npn \ProcessedArgument { } +\cs_new_eq:NN \ReverseBoolean \_xparse_bool_reverse:N +\cs_new_eq:NN \SplitArgument \_xparse_split_argument:nnn \endinput %% %% End of file `xparse.sty'. diff --git a/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty b/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty index b2dbada94c7..6ff224fff23 100644 --- a/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/xpackages/xbase/xtemplate.sty @@ -54,7 +54,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3names} -\GetIdInfo$Id: xtemplate.dtx 1879 2010-03-29 17:48:38Z mittelba $ +\GetIdInfo$Id: xtemplate.dtx 1896 2010-04-14 17:40:38Z joseph $ {Prototype document functions} @@ -332,7 +332,7 @@ \cs_new:Npn \xtemplate_split_keytype:n #1 { \bool_set_false:N \l_xtemplate_error_bool \tl_set:Nn \l_xtemplate_tmp_tl {#1} - \tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { ~ } { } + \tl_remove_all_in:Nn \l_xtemplate_tmp_tl { ~ } \tl_replace_all_in:Nnn \l_xtemplate_tmp_tl { : } { @ } \tl_if_in:VnTF \l_xtemplate_tmp_tl { @ } { \exp_after:wN \xtemplate_split_keytype_aux:w \l_xtemplate_tmp_tl @@ -802,9 +802,9 @@ } \cs_new_nopar:Npn \xtemplate_assign_code: { \tl_put_left:Nx \l_xtemplate_assignments_tl { - \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n ##1 { - \exp_not:V \l_xtemplate_var_tl - } + \exp_not:N \cs_set:Npn \exp_not:N \xtemplate_assign_code:n + \exp_not:n {##1} + { \exp_not:V \l_xtemplate_var_tl } \exp_not:N \xtemplate_assign_code:n { \exp_not:V \l_xtemplate_value_tl } } @@ -986,7 +986,7 @@ } } \msg_kernel_new:nnnn { xtemplate } { argument-number-mismatch } - { Object~type~'#1'~takes~'#2' ~not~'#3'~argument(s). } + { Object~type~'#1'~takes~'#2'~not~'#3'~argument(s). } { Objects~of~type~'#1'~require~'#2'~arguments.\\ You~have~tried~to~make~a~template~for~'#1'\\ @@ -1020,7 +1020,7 @@ { The~choice~'unknown'~cannot~be~given~for~a~template~key.} { The~'unknown'~choice~is~automatically~checked~by~template~when \\ - a~choice~key~is~given with~an~unknown~value.~It~should~not~be \\ + a~choice~key~is~given~with~an~unknown~value.~It~should~not~be \\ included~in~the~list~of~named~choices~for~a~key,~and~is~always \\ given~last~in~the~implementation~of~choices. } @@ -1047,24 +1047,23 @@ \msg_kernel_new:nnnn { xtemplate } { key-no-variable } { The~key~'#1'~requires~implementation~details~\msg_line_context:. } { - When~creating~template~code~using~ - \token_to_str:N \DeclareTemplateCode,\\ + When~creating~template~code~using~\DeclareTemplateCode,\\ each~key~name~must~have~an~associated~implementation.\\ This~should~be~given~after~a~'='~sign:~I~did~not~find~one. } \msg_kernel_new:nnnn { xtemplate } { key-not-implemented } { Key~'#1'~has~no~implementation~\msg_line_context:. } { - The~definition~of key implementations~for~template~'#2'\\ + The~definition~of~key~implementations~for~template~'#2'\\ of~object~type~'#3'~does not~include~any~details~for~key~'#1'.\\ - The~key was declared~in~the~interface definition,\\ + The~key~was~declared~in~the~interface~definition,\\ and~so~an~implementation~is~required. } \msg_kernel_new:nnnn { xtemplate } { keytype-requires-argument } { The~keytype~'#1'~requires~an~argument~\msg_line_context:. } { You~should~have~put:\\ - \c_space_tl \c_space_tl ~:~#1 + \c_space_tl \c_space_tl ~:~#1~ \token_to_str:N {~~\token_to_str:N } \\ but~I~did~not~find~an~. } @@ -1081,21 +1080,17 @@ or~has~no~implementation. } { - You~need~to~declare~a~templat~with - \token_to_str:N \DeclareTemplateInterface \\ - and~its~code~with - \token_to_str:N \DeclareTemplateCode \c_space_tl - prior~to~using~it. + You~need~to~declare~a~template~with~\DeclareTemplateInterface \\ + and~its~code~with~\DeclareTemplateCode prior~to~using~it. } \msg_kernel_new:nnnn { xtemplate } { type-mismatch } { Object~types~'#1'~and~'#2'~do~not~agree. } { - You~are~trying~to~use~a~template~directly~with - \token_to_str:N \UseInstance \\ + You~are~trying~to~use~a~template~directly~with~\UseInstance \\ (or~a~similar~function),~but~the~object~types~do~not~match. } \msg_kernel_new:nnnn { xtemplate } { undeclared-variable } - {The~variable~#1~has~not~been~declared. } + { The~variable~#1~has~not~been~declared. } { Before~declaring~an~instance,~all~of~the~required~variables\\ used~in~template~keys~must~be~created. @@ -1111,13 +1106,13 @@ \msg_kernel_new:nnnn { xtemplate } { unknown-choice } { The~choice~'#1'~was~not~declared~for~key~'#2'~\msg_line_context:. } { - The~key '#2'~takes~a~fixed~number~of~choices:\\ + The~key~'#2'~takes~a~fixed~number~of~choices:\\ \clist_map_function:NN #3 \xtemplate_unknown_choice_aux:n and~this~list~does~not~include~'#1'. } \cs_new:Npn \xtemplate_unknown_choice_aux:n #1 { -~ #1 ;\\} \msg_kernel_new:nnnn { xtemplate } { unknown-keytype } - { The~keytype '#1'~is~unknown~\msg_line_context:. } + { The~keytype~'#1'~is~unknown~\msg_line_context:. } { Valid~keytypes~are:\\ -~boolean;\\ @@ -1132,11 +1127,10 @@ -~tokenlist. } \msg_kernel_new:nnnn { xtemplate } { unknown-object-type } - { The ~object~type~'#1'~is~unknown~\msg_line_context:. } + { The~object~type~'#1'~is~unknown~\msg_line_context:. } { - An~object~type~needs~to~be~declared~with - \token_to_str:N \DeclareObjectType \c_space_tl - prior~to~using~it. + An~object~type~needs~to~be~declared~with~ + \DeclareObjectType prior~to~using~it. } \msg_kernel_new:nnnn { xtemplate } { unknown-instance } { The~instance~'#2'~of~type~'#1'~is~unknown. } diff --git a/Master/texmf-dist/tex/latex/xpackages/xhead/xhead.sty b/Master/texmf-dist/tex/latex/xpackages/xhead/xhead.sty new file mode 100644 index 00000000000..1e80bf977d2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/xpackages/xhead/xhead.sty @@ -0,0 +1,376 @@ +%% +%% This is file `xhead.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xhead.dtx (with options: `package,trace') +%% +%% (C) Copyright The LaTeX3 Project and any individual authors +%% listed elsewhere in this file. +%% +%% This is a generated file. +%% +%% This file was generated from file(s) of the xhead bundle. +%% ----------------------------------------------------------- +%% +%% This file may only be distributed together with a copy of this bundle. +%% You may however distribute the bundle without such generated files. +%% +%% ====================================================================== +%% +%% File xhead.dtx (C) Copyright 2010 Frank Mittelbach, LaTeX3 Project +%% +%% It may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License (LPPL), either version 1.3c of this +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the ``xhead bundle'' (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\RequirePackage{expl3} +\GetIdInfo$Id: xhead.dtx 1686 2009-11-03 08:19:19Z joseph $ + {Templates heading commands} +\RequirePackage{expl3,xtemplate} +\GetIdInfo$Id: xhead.dtx 1771 2010-02-05 20:51:22Z frank $ + {heading module} +\ProvidesExplPackage + {\filename}{\filedate}{\fileversion}{\filedescription} +\DeclareObjectType {heading} {7} +\cs_new:Npn \xhead_generate_toc:NNNNN #1#2#3#4#5 { + \typeout{xhead_generate_toc:NNNNN=#1:#2:#3:#4:#5} + \bool_if:nT + { #2 || ! #1 } + { + \group_begin: + \cs_set_eq:NN \@mkboth \use_none:nn + \cs_set_eq:NN \markboth \use_none:nn + \cs_set_eq:NN \markright \use_none:n + \addcontentsline{toc}{#3} + { + \tl_if_empty:NF #4 + { \protect\numberline{ #4 } } + #5 + } + \group_end: + } +} +\cs_generate_variant:Nn \xhead_generate_toc:NNNNN {NNNNo} +\cs_new:Npn \xhead_generate_mark:NNNNN #1#2#3#4#5 { + \typeout{xhead_generate_mark:NNNNN=#1:#2:#3:#4:#5} + \bool_if:nT + { #2 || ! #1 } + { + \group_begin: + \cs_set_eq:NN \@mkboth \use_none:nn + \use:c {#3 mark} {#5} + \group_end: + } +} +\cs_generate_variant:Nn \xhead_generate_mark:NNNNN {NNNNo} +\cs_new:Npn \xhead_generate_toc_and_mark:NNNNNNN #1#2#3#4#5#6#7 { + \xhead_generate_toc:NNNNo + #1 #2 #4 #5 #6 + \xhead_generate_mark:NNNNo + #1 #3 #4 #5 #7 +} + +\cs_new:Npn \xhead_update_prepare_number:N #1 { + \bool_if:nTF + { #1 || \intexpr_compare_p:n { \l_xhead_level_int > \c@secnumdepth } } + { \tl_clear:N \l_xhead_number_tl } + { + \refstepcounter \l_xhead_name_tl + \tl_set:Nx \l_xhead_number_tl { \use:c {the \l_xhead_name_tl} } + } +} +\cs_new:Npn \xhead_set_after_indention:N #1 { + \bool_if:NTF #1 \@afterindenttrue \@afterindentfalse +} +\cs_new:Npn \xhead_set_titles:nnn #1#2#3 { + \IfNoValueTF{#1} + { \tl_set:Nn \l_xhead_toc_title_tl {#3} } + { \tl_if_empty:nTF {#1} + { \tl_set:Nn \l_xhead_toc_title_tl {#3} } + { \tl_set:Nn \l_xhead_toc_title_tl {#1} } + } + \IfNoValueTF{#2} + { \tl_set_eq:NN \l_xhead_mark_title_tl \l_xhead_toc_title_tl } + { \tl_if_empty:nTF {#2} + { \tl_set:Nn \l_xhead_mark_title_tl {#3} } + { \tl_set:Nn \l_xhead_mark_title_tl {#2} } + } +} +\dim_new:N \l_xhead_indent_dim +\skip_new:N \l_xhead_above_skip +\skip_new:N \l_xhead_below_skip +\int_new:N \l_xhead_level_int +\int_new:N \l_xhead_break_penalty_int +\tl_new:N \l_xhead_name_tl +\tl_new:N \l_xhead_number_tl +\tl_new:N \l_xhead_toc_title_tl +\tl_new:N \l_xhead_mark_title_tl +\bool_new:N \l_xhead_indent_after_bool + +\cs_new:Npn \xhead_title_decl: {} + +\cs_new:Npn \xhead_number_format:n #1 {} + +\cs_new:Npn \xhead_default_number_format:n #1 { #1 \quad} +\DeclareTemplateInterface {heading} {2e-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty: integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + title-decl : function {0} = , + number-format: function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } +\DeclareTemplateCode {heading} {2e-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + title-decl = \xhead_title_decl: , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys + \bool_if:NF #1 + { + \IfNoValueTF{#2} + { \tl_set:Nn \l_xhead_toc_title_tl {#6} } + { \tl_set:Nn \l_xhead_toc_title_tl {#2} } + \tl_set_eq:NN \l_xhead_mark_title_tl \l_xhead_toc_title_tl + } + \xhead_update_prepare_number:N #1 + \xhead_set_after_indention:N \l_xhead_indent_after_bool + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: + \group_begin: + \xhead_title_decl: + { + \@hangfrom{\hskip \l_xhead_indent_dim \scan_stop: + \tl_if_empty:NF \l_xhead_number_tl + { \xhead_number_format:n \l_xhead_number_tl } + } + \interlinepenalty \@M #6\@@par + } + \group_end: + \xhead_generate_toc_and_mark:NNNNNNN + #1 \BooleanFalse \BooleanFalse % no forcing in 2e + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } +\DeclareTemplateInterface {heading} {3a-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty : integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + format : tokenlist = indent-by-number , + parshape : instance {parshape} = plain , + justification : instance {justification} = flush-left , + font : tokenlist = , + number-format : function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } + +\tl_new:N \l_xhead_title_format_tl +\tl_new:N \l_xhead_title_font_tl + +\cs_new:Npn \xhead_title_parshape: {} +\cs_new:Npn \xhead_title_justification: {} + +\DeclareTemplateCode {heading} {3a-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + format = \l_xhead_title_format_tl , + parshape = \xhead_title_parshape: , + justification = \xhead_title_justification: , + font = \l_xhead_title_font_tl , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys + \xhead_set_titles:nnn {#2} {#4} {#6} + \xhead_update_prepare_number:N #1 + \xhead_set_after_indention:N \l_xhead_indent_after_bool + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: + \xhead_use_title_format:nn \l_xhead_title_format_tl {#6} + + \xhead_generate_toc_and_mark:NNNNNNN + #1 #3 #5 + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } +\cs_new:Npn \xhead_use_title_format:nn #1 { + \cs_if_exist:cTF {xhead_format_ #1:n} + { \use:c{xhead_format_ #1:n} } + { \ERROR xhead format not defined } +} +\cs_new:cpn {xhead_format_indent-by-number:n} #1 { + \group_begin: + \l_xhead_title_font_tl + \hbox_set:Nn \l_tmpa_box + { + \tl_if_empty:NF \l_xhead_number_tl + { \xhead_number_format:n \l_xhead_number_tl } + } + + \UseInstance{measure}{fullwidth} + {\l_xhead_indent_dim + \box_wd:N \l_tmpa_box } + + \xhead_title_parshape: + \xhead_title_justification: + \interlinepenalty \@M + + \noindent \hbox_overlap_left:n { \box_use:N \l_tmpa_box } + #1\@@par + \group_end: +} +\cs_new:cpn {xhead_format_number-above-text:n} #1 { + \group_begin: + \l_xhead_title_font_tl + \xhead_title_parshape: + \xhead_title_justification: + \interlinepenalty \@M + + \tl_if_empty:NF \l_xhead_number_tl + { + \xhead_number_format:n \l_xhead_number_tl + } + + #1\@@par + \group_end: +} + +\input{xtextblock.sty} + +\DeclareTemplateInterface {heading} {3b-vertical} {7} + { + name : tokenlist = ??? , + level : integer = 0 , + break-penalty : integer = -300 , + indent : length = 0pt , + above-skip : skip = 0pt , + below-skip : skip = 0pt , + title-format : instance {textblock-2} = heading , + number-format : function {1} = \xhead_default_number_format:n {#1} , + indent-after : boolean = false , + } + +\cs_new:Npn \xhead_title_format:nn #1#2 {} + +\DeclareTemplateCode {heading} {3b-vertical} {7} + { + name = \l_xhead_name_tl , + level = \l_xhead_level_int , + break-penalty = \l_xhead_break_penalty_int , + indent = \l_xhead_indent_dim , + above-skip = \l_xhead_above_skip , + below-skip = \l_xhead_below_skip , + title-format = \xhead_title_format:nn , + number-format = \xhead_number_format:n , + indent-after = \l_xhead_indent_after_bool , + } + { + \AssignTemplateKeys + + \xhead_set_titles:nnn {#2} {#4} {#6} + + \xhead_update_prepare_number:N #1 + + \xhead_set_after_indention:N \l_xhead_indent_after_bool + + \if@noskipsec \leavevmode \fi + \par + \if@nobreak + \everypar{} + \else: + \addpenalty \l_xhead_break_penalty_int + \addvspace \l_xhead_above_skip + \fi: + + \xhead_title_format:nn \l_xhead_number_tl {#6} + + \xhead_generate_toc_and_mark:NNNNNNN + #1 #3 #5 + \l_xhead_name_tl + \l_xhead_number_tl + \l_xhead_toc_title_tl + \l_xhead_mark_title_tl + + \par \nobreak + \vspace \l_xhead_below_skip + \@afterheading + \ignorespaces + } + +\endinput +%% +%% End of file `xhead.sty'. -- cgit v1.2.3