diff options
author | Karl Berry <karl@freefriends.org> | 2015-05-11 21:08:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-05-11 21:08:51 +0000 |
commit | beed4b3fbec0e5363230a8e402b0c374a414c093 (patch) | |
tree | 134a792d761a452cfc03ab6e54e8d1477b92040e /Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx | |
parent | 40dd5938ded99176abd37cee3b6271722fe30f24 (diff) |
elocalloc (10may15)
git-svn-id: svn://tug.org/texlive/trunk@37339 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx b/Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx new file mode 100644 index 00000000000..0580a7fff8b --- /dev/null +++ b/Master/texmf-dist/source/latex/elocalloc/elocalloc.dtx @@ -0,0 +1,128 @@ +% \iffalse +%% Source File: textcase.dtx +%% Copyright 2015 David Carlisle +%% +%% This file may be distributed under the terms of the LPPL. +%% See README for details. +% +%<*dtx> + \ProvidesFile{elocalloc.dtx} +%</dtx> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{elocalloc} +%<driver> \ProvidesFile{elocalloc.drv} +% \fi +% \ProvidesFile{elocalloc.dtx} + [2015/05/09 v0.01 local allocation for LaTeX 2015+ (DPC)] +% +% \iffalse +%<*driver> +\documentclass{ltxdoc} +\begin{document} +\DocInput{elocalloc.dtx} +\end{document} +%</driver> +% \fi +% +% \GetFileInfo{elocalloc.dtx} +% +% \title{The \textsf{elocalloc} Package\thanks{This file +% has version number \fileversion, last +% revised \filedate. +% Please report any issues at https://github.com/davidcarlisle/dpctex/issues}} +% \author{David Carlisle} +% \maketitle +% +% \section{Introduction} +% +% Prior to the 2015/01/01 \LaTeX\ release, access to extended registers was +% usually provided by the \textsf{etex} package. From 2015 on the base +% \LaTeX\ format ``knows'' the register ranges for tex, etex, xetex and +% luatex, and so for most purposes the \textsf{etex} package is not +% required. +% +% For existing documents \textsf{etex} may still be loaded and will work +% as before, however in general it is best not to load \textsf{etex} as it +% will over-write the new allocation scheme with its own. +% +% Standard allocation macros such as |\newbox| and extended versions of +% tracing commands are now defined in the format for suitable engines however +% there were some features of \textsf{etex} not copied into the format, +% notably the ``local'' allocation macros. A search of CTAN showed that +% these were almost never used, and their use can often be avoided, however +% there are occasions when they may be useful. This package provides +% implementations based on the new allocation system in \LaTeX\ 2015/01/01. +% +% Within a local group a command such as |\locbox\tmpbox| defines |\tmpbox| +% to be a box register, but unlike |\newbox| the definition is local, and +% at the end of the group, |\tmpbox| loses its definition, and the box +% allocation number is restored. +% +% The package defines: |\loccount|, |\locdimen|, |\locskip|, |\locmuskip|, +% |\locbox|, |\loctoks| and |\locmarks|. +% +% +% \section{Implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% On old \LaTeX, load |etex.sty| and stop. +% \begin{macrocode} +\ifx\e@alloc\@undefined +\RequirePackage{etex} +\expandafter\endinput +\fi +% \end{macrocode} +% +% If something else defined |\locbox|, stop with a warning. +% +% \begin{macrocode} +\ifx\locbox\@undefined\else +\PackageWarning{elocalloc}{% + \string\locbox\space already defined, stopping} +\expandafter\endinput +\fi +% \end{macrocode} +% +% Don't allow |\extrafloats| while a local allocation is in force. +% It is however OK to use |\extrafloats| with this package and to +% use floats within a group with a local allocation. +% +% For local allocations, reduce the top of the range available for global +% allocations by one, and locally allocate the register from that top +% position. +% +% Note that this means that (unlike the \textsf{etex} package originals) +% locally allocating one register affects the top of the other registers +% that share the same top of range, but doing otherwise would mean storing +% separate values ofr each type, and would make it harder to make +% |\extrafloats| work, should such an extension ever be needed. +% \begin{macrocode} +\def\eloc@lloc#1#2#3#4#5{% + \def\extrafloats##1{% + \PackageWarning{elocalloc}{\string\extrafloats\space ignored}} + \e@ch@ck{#1}#2\z@#3% + \expandafter\e@alloc@chardef\expandafter#2% + \the\numexpr#2-1\relax + \allocationnumber=#2% + #3#5#2} +% \end{macrocode} +% +% The top level local allocation commands. +% \begin{macrocode} +\def\loccount {\eloc@lloc{\count 10}\float@count\countdef\count} +\def\locdimen {\eloc@lloc{\count 11}\float@count\dimendef\dimen} +\def\locskip {\eloc@lloc{\count 12}\float@count\skipdef\skip} +\def\locmuskip{\eloc@lloc{\count 13}\e@alloc@top\muskipdef\muskip} +\def\locbox {\eloc@lloc{\count 14}\float@count\e@alloc@chardef\box} +\def\loctoks {\eloc@lloc{\count 15}\e@alloc@top\toksdef\toks} +\def\locmarks {\eloc@lloc{\count256}\e@alloc@topt\e@alloc@chardef\marks} +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \Finale +% |