summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/elocalloc
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/elocalloc
Initial commit
Diffstat (limited to 'macros/latex/contrib/elocalloc')
-rw-r--r--macros/latex/contrib/elocalloc/README.txt17
-rw-r--r--macros/latex/contrib/elocalloc/elocalloc.dtx128
-rw-r--r--macros/latex/contrib/elocalloc/elocalloc.ins10
-rw-r--r--macros/latex/contrib/elocalloc/elocalloc.pdfbin0 -> 153494 bytes
4 files changed, 155 insertions, 0 deletions
diff --git a/macros/latex/contrib/elocalloc/README.txt b/macros/latex/contrib/elocalloc/README.txt
new file mode 100644
index 0000000000..5ab5f9d3ab
--- /dev/null
+++ b/macros/latex/contrib/elocalloc/README.txt
@@ -0,0 +1,17 @@
+elocalloc package
+
+Local allocation macros, with names taken from etex.sty
+but with implementation based on the LaTeX 2015 allocation macros.
+
+To produce typeset documentation:
+pdflatex elocalloc.dtx
+
+To extract the elocalloc.sty package:
+tex elocalloc.ins
+
+David Carlisle
+LPPL licenced (status: maintained)
+
+Please report any issues at
+
+https://github.com/davidcarlisle/dpctex/issues
diff --git a/macros/latex/contrib/elocalloc/elocalloc.dtx b/macros/latex/contrib/elocalloc/elocalloc.dtx
new file mode 100644
index 0000000000..8a8cbf4eb3
--- /dev/null
+++ b/macros/latex/contrib/elocalloc/elocalloc.dtx
@@ -0,0 +1,128 @@
+% \iffalse
+%% Source File: textcase.dtx
+%% Copyright 2015-2016 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}
+ [2016/12/15 v0.03 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 for 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@top\e@alloc@chardef\marks}
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \Finale
+%
diff --git a/macros/latex/contrib/elocalloc/elocalloc.ins b/macros/latex/contrib/elocalloc/elocalloc.ins
new file mode 100644
index 0000000000..d3bb84bf58
--- /dev/null
+++ b/macros/latex/contrib/elocalloc/elocalloc.ins
@@ -0,0 +1,10 @@
+\input docstrip
+\keepsilent
+\preamble
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{elocalloc.sty}{\from{elocalloc.dtx}{package}}}
+
+\endbatchfile
diff --git a/macros/latex/contrib/elocalloc/elocalloc.pdf b/macros/latex/contrib/elocalloc/elocalloc.pdf
new file mode 100644
index 0000000000..f36d26d747
--- /dev/null
+++ b/macros/latex/contrib/elocalloc/elocalloc.pdf
Binary files differ