From 586bef91a24aca48fc2fe6f6d122746585d2baa5 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 22 Jul 2009 22:46:34 +0000 Subject: new latex package ltxnew (22jul09) git-svn-id: svn://tug.org/texlive/trunk@14371 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/ltxnew/README | 33 + Master/texmf-dist/doc/latex/ltxnew/ltxnew.pdf | Bin 0 -> 230084 bytes Master/texmf-dist/source/latex/ltxnew/ltxnew.dtx | 727 +++++++++++++++++++++++ Master/texmf-dist/source/latex/ltxnew/ltxnew.ins | 82 +++ Master/texmf-dist/tex/latex/ltxnew/ltxnew.sty | 189 ++++++ Master/tlpkg/bin/tlpkg-ctan-check | 5 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/ltxnew.tlpsrc | 0 8 files changed, 1035 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/ltxnew/README create mode 100644 Master/texmf-dist/doc/latex/ltxnew/ltxnew.pdf create mode 100644 Master/texmf-dist/source/latex/ltxnew/ltxnew.dtx create mode 100644 Master/texmf-dist/source/latex/ltxnew/ltxnew.ins create mode 100644 Master/texmf-dist/tex/latex/ltxnew/ltxnew.sty create mode 100644 Master/tlpkg/tlpsrc/ltxnew.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/ltxnew/README b/Master/texmf-dist/doc/latex/ltxnew/README new file mode 100644 index 00000000000..85f2f1b5e2e --- /dev/null +++ b/Master/texmf-dist/doc/latex/ltxnew/README @@ -0,0 +1,33 @@ +% ltxnew provides the \new, \renew and \provide prefixes for checking +% definitions. It is designed to work with e-TeX distributions of LaTeX +% and relies on the LaTeX macro \@ifdefinable. +% +% Local allocation of counters, dimensions, skips, muskips, boxes, +% tokens and marks are provided by the etex.sty package. +% +% \new and \renew as well as \provide may be used for all kind of +% control sequences. Please refer to the section "Using \new" of the pdf +% documentation. +% +% ********************************************************************************* +% This work consists of the main source file ltxnew.dtx +% and the derived files +% ltxnew.sty, ltxnew.pdf, ltxnew.ins, +% +% Unpacking: +% (a) If ltxnew.ins is present: +% etex ltxnew.ins +% (b) Without ltxnew.ins: +% etex ltxnew.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{ltxnew.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex ltxnew.dtx +% +% F Chervet - July 2009 + + + + diff --git a/Master/texmf-dist/doc/latex/ltxnew/ltxnew.pdf b/Master/texmf-dist/doc/latex/ltxnew/ltxnew.pdf new file mode 100644 index 00000000000..45fc4b7cafa Binary files /dev/null and b/Master/texmf-dist/doc/latex/ltxnew/ltxnew.pdf differ diff --git a/Master/texmf-dist/source/latex/ltxnew/ltxnew.dtx b/Master/texmf-dist/source/latex/ltxnew/ltxnew.dtx new file mode 100644 index 00000000000..3c6390dfc54 --- /dev/null +++ b/Master/texmf-dist/source/latex/ltxnew/ltxnew.dtx @@ -0,0 +1,727 @@ +% \iffalse meta-comment +% ltxnew : provides the \new \renew and \provide prefixes for checking definitions +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% +% This work consists of the main source file keycommand.dtx +% and the derived files +% ltxnew.sty, ltxnew.pdf, ltxnew.ins, +% +% Unpacking: +% (a) If ltxnew.ins is present: +% etex ltxnew.ins +% (b) Without ltxnew.ins: +% etex ltxnew.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{ltxnew.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex ltxnew.dtx +% Copyright (C) 2009 by Florent Chervet +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +% +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: ltxnew 2009/07/22 v1.0 provides the \string\new \string\renew and \string\provide prefixes for checking definitions} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +ltxnew : provides the \string\new \string\renew and \string\provide prefixes for checking definitions. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + +This work consists of the main source file ltxnew.dtx +and the derived files + ltxnew.sty, ltxnew.pdf, ltxnew.ins, + +ltxnew : an easy way to define commands with keys +Copyright (C) 2009 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{ltxnew.ins}{\from{ltxnew.dtx}{install}}% + \file{ltxnew.sty}{\from{ltxnew.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* ltxnew.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `ltxnew.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +% +%<*ignore> +\fi +% +%<*driver> +\edef\thisfile{\jobname} +\def\thisinfo{provides the \cs{new} \cs{renew} and \cs{provide} prefixes for checking definitions.} +\let\loadclass\LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +\documentclass[a4paper,oneside]{ltxdoc} +\usepackage{tracing} +\usepackage[latin9]{inputenc} +\usepackage[american]{babel} +\usepackage{etex,holtxdoc,etoolbox,geometry,tocloft,fancyhdr,color,bbding,embedfile,framed,float,multirow,enumitem,txfonts}\CodelineNumbered +\embedfile{ltxnew.dtx} +\geometry{top=2cm,headheight=1cm,headsep=.3cm,bottom=2cm,left=4cm,right=2cm} +\hypersetup{% + pdftitle={The ltxnew package}, + pdfsubject={An e-TeX package for more useful tools for LaTeX package writers}, + pdfauthor={Florent CHERVET}, + colorlinks,linkcolor=reflink,urlcolor=refurl, + pdfstartview={FitH}, + pdfkeywords={tex, e-tex, latex, package, keys, ltxnew, newcommand, renewcommand, new, renew}, + bookmarksopen=true,bookmarksopenlevel=2} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} +% +% \fi +% +% \CheckSum{0} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs} +% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} +% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} +% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} +% \DoNotIndex{\filename,\fileversion,\filedate,\let} +% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter} +% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography} +% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} +% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} +% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument} +% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine} +% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem} +% \DoNotIndex{\z@,\wd,\wheremsg,\vrule,\voidb@x,\verb,\bibitem} +% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar} +% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr} +% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt} +% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth} +% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother} +% \DoNotIndex{\maketitle,\parindent,\setbox,\kernel@ifnextchar} +% +% +% \makeatletter +% \lastlinefit999 +% \newcommand\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.18,0.00,0.45} +% \newcommand\reflinkcolor{\color{reflink}}\definecolor{reflink}{rgb}{0.49,0.00,0.00} +% \newcommand\refurlcolor{\color{refurl}}\definecolor{refurl}{rgb}{0.00,0.00,1.00} +% \def\ThisPackage{\Xpackage{\thisfile}}\def\thispackage{\xpackage{\thisfile}} +% \fancyhf{}\fancyhead[L]{The \thispackage\ -- \thisinfo} +% \fancyfoot[L]{\color[gray]{.35}\scriptsize\thispackage\quad\copyright\oldstylenums{2009}\,\lower.3ex\hbox{\NibRight}\,Florent Chervet} +% \fancyfoot[R]{\oldstylenums{\thepage} / \oldstylenums{\pageref{LastPage}}} +% \pagestyle{fancy} +% \floatplacement{table}{H} +% +% \catcode`\§\active\def§{\par\nobreak\vskip-\parskip} +% \newlength\saveparskip\saveparskip.4\baselineskip +% \newcommand\restoreparskip{\parskip\saveparskip} +% \parindent\z@\parskip\saveparskip\topsep\z@\partopsep\z@ +% \g@addto@macro\macro@font{\macrocodecolor\let\AltMacroFont\macro@font} +% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +% \def\csred#1{\textcolor{red}{\cs{#1}}} +% \def\CSif\bgroup\ignorespaces#1{\bgroup\ignorespaces\ifx#1\unskip\else \CS{#1}\fi} +% \def\CSbf#1{\textbf{\CS{#1}}} +% \def\Repeat#1#2{\ifnum\numexpr#1\relax>0\relax #2\relax\Repeat{#1-1}{#2}\fi} +% \def\Xpackage{\@dblarg\X@package} +% \def\X@package[#1]#2{% +% \xpackage{#2\footnote{\noindent\xpackage{#2}: \href{http://www.ctan.org/tex-archive/macros/latex/contrib/#1}{\nolinkurl{CTAN:macros/latex/contrib/#1}}}}} +% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} +% % \makeatother +% +% \title{\mdseries The {\bfseries \Xpackage{ltxnew}}\kern.6em package} +% \author{Florent Chervet \xemail{florent.chervet@free.fr}} +% \date{July 22, 2009} +% \subtitle{\thisinfo} +% +% \maketitle +% +% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} +% \MakeShortVerb{\+} +% +% \begin{abstract}\parindent0pt\noindent\parskip\medskipamount\small +% +% \xpackage{ltxnew} provides \CSbf{new} \CSbf{renew} and \CSbf{provide}: three expandable prefixes +% for use with |\def|, |\gdef|, |\edef|, |\xdef|, |\countdef|, |\dimendef|, |\skipdef|, |\muskipdef|, +% |\box|, |\toksdef|, |\marks|, |\count|, +% |\dimen|, |\skip|, |\muskip|, |\savebox|, |\toks| and the |\glob|\Repeat3\textasteriskcentered\ +% and |\loc|\Repeat3\textasteriskcentered\ variants of the \xpackage{etex} package. +% +% For example:§ +% \quad|\new\def\macro| will do {\it something like:} |\newcommand\macro{} \def\macro|§ +% \quad|\new\let\macro| will do {\it something like:} |\newcommand\macro{} \let\macro| +% +% ...But in fact |\new| does a little more than that... +% +% You may use |\new| or |\renew| for declaring macros, counters, dimensions, skips, muskips, +% boxes, tokens and \eTeX's marks. Even with |\let|, |\new| can be used. Moreover, |\renew| can be used +% to redefine macros that were previously defined as |\outer|. +% +% \xpackage{ltxnew} is designed to work with an \eTeX{} distribution of \LaTeX{}. It relies on the \LaTeX{} macro +% |\@ifdefinable|, on the \Xpackage[etex-pkg]{etex} package and some macros of \Xpackage{etoolbox}. +% +% \end{abstract}\vskip-\baselineskip +% \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone +% \footnotetext{\noindent +% This documentation is produced with the +DocStrip+ utility. +% \begin{tabbing} +% \qquad\=\smex\=To get the documentation, \= run (thrice):\quad\= \texttt{pdflatex ltxnew.dtx} \\ +% \>\>for the index:\>\>\texttt{makeindex -s gind.ist ltxnew.idx} \\ +% \>\smex\>To get the package, \> run:\> \texttt{etex ltxnew.dtx} +% \end{tabbing}§ +% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.} +% \endgroup\makeatother +% +% +% \cftbeforesecskip=5pt plus2pt minus4pt +% \bigskip +% \tableofcontents +% +% \def\B#1{\texttt{[}\meta{#1}\texttt{]}} +% +% \section{Introduction} +% +% \subsection{Motivation} +% +% \LaTeX{} provides |\newcommand| for defining new commands. However, comparing to |\def| +% the syntax is limited because we cannot use delimited arguments in such a command. +% The advantage of |\newcommand| (apart the optional argument\footnote{optional arguments are +% implemented in a much flexible way by \xpackage{xargs} by Manuel P\'egouri\'e-Gonnard.}) +% is that the control sequence is first checked for availability (its meaning ought to be +% |undefined| or |\relax| before the definition). +% +% \xpackage{etoolbox} enhance this matter allowing to define |\newrobustcmd| and |\renewrobustcmd|. +% +% Moreover, \LaTeX{} does not provide an automatic check of control sequences when defining +% tokens (|\newtoks|), dimensions (|\newdimen|), skips (|\newskip|), etc. etc. + +% The only exceptions are:§ +% \begin{itemize}\itemsep=0pt +% \item |\newlength| \\ +% but there is no |\renewlength| command... because +% the name |\renewlength| sounds bad: it would have meant \textit{``I know the control sequence I wish +% to define as a length has been defined before, as a macro may be, or a box or a token or +% whatever, and I wish to redefine this control sequence to be a length (\textup{ie} a skip)}. +% So it doesn't really make sense... +% \item |\newcounter| \\ +% but |\newcounter{name}| does not define |name| but |\c@name| instead, as a counter. +% \item |\newsavebox| +% \item |\newfont| +% \end{itemize}\restoreparskip +% +% \bfseries All those |\new|\Repeat{3}{\textasteriskcentered}\ stuff define control sequences globally, +% \emph{excepting} |\newfont|. The reason could to be found in the background\footnote{in fact, a new font +% is defined as a control sequence, just like a macro, whereas skips, dimens, tokens etc. are numbered +% and then, defining a new one require an allocation.}. +% +% \mdseries +% But it's a matter of fact : \emph{fonts} are local to \LaTeX{} while \emph{length} (\emph{ie.\,skips}) +% are global... +% +% Thank to the \xpackage{etex} package that provides a method for the local allocation of new quantity +% \xpackage{ltxnew} puts the state of the affairs in a better order. \xpackage{ltxnew} provides a way +% to define new control sequences, or redefine them, just by +% beginning the definition with a (expandable) prefix : |\new| or |\renew|. +% +% \subsection{What \cs{new} means...} +% +% Such a short and easy word as \texttt{new} ought to be defined ! +% +% \bfseries \CS{new} means:§\mdseries +% \begin{itemize}[label=--,topsep=0pt,itemsep=0pt] +% \item Check if the control sequence to define is available (\emph{ie} means |undefined| or |\relax|) +% \item If that's OK: go on (with a side effect if the package \xpackage{tracing} is loaded) +% \item If not : throw an error, and if in |scrollmode| or |nonstopmode| or |batchmode| do not overwrite +% the last meaning. +% \end{itemize} +% +% That is really what means |\new|. No more, no less. +% +% \subsection{What \cs{renew} means} +% +% \bfseries \CS{renew} means:§\mdseries +% \begin{itemize}[label=--,topsep=0pt,itemsep=0pt] +% \item Check if the control sequence to redefine already has a meaning (different from |undefined| and also from |\relax|) +% \item If that's OK : go on (with a side effect if the package \xpackage{tracing} is loaded) +% \item If not : throw an error. But if in |srollmode|, |nonstopmode| or |batchmode| \textbf{do define} the control sequence. +% \end{itemize} +% +% \subsection{What \cs{provide} means} +% +% \bfseries \CS{provide} means:§\mdseries +% \begin{itemize}[label=--,topsep=0pt,itemsep=0pt] +% \item Check if the control sequence to define already has a meaning (different from |undefined| and also from |\relax|) +% \item If that's OK : go on (with a side effect if the package \xpackage{tracing} is loaded) +% \item If not : silently do nothing. +% \end{itemize} +% +% \subsection{Using \cs{new}} +% +% |\new| acts as a (expandable) prefix with the following syntax:§ +% \DeleteShortVerb{\|}\catcode`\|\active\let|\textbar\def\tvs{\textcolor{green}{\textvisiblespace}}\def\cblue{\color{blue}} +% \begin{framed}\begin{centering}\begin{tabular}{clll} +% & \cs{new} & \tvs \\ +% \cblue possibly & & (\csred{long}\tvs|\csred{global}\tvs|\csred{protected}\tvs|\csred{outer}\tvs) & optional (zero or more) \\ +% \cblue in a macro & \multirow{-2}*{\cblue $\Biggl\lbrace$} & \textsc{} & required: see below \\ +% & & \textit{control sequence} & required: +% \end{tabular}\end{centering}\end{framed} +% {\noindent \small \tvs\space denote optional spaces, ignored by the \cs{new}-prefixes-scanner.} +% +% \MakeShortVerb{\|} +% +% \bigbreak +% The \textsc{} may be one of the following:§\parskip=0pt +% \def\intert[#1]#2{\multicolumn{1}{#1}{\it #2}}\let\up\upshape +% \begin{table}\centering\begin{tabular}{|>{\emph}l<{:}|*{4}{>{\CSif\bgroup}l<{\egroup}}|}\hline\hline +% General & let & & & \cr +% Macros & def & gdef & edef & xdef \cr\hline\hline +% \intert[|c|]{Type} & \intert[|c]{def-word} & \intert[c]{always global} & \intert[c]{local (unless \up\small\CS{global})} & \intert[c|]{global}\cr\hline +% Counters & countdef & count & loccount & globcount \cr +% Dimensions & dimendef & dimen & locdimen & globdimen \cr +% Skip & skipdef & skip or \CS{length} & locskip & globskip \cr +% Muskip & muskipdef & muskip & locmuskip & globmuskip \cr +% Box & box & savebox & locbox & globbox \cr +% Tokens & toksdef & toks & loctoks & globtoks \cr +% Fonts & font & & & \cr +% Marks & marks & & locmarks\footnotemark & globmarks \cr \hline\hline +% \end{tabular} +% \caption{List of definition-words that may be used with \CS{new} and \CS{renew}} +% \end{table} +% \footnotetext{The use of \CS{locmarks} is left to the appreciation of the user...} +% +% \vskip-\baselineskip\minisec{Examples:} +% \begin{tabular}{ccc} +% |\new\countdef\mycount| & is the same as & |\new\loccount\mycount|\cr +% |\new\global\countdef\mycount| & is the same as & |\new\globcount\mycount|\cr +% |\new\count\mycount| & is the same as & |\newcount\mycount| \cr +% & & (with control sequence checking) +% \end{tabular}\medskip +% +% Therefore: (all of the following are global excepting |\newfont|):\par\nobreak +% \begin{tabular}{l@{\quad}>{\small}c@{\quad}l@{\quad}>{\small}c@{\quad}l} +% |\new\count| & is an improved version of & |\newcount| & close. to & |\new\global\countdef| \\ +% |\new\dimen| & is an improved version of & |\newdimen| & close. to & |\new\global\dimendef| \\ +% |\new\skip| & is an improved version of & |\newskip| & close. to & |\new\global\skipdef| \\ +% |\new\skip| & is also the same as & |\newlength| & & \\ +% |\new\muskip| & is an improved version of & |\newmuskip| & close. to & |\new\global\muskipdef| \\ +% |\new\savebox| & is the same as & |\newsavebox| & close. to & |\new\global\box| \\ +% |\new\toks| & is an improved version of & |\newtoks| & close. to & |\new\global\toksdef| \\ +% |\new\font| & is the same as & |\newfont| & \\ +% |\new\marks| & is an improved version of & |\newmarks| & equiv. to & |\new\global\locmarks| +% \end{tabular} +% +% +% \bigskip +% The |\loc|\Repeat3\textasteriskcentered\space and |\glob|\Repeat3\textasteriskcentered\space words and also |\newmarks| +% are defined by \Xpackage[etex-pkg]{etex}. +% +% Please note that there is no {\bfseries |\new\command|} and there will most probably never be. Nor +% is there any |\new\keycmd| if you use the \Xpackage{keycommand} package. +% +% \subsection{Using \cs{renew} and \cs{provide}} +% +% \cs{renew} and \cs{provide} have the same syntax as \cs{new}. +% +% \StopEventually{ +% } +% +% \begin{center}\vskip6pt$\star$\hskip4em\lower12pt\hbox{$\star$}\hskip4em$\star$\vadjust{\vskip12pt}\end{center} +% +% \section{Implementation} \label{Implementation} +% +% \subsection{Identification} +% +% This package is intended to use with \LaTeX{} so we don't check if it is loaded twice. +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) + [2005/12/01]% LaTeX must be 2005/12/01 or younger (see kvsetkeys.dtx). +\ProvidesPackage{ltxnew} + [2009/07/22 v1.0 provides the new and renew prefixes for checking definitions] +% \end{macrocode} +% \iffalse +% +% \fi +% +% \subsection{Requirements} +% +% \thispackage\ requires \Xpackage{etex} for local allocation of counters, tokens, skips etc. +% +% \begin{macrocode} +\RequirePackage{etex} +% \end{macrocode} +% \iffalse +% +% \fi +% +% \subsection{Helper macro} +% +% \begin{macro}{\ltxn@expandonce} +% |\ltxn@expandonce| is the copy of the |\expandonce| macro from \Xpackage{etoolbox}. +% As long as this is the only macro from \xpackage{etoolbox} we use here, we avoid loading this package. +% \iffalse +%% \ltxn@expandonce is the copy of \expandonce from etoolbox.sty +% \fi +% \begin{macrocode} +\def\ltxn@expandonce#1{\unexpanded\expandafter{#1}} +% \end{macrocode} +% \end{macro} +% +% \subsection{The prefixes scanner} +% +% The prefixes scanner is very simple in fact! All the job is based of |\futurelet|: |\futurelet| +% reads the next token but does not remove it from the input string. We then just have to test +% it with |\ifx| to conditionally append it into the prefix buffer: |\ltxn@prfx|. Otherwise, +% we expand the prefix once and try again. Namely: +% +% \quad|\futurelet\x\testmacro|\quad\smex\quad if |\testmacro| ``returned false'' then:§ +% \quad|\expandafter\futurelet\expandafter\x\expandafter\testmacro| +% +% easy easy easy... +% +% If it happens that the expanded prefix is the same before and after expansion, then it means that was +% a primitive. The only primitives allowed between |\new| and |\def| are:§ +% \begin{centering}\begin{tabular}{*{4}{m{2.5cm}}} +% |\long| & |\global| & |\protected| & |\outer| \\ +% |\expandafter| & |\noexpand| & \hfil \textit{and} & |\relax| +% \end{tabular}\end{centering} +% +% \begin{macro}{\ltxn@prefix} +% This is the prefix scanner. We open a group at the very beginning for all definitions +% will be local until the final definition: +% \iffalse +% +%% This is the entry point of the prefixes scanner: +%% The whole job is done by \futurelet +% \fi +% \begin{macrocode} +\def\ltxn@prefix{\begingroup + \newif\ifglobal + \let\ltxn@prfx\@empty + \let\ltxn@rubbish\relax + \futurelet\x\ltxn@@prefix} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltxn@@prefix} +% This is the test macro: it is very long because there are many many |\ifx|... and as many fees! +% \iffalse +%% Here is the test macro: testing each prefix token one after another: +%% It consists in a long list of \ifx +% \fi\fi +% \begin{macrocode} +\def\ltxn@@prefix{% + \let\ltxn@next@addto\ltxn@next@prefix + \ifx\x\@sptoken \let\next\ltxn@space@prefix%%1 + \else \let\next\ltxn@addto@prfx + \ifx\x\long \def\z{\long}%%2 + \else\ifx\x\protected\def\z{\protected}%%3 + \else\ifx\x\global \let\z\@empty\globaltrue%%4 + \else\ifx\x\outer \def\z{\outer}%%5 + \else + \ifx\x\expandafter \def\z{\expandafter}%%6 + \else\ifx\x\noexpand \def\z{\noexpand}%%7 + \else\ifx\x\relax \def\z{\relax}%%8 + \else + \def\ltxn@next@addto{\expandafter\ltxn@def\noexpand}% + \ifx\x\let \def\z{\let}%%9 + \let\ltxn@cancel\ltxn@cancel@let + \else \let\ltxn@cancel\ltxn@cancel@def + \ifx\x\def \edef\z{\ifglobal\global\fi\def}%%10 + \else\ifx\x\edef \edef\z{\ifglobal\global\fi\edef}%%11 + \else\ifx\x\gdef \def\z{\gdef}%%12 + \else\ifx\x\xdef \def\z{\xdef}%%13 + \else \let\ltxn@cancel\ltxn@cancel@new + \ifx\x\count \def\z{\newcount}%%14 + \else\ifx\x\countdef%%15 + \ifglobal\def\z{\globcount}\else\def\z{\loccount}\fi + \else\ifx\x\loccount%%16 + \ifglobal\def\z{\globcount}\else\def\z{\loccount}\fi + \else\ifx\x\globcount \def\z{\globcount}%%17 + \else\ifx\x\dimen \def\z{\newdimen}%%18 + \else\ifx\x\dimendef%%19 + \ifglobal\def\z{\globdimen}\else\def\z{\locdimen}\fi + \else\ifx\x\locdimen%%20 + \ifglobal\def\z{\globdimen}\else\def\z{\locdimen}\fi + \else\ifx\x\globdimen \def\z{\globdimen}%%21 + \else\ifx\x\skip \def\z{\newskip}%%22 + \else\ifx\x\skipdef%%23 + \ifglobal\def\z{\globskip}\else\def\z{\locskip}\fi + \else\ifx\x\locskip%%24 + \ifglobal\def\z{\globskip}\else\def\z{\locskip}\fi + \else\ifx\x\globskip \def\z{\globskip}%%25 + \else\ifx\x\muskip \def\z{\newmuskip}%%26 + \else\ifx\x\muskipdef%%27 + \ifglobal\def\z{\globmuskip}\else\def\z{\locmuskip}\fi + \else\ifx\x\locmuskip%%28 + \ifglobal\def\z{\globmuskip}\else\def\z{\locmuskip}\fi + \else\ifx\x\globmuskip \def\z{\globmuskip}%%29 + \else\ifx\x\savebox \def\z{\newsavebox}%%30 + \else\ifx\x\box%%31 + \ifglobal\def\z{\globbox}\else\def\z{\locbox}\fi + \else\ifx\x\locbox%%§32 + \ifglobal\def\z{\globbox}\else\def\z{\locbox}\fi + \else\ifx\x\globbox \def\z{\globbox}%%33 + \else\ifx\x\toksdef%%34 + \ifglobal\def\z{\globtoks}\else\def\z{\loctoks}\fi + \else\ifx\x\toks \def\z{\newtoks}%%35 + \else\ifx\x\loctoks%%36 + \ifglobal\def\z{\globtoks}\else\def\z{\loctoks}\fi + \else\ifx\x\globtoks \def\z{\globtoks}%%37 + \else\ifx\x\locmarks%%38 + \ifglobal\def\z{\globmarks}\else\def\z{\locmarks}\fi + \else\ifx\x\marks \def\z{\newmarks}%%39 %\newmarks=\globmarks + \else\ifx\x\globmarks \def\z{\globmarks}%%40 + \else\ifx\x\font \def\z{\font}%%41 + \else\ifx\x\protect \ltxn@error@prefix%%42 + \else + \let\ltxn@next@addto\ltxn@next@prefix + \ifx\y\x\ltxn@error@prefix + \else\let\y\x + \fi + \let\next\ltxn@expand@prefix + \fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi + \fi + \fi\fi\fi + \fi\fi\fi\fi% so many fees... + \fi\next} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\def\ltxn@next@prefix{\futurelet\x\ltxn@@prefix} +\def\ltxn@expand@prefix{% + \expandafter\futurelet\expandafter\x\expandafter\ltxn@@prefix} +\def\ltxn@addto@prfx#1{\let\y\relax + \edef\ltxn@prfx{\ltxn@expandonce{\ltxn@prfx}\ltxn@expandonce{\z}}% + \ltxn@next@addto} +\expandafter\def\expandafter\ltxn@space@prefix\space{\ltxn@next@prefix} +\def\ltxn@error@prefix{\@latex@error{A \string\def\space + (or \string\countdef\space or\string\toksdef\space etc.)\MessageBreak + was expected after \string\new\MessageBreak + I found a \meaning\x!\MessageBreak + see ltxnew documentation for more information}\@ehd} +% \end{macrocode} +% +% \begin{macro}{\ltx@cancel} +% These are the macros used in case we have to cancel definition (nonstopmode) +% \iffalse +% +%% These are the macros used in case we have to cancel definition (nonstopmode) +%% #1 is always the control sequence not to redefine +% \fi +% \begin{macrocode} +\def\ltxn@cancel@let{\afterassignment\endgroup\let\ltxn@rubbish} +\def\ltxn@cancel@def{\afterassignment\endgroup\def\ltxn@rubbish} +\def\ltxn@cancel@new{\endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltxn@new} +% |\ltxn@new| defines the new control sequence, or cancels definition depending on the result +% of |\@ifdefinable|. |\ltxn@new| does all the jobs: it is called by both |\ltxn@renew| and |\ltxn@provide|: +% \iffalse +% +%% new: Do define or cancel, depending on the result of \@ifdefinable +% \fi +% \begin{macrocode} +\def\ltxn@new#1{% + \let\next\ltxn@cancel + \ifdefined#1\unless\ifx#1\relax\def#1{ltxn@throw@error}\fi\fi + \expandafter\@ifdefinable\noexpand#1{% + \expandafter\let\noexpand#1=\relax + \edef\next{\endgroup\ltxn@expandonce{\ltxn@prfx}\noexpand#1}}% + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltxn@renew} +% |\ltxn@renew| throws an error if the control sequence is undefined or if its meaning is |\relax|. +% In case of |nonstopmode| the control sequence is redefined, however. +% +% To handle the case where the control sequence was an outer macro, we ``stringify'' its name first, +% in order not to give the control sequence itself as an argument for the error message. +% \iffalse +% +%% renew: Throws an error in case the control sequence is unknown or \relax +% \fi +% \begin{macrocode} +\def\ltxn@renew#1{% + \edef\ltxn@name{\string#1 }% + \ifdefined#1 \ifx#1\relax \ltxn@error{renew: \ltxn@name undefined}\fi + \else \ltxn@error{renew: \ltxn@name undefined}% + \fi + \let#1=\relax + \def\next{\ltxn@new#1}% + \next} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltxn@provide} +% |\ltxn@provide| never throws an error, but define the control sequence only if it is undefined or |\relax| +% (\emph{ie}\, if it is |definable|): +% +% To handle the case where the control sequence was an outer macro, we ``stringify'' its name first, +% in order not to put the control sequence itself in the definition of next. It's admittedly tricky +% here, because if the control sequence is already defined, |\provide| will cancel out the new definition, +% however, as a borderline effect, |\ltxn@new| should have been called if the control sequence cas definable +% with this very control sequence as an argument. Even if this |\iffalse|-call (not expanded) is prepared +% into |\ifx|...|\fi| conditional, the |\outer| control sequence is there, and \TeX{} (not \LaTeX{}) +% will throw an error: \texttt{Forbidden control sequence found...}. +% \iffalse +% +%% provide: Never throw an error but conditionally defines the control sequence +% \fi +% \begin{macrocode} +\def\ltxn@provide#1{% + \let\next\ltxn@cancel + \edef\ltxn@name{\string#1}% + \ifdefined#1 \ifx#1\relax \ltxn@provide@new\fi + \else \ltxn@provide@new + \fi + \next} +\def\ltxn@provide@new{% + \edef\next{\noexpand\ltxn@new\csname\expandafter\@gobble\ltxn@name\endcsname}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\new} +% |\new|: the entry point: just let the definition macro to be |\ltxn@new| and start scanning prefixes. +% \iffalse +% +%% \new: the entry point: +%% just let the definition macro to be \ltxn@new and start scanning prefixes. +% \fi +% \begin{macrocode} +\def\new{\let\ltxn@def\ltxn@new\ltxn@prefix} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\renew} +% |\renew|: the entry point: just let the definition macro to be |\ltxn@renew| and start scanning prefixes. +% \iffalse +% +%% \renew: the entry point: +%% just let the definition macro to be \ltxn@renew and start scanning prefixes. +% \fi +% \begin{macrocode} +\def\renew{\let\ltxn@def\ltxn@renew\ltxn@prefix} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\provide} +% |\provide|: the entry point: just let the definition macro to be |\ltxn@provide| and start scanning prefixes. +% \iffalse +% +%% \provide: the entry point: +%% just let the definition macro to be |\ltxn@provide| and start scanning prefixes. +% \fi +% \begin{macrocode} +\def\provide{\let\ltxn@def\ltxn@provide\ltxn@prefix} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\ltxn@error} +% In case of redefinition, throws an |\ehc|-type error: +% \iffalse +% +%% In case of redefinition, throws an |\ehc|-type error: +% \fi +% \begin{macrocode} +\def\ltxn@error#1{\@latex@error{#1}\@ehc} +% \end{macrocode} +% \tracingnone +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \begin{History} +% \begin{Version}{2009/07/22 v1.0} +% \item +% First version. +% \end{Version} +% +% \end{History} +% +% \begin{thebibliography}{9} +% +% \bibitem{etex} +% David Carlisle and Peter Breitenlohner +% \textit{The \xpackage{etex} package}; +% 1998/03/26 v2.0; +% \CTAN{macros/latex/contrib/etex-pkg/}. +% +% \bibitem{etoolbox} +% Philipp Lehman +% \textit{The \xpackage{etoolbox} package}; +% 2008/06/28 v1.7; +% \CTAN{macros/latex/contrib/etoolbox/}. +% +% \end{thebibliography} +% +% \PrintIndex +% +% \label{LastPage} +% \Finale \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/ltxnew/ltxnew.ins b/Master/texmf-dist/source/latex/ltxnew/ltxnew.ins new file mode 100644 index 00000000000..5476690596f --- /dev/null +++ b/Master/texmf-dist/source/latex/ltxnew/ltxnew.ins @@ -0,0 +1,82 @@ +%% +%% This is file `ltxnew.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ltxnew.dtx (with options: `install') +%% +%% This is a generated file. +%% +%% ltxnew : provides the \new and \renew prefixes for checking definitions. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file ltxnew.dtx +%% and the derived files +%% ltxnew.sty, ltxnew.pdf, ltxnew.ins, +%% +%% ltxnew : an easy way to define commands with keys +%% Copyright (C) 2009 by Florent Chervet +%% +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: ltxnew 2009/07/22 v1.0 provides the \string\new \string\renew and \string\provide prefixes for checking definitions} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +ltxnew : provides the \string\new \string\renew and \string\provide prefixes for checking definitions. + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + +This work consists of the main source file ltxnew.dtx +and the derived files + ltxnew.sty, ltxnew.pdf, ltxnew.ins, + +ltxnew : an easy way to define commands with keys +Copyright (C) 2009 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{ltxnew.ins}{\from{ltxnew.dtx}{install}}% + \file{ltxnew.sty}{\from{ltxnew.dtx}{package}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* ltxnew.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `ltxnew.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile + +\endinput +%% +%% End of file `ltxnew.ins'. diff --git a/Master/texmf-dist/tex/latex/ltxnew/ltxnew.sty b/Master/texmf-dist/tex/latex/ltxnew/ltxnew.sty new file mode 100644 index 00000000000..83a34227d11 --- /dev/null +++ b/Master/texmf-dist/tex/latex/ltxnew/ltxnew.sty @@ -0,0 +1,189 @@ +%% +%% This is file `ltxnew.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ltxnew.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% ltxnew : provides the \new and \renew prefixes for checking definitions. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file ltxnew.dtx +%% and the derived files +%% ltxnew.sty, ltxnew.pdf, ltxnew.ins, +%% +%% ltxnew : an easy way to define commands with keys +%% Copyright (C) 2009 by Florent Chervet +%% + +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) + [2005/12/01]% LaTeX must be 2005/12/01 or younger (see kvsetkeys.dtx). +\ProvidesPackage{ltxnew} + [2009/07/22 v1.0 provides the new and renew prefixes for checking definitions] + +\RequirePackage{etex} + +% \ltxn@expandonce is the copy of \expandonce from etoolbox.sty +\def\ltxn@expandonce#1{\unexpanded\expandafter{#1}} + +% This is the entry point of the prefixes scanner: +% The whole job is done by \futurelet +\def\ltxn@prefix{\begingroup + \newif\ifglobal + \let\ltxn@prfx\@empty + \let\ltxn@rubbish\relax + \futurelet\x\ltxn@@prefix} +% Here is the test macro: testing each prefix token one after another: +% It consists in a long list of \ifx +\def\ltxn@@prefix{% + \let\ltxn@next@addto\ltxn@next@prefix + \ifx\x\@sptoken \let\next\ltxn@space@prefix%%1 + \else \let\next\ltxn@addto@prfx + \ifx\x\long \def\z{\long}%%2 + \else\ifx\x\protected\def\z{\protected}%%3 + \else\ifx\x\global \let\z\@empty\globaltrue%%4 + \else\ifx\x\outer \def\z{\outer}%%5 + \else + \ifx\x\expandafter \def\z{\expandafter}%%6 + \else\ifx\x\noexpand \def\z{\noexpand}%%7 + \else\ifx\x\relax \def\z{\relax}%%8 + \else + \def\ltxn@next@addto{\expandafter\ltxn@def\noexpand}% + \ifx\x\let \def\z{\let}%%9 + \let\ltxn@cancel\ltxn@cancel@let + \else \let\ltxn@cancel\ltxn@cancel@def + \ifx\x\def \edef\z{\ifglobal\global\fi\def}%%10 + \else\ifx\x\edef \edef\z{\ifglobal\global\fi\edef}%%11 + \else\ifx\x\gdef \def\z{\gdef}%%12 + \else\ifx\x\xdef \def\z{\xdef}%%13 + \else \let\ltxn@cancel\ltxn@cancel@new + \ifx\x\count \def\z{\newcount}%%14 + \else\ifx\x\countdef%%15 + \ifglobal\def\z{\globcount}\else\def\z{\loccount}\fi + \else\ifx\x\loccount%%16 + \ifglobal\def\z{\globcount}\else\def\z{\loccount}\fi + \else\ifx\x\globcount \def\z{\globcount}%%17 + \else\ifx\x\dimen \def\z{\newdimen}%%18 + \else\ifx\x\dimendef%%19 + \ifglobal\def\z{\globdimen}\else\def\z{\locdimen}\fi + \else\ifx\x\locdimen%%20 + \ifglobal\def\z{\globdimen}\else\def\z{\locdimen}\fi + \else\ifx\x\globdimen \def\z{\globdimen}%%21 + \else\ifx\x\skip \def\z{\newskip}%%22 + \else\ifx\x\skipdef%%23 + \ifglobal\def\z{\globskip}\else\def\z{\locskip}\fi + \else\ifx\x\locskip%%24 + \ifglobal\def\z{\globskip}\else\def\z{\locskip}\fi + \else\ifx\x\globskip \def\z{\globskip}%%25 + \else\ifx\x\muskip \def\z{\newmuskip}%%26 + \else\ifx\x\muskipdef%%27 + \ifglobal\def\z{\globmuskip}\else\def\z{\locmuskip}\fi + \else\ifx\x\locmuskip%%28 + \ifglobal\def\z{\globmuskip}\else\def\z{\locmuskip}\fi + \else\ifx\x\globmuskip \def\z{\globmuskip}%%29 + \else\ifx\x\savebox \def\z{\newsavebox}%%30 + \else\ifx\x\box%%31 + \ifglobal\def\z{\globbox}\else\def\z{\locbox}\fi + \else\ifx\x\locbox%%§32 + \ifglobal\def\z{\globbox}\else\def\z{\locbox}\fi + \else\ifx\x\globbox \def\z{\globbox}%%33 + \else\ifx\x\toksdef%%34 + \ifglobal\def\z{\globtoks}\else\def\z{\loctoks}\fi + \else\ifx\x\toks \def\z{\newtoks}%%35 + \else\ifx\x\loctoks%%36 + \ifglobal\def\z{\globtoks}\else\def\z{\loctoks}\fi + \else\ifx\x\globtoks \def\z{\globtoks}%%37 + \else\ifx\x\locmarks%%38 + \ifglobal\def\z{\globmarks}\else\def\z{\locmarks}\fi + \else\ifx\x\marks \def\z{\newmarks}%%39 %\newmarks=\globmarks + \else\ifx\x\globmarks \def\z{\globmarks}%%40 + \else\ifx\x\font \def\z{\font}%%41 + \else\ifx\x\protect \ltxn@error@prefix%%42 + \else + \let\ltxn@next@addto\ltxn@next@prefix + \ifx\y\x\ltxn@error@prefix + \else\let\y\x + \fi + \let\next\ltxn@expand@prefix + \fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi + \fi + \fi\fi\fi + \fi\fi\fi\fi% so many fees... + \fi\next} +\def\ltxn@next@prefix{\futurelet\x\ltxn@@prefix} +\def\ltxn@expand@prefix{% + \expandafter\futurelet\expandafter\x\expandafter\ltxn@@prefix} +\def\ltxn@addto@prfx#1{\let\y\relax + \edef\ltxn@prfx{\ltxn@expandonce{\ltxn@prfx}\ltxn@expandonce{\z}}% + \ltxn@next@addto} +\expandafter\def\expandafter\ltxn@space@prefix\space{\ltxn@next@prefix} +\def\ltxn@error@prefix{\@latex@error{A \string\def\space + (or \string\countdef\space or\string\toksdef\space etc.)\MessageBreak + was expected after \string\new\MessageBreak + I found a \meaning\x!\MessageBreak + see ltxnew documentation for more information}\@ehd} + +% These are the macros used in case we have to cancel definition (nonstopmode) +% #1 is always the control sequence not to redefine +\def\ltxn@cancel@let{\afterassignment\endgroup\let\ltxn@rubbish} +\def\ltxn@cancel@def{\afterassignment\endgroup\def\ltxn@rubbish} +\def\ltxn@cancel@new{\endgroup} + +% new: Do define or cancel, depending on the result of \@ifdefinable +\def\ltxn@new#1{% + \let\next\ltxn@cancel + \ifdefined#1\unless\ifx#1\relax\def#1{ltxn@throw@error}\fi\fi + \expandafter\@ifdefinable\noexpand#1{% + \expandafter\let\noexpand#1=\relax + \edef\next{\endgroup\ltxn@expandonce{\ltxn@prfx}\noexpand#1}}% + \next} + +% renew: Throws an error in case the control sequence is unknown or \relax +\def\ltxn@renew#1{% + \edef\ltxn@name{\string#1 }% + \ifdefined#1 \ifx#1\relax \ltxn@error{renew: \ltxn@name undefined}\fi + \else \ltxn@error{renew: \ltxn@name undefined}% + \fi + \let#1=\relax + \def\next{\ltxn@new#1}% + \next} + +% provide: Never throw an error but conditionally defines the control sequence +\def\ltxn@provide#1{% + \let\next\ltxn@cancel + \edef\ltxn@name{\string#1}% + \ifdefined#1 \ifx#1\relax \ltxn@provide@new\fi + \else \ltxn@provide@new + \fi + \next} +\def\ltxn@provide@new{% + \edef\next{\noexpand\ltxn@new\csname\expandafter\@gobble\ltxn@name\endcsname}} + +% \new: the entry point: +% just let the definition macro to be \ltxn@new and start scanning prefixes. +\def\new{\let\ltxn@def\ltxn@new\ltxn@prefix} + +% \renew: the entry point: +% just let the definition macro to be \ltxn@renew and start scanning prefixes. +\def\renew{\let\ltxn@def\ltxn@renew\ltxn@prefix} + +% \provide: the entry point: +% just let the definition macro to be |\ltxn@provide| and start scanning prefixes. +\def\provide{\let\ltxn@def\ltxn@provide\ltxn@prefix} + +% In case of redefinition, throws an |\ehc|-type error: +\def\ltxn@error#1{\@latex@error{#1}\@ehc} +\endinput +%% +%% End of file `ltxnew.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 225560e0d72..b2a46895b7b 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -148,8 +148,9 @@ my @WorkingTLP = qw( lshort-japanese lshort-korean lshort-mongol lshort-persian lshort-polish lshort-portuguese lshort-slovak lshort-slovenian lshort-spanish lshort-thai lshort-turkish lshort-ukr - lshort-vietnamese ltablex ltabptch ltxdockit - ltxindex ltxmisc luainputenc luamplib luaotfload luatextra lxfonts + lshort-vietnamese ltablex ltabptch + ltxdockit ltxindex ltxmisc ltxnew + luainputenc luamplib luaotfload luatextra lxfonts macqassign mafr magyar mailing makebarcode makebox makecell makecirc makecmds makeglos makeplot maple margbib diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 15577e93eeb..077fbef02b2 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -292,6 +292,7 @@ depend ltablex depend ltabptch depend ltxdockit depend ltxindex +depend ltxnew depend mailing depend makebarcode depend makebox diff --git a/Master/tlpkg/tlpsrc/ltxnew.tlpsrc b/Master/tlpkg/tlpsrc/ltxnew.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3