| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: regstats.dtx |
| 4 |
% Version: 2025-01-28 v1.1b |
| 5 |
% Info: Counting used registers |
| 6 |
% |
| 7 |
% Copyright © 2011 - 2025 by |
| 8 |
% H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de> |
| 9 |
% |
| 10 |
% This work may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either |
| 12 |
% version 1.3c of this license or (at your option) any later |
| 13 |
% version. This version of this license is in |
| 14 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 15 |
% and the latest version of this license is in |
| 16 |
% https://www.latex-project.org/lppl.txt |
| 17 |
% and version 1.3c or later is part of all distributions of |
| 18 |
% LaTeX version 2005-12-01 or later. |
| 19 |
% |
| 20 |
% This work has the LPPL maintenance status "maintained". |
| 21 |
% |
| 22 |
% The Current Maintainer of this work is H.-Martin Münch. |
| 23 |
% |
| 24 |
% This work consists of the main source file regstats.dtx, |
| 25 |
% the README, and the derived files |
| 26 |
% regstats.sty, regstats.pdf, |
| 27 |
% regstats.ins, regstats.drv, |
| 28 |
% regstats-example.tex, regstats-example.pdf, |
| 29 |
% regstats-example.log. |
| 30 |
% |
| 31 |
% "regstats" is available on CTAN: |
| 32 |
% https://ctan.org/pkg/regstats |
| 33 |
% |
| 34 |
% Also a TDS.ZIP file is provided that contains all the files |
| 35 |
% already sorted in a TDS tree: |
| 36 |
% https://mirror.ctan.org/install/macros/latex/contrib/regstats.tds.zip |
| 37 |
% |
| 38 |
%<*ignore> |
| 39 |
\begingroup |
| 40 |
\catcode123=1 % |
| 41 |
\catcode125=2 % |
| 42 |
\def\x{LaTeX2e}% |
| 43 |
\expandafter\endgroup |
| 44 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 45 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 46 |
\ifx\fmtname\x\else 1\fi\relax |
| 47 |
\else\csname fi\endcsname |
| 48 |
%</ignore> |
| 49 |
%<*install> |
| 50 |
\input docstrip.tex |
| 51 |
\Msg{*******************************************************************} |
| 52 |
\Msg{* Installation *} |
| 53 |
\Msg{* Package: regstats 2025-01-28 v1.1b Counting used registers (HMM)*} |
| 54 |
\Msg{*******************************************************************} |
| 55 |
|
| 56 |
\keepsilent |
| 57 |
\askforoverwritefalse |
| 58 |
|
| 59 |
\let\MetaPrefix\relax |
| 60 |
\preamble |
| 61 |
|
| 62 |
This is a generated file. |
| 63 |
|
| 64 |
Project: regstats |
| 65 |
Version: 2025-01-28 v1.1b |
| 66 |
Info: Counting used registers |
| 67 |
|
| 68 |
Copyright (C) 2011 - 2025 by |
| 69 |
H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de> |
| 70 |
|
| 71 |
This work may be distributed and/or modified under the |
| 72 |
conditions of the LaTeX Project Public License, either |
| 73 |
version 1.3c of this license or (at your option) any later |
| 74 |
version. This version of this license is in |
| 75 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 76 |
and the latest version of this license is in |
| 77 |
https://www.latex-project.org/lppl.txt |
| 78 |
and version 1.3c or later is part of all distributions of |
| 79 |
LaTeX version 2005-12-01 or later. |
| 80 |
|
| 81 |
This work has the LPPL maintenance status "maintained". |
| 82 |
|
| 83 |
The Current Maintainer of this work is H.-Martin Muench. |
| 84 |
|
| 85 |
This work consists of the main source file regstats.dtx, |
| 86 |
the README, and the derived files |
| 87 |
regstats.sty, regstats.pdf, |
| 88 |
regstats.ins, regstats.drv, |
| 89 |
regstats-example.tex, regstats-example.pdf, |
| 90 |
regstats-example.log. |
| 91 |
|
| 92 |
In memoriam |
| 93 |
Claudia Simone Barth + 1996-01-30 |
| 94 |
Tommy Muench + 2014-01-02 |
| 95 |
Hans-Klaus Muench + 2014-08-24 |
| 96 |
|
| 97 |
\endpreamble |
| 98 |
\let\MetaPrefix\DoubleperCent |
| 99 |
|
| 100 |
\generate{% |
| 101 |
\file{regstats.ins}{\from{regstats.dtx}{install}}% |
| 102 |
\file{regstats.drv}{\from{regstats.dtx}{driver}}% |
| 103 |
\usedir{tex/latex/regstats}% |
| 104 |
\file{regstats.sty}{\from{regstats.dtx}{package}}% |
| 105 |
\usedir{doc/latex/regstats}% |
| 106 |
\file{regstats-example.tex}{\from{regstats.dtx}{example}}% |
| 107 |
} |
| 108 |
|
| 109 |
\catcode32=13\relax% active space |
| 110 |
\let =\space% |
| 111 |
\Msg{************************************************************************} |
| 112 |
\Msg{*} |
| 113 |
\Msg{* To finish the installation you have to move the following} |
| 114 |
\Msg{* file into a directory searched by TeX:} |
| 115 |
\Msg{*} |
| 116 |
\Msg{* regstats.sty} |
| 117 |
\Msg{*} |
| 118 |
\Msg{* To produce the documentation run the file `regstats.drv'} |
| 119 |
\Msg{* through (pdf)LaTeX, e.g.} |
| 120 |
\Msg{* pdflatex regstats.drv} |
| 121 |
\Msg{* makeindex -s gind.ist regstats.idx} |
| 122 |
\Msg{* pdflatex regstats.drv} |
| 123 |
\Msg{* makeindex -s gind.ist regstats.idx} |
| 124 |
\Msg{* pdflatex regstats.drv} |
| 125 |
\Msg{*} |
| 126 |
\Msg{* At least three runs are necessary e.g. to get the} |
| 127 |
\Msg{* references right!} |
| 128 |
\Msg{*} |
| 129 |
\Msg{* Happy TeXing!} |
| 130 |
\Msg{*} |
| 131 |
\Msg{************************************************************************} |
| 132 |
|
| 133 |
\endbatchfile |
| 134 |
%</install> |
| 135 |
%<*ignore> |
| 136 |
\fi |
| 137 |
%</ignore> |
| 138 |
% |
| 139 |
% \section{The documentation driver file} |
| 140 |
% |
| 141 |
% The next bit of code contains the documentation driver file for |
| 142 |
% \TeX, i.\,e., the file that will produce the documentation you |
| 143 |
% are currently reading. It will be extracted from this file by the |
| 144 |
% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip} |
| 145 |
% and specify the \texttt{driver} option when \texttt{docstrip} |
| 146 |
% asks for options. |
| 147 |
% |
| 148 |
% \begin{macrocode} |
| 149 |
%<*driver> |
| 150 |
\NeedsTeXFormat{LaTeX2e}[2022-11-01] |
| 151 |
\ProvidesFile{regstats.drv}[2025-01-28 v1.1b Counting used registers (HMM)] |
| 152 |
\documentclass[landscape]{ltxdoc}[2022/06/22]% v2.1i Standard LaTeX documentation class |
| 153 |
\usepackage{geometry}[2020/01/02]% v5.9 Page Geometry |
| 154 |
\usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO) |
| 155 |
\usepackage[T1]{fontenc}[2021/04/29]% v2.0v Standard LaTeX package |
| 156 |
\hypersetup{% |
| 157 |
pdfsubject={Information about used number of TeX registers (HMM)},% |
| 158 |
pdfkeywords={LaTeX, regstats, registers, read, write, language, box, dimen, counter, toks, skip, muskip, math family, insertion},% |
| 159 |
pdfencoding=auto,% |
| 160 |
pdflang={en},% |
| 161 |
breaklinks=true,% |
| 162 |
linktoc=all,% |
| 163 |
pdfstartview=FitH,% |
| 164 |
pdfpagelayout=OneColumn,% |
| 165 |
bookmarksnumbered=true,% |
| 166 |
bookmarksopen=true,% |
| 167 |
bookmarksopenlevel=3,% |
| 168 |
pdfmenubar=true,% |
| 169 |
pdftoolbar=true,% |
| 170 |
pdfwindowui=true,% |
| 171 |
pdfnewwindow=true% |
| 172 |
} |
| 173 |
\CodelineIndex |
| 174 |
\hyphenation{docu-ment} |
| 175 |
\makeatletter |
| 176 |
\@ifundefined{eTeX}{\gdef\eTeX{\hbox{$\m@th \varepsilon $-\TeX}}}{} |
| 177 |
\makeatother |
| 178 |
\begin{document} |
| 179 |
\DocInput{regstats.dtx}% |
| 180 |
\end{document} |
| 181 |
%</driver> |
| 182 |
% \end{macrocode} |
| 183 |
% \fi |
| 184 |
% |
| 185 |
% \GetFileInfo{regstats.drv} |
| 186 |
% |
| 187 |
% \begingroup |
| 188 |
% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}% |
| 189 |
% \makeatletter |
| 190 |
% \@onelevel@sanitize\x |
| 191 |
% \expandafter\endgroup |
| 192 |
% \expandafter\DoNotIndex\expandafter{\x} |
| 193 |
% \expandafter\DoNotIndex\expandafter{\string\ } |
| 194 |
% \begingroup |
| 195 |
% \makeatletter |
| 196 |
% \lccode`9=32\relax |
| 197 |
% \lowercase{%^^A |
| 198 |
% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A |
| 199 |
% }%^^A |
| 200 |
% \expandafter\endgroup\x |
| 201 |
% |
| 202 |
% \DoNotIndex{\ ,\\,\@gobble,\@ifclassloaded,\@ifl@t@r,\@ifpackagelater,\@ifpackageloaded,\@ifundefined,\@whilenum,\@percentchar,% |
| 203 |
% \@tempcnta,\@tempcntb,\AddToHook,\advance,\AfterLastShipout,\Alternative,\arabic,\AtBeginDocument,\AtEndAfterFileList,% |
| 204 |
% \AtEndDocument,\atveryend,\AtVeryEndDocument,\AtVeryVeryEnd,\begin,\count,\DeclareBoolOption,\divide,% |
| 205 |
% \csname,\endcsname,\etexfalse,\do,\setcounter,\stepcounter,\thenumberreg,\value,% |
| 206 |
% \documentclass,\end,\eTeX,\fmtversion,\gdef,\hbox,\hologo,\holtxdoc,\hyperref,\ifetex,\IfFileExists,% |
| 207 |
% \IfFormatAtLeastTF,\ifnum,\IfPackageLoadedTF,\ifpdf,\ifregstats@left,\ifregstats@proof,\ifregstats@timer,% |
| 208 |
% \iftex,\ifx,\intcalc,\intcalcMod,\jobname,\kvoptions,\left,\listfiles,\luatexfalse,\m@th,% |
| 209 |
% \makeatletter,\makeatother,\message,\MessageBreak,\multiply,\NeedsTeXFormat,% |
| 210 |
% \newcommand,\newif,\newline,\options,\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine,% |
| 211 |
% \pagenumbering,\par,\ProcessKeyvalOptions,\proof,\providecommand,\ProvidesPackage,% |
| 212 |
% \regcount,\regstats-example.tex,\regstats.dtx,\regstats.sty,\renewcommand,\RequirePackage,% |
| 213 |
% \regst@tsNoeTeX,\regs@tsmw,\regs@wmst,\regst@ts@st@tistics,\regst@ts@statistics,\regst@ts@timer,% |
| 214 |
% \regstats@box,\regstats@counter,\regstats@dimen,\regstats@fam,\regstats@firstofone,\regstats@free,% |
| 215 |
% \regstats@insert,\regstats@language,\regstats@left,\regstats@lft,\regstats@max,\regstats@message,% |
| 216 |
% \regstats@muskip,\regstats@pl,\regstats@read,\regstats@regstatA,\regstats@regstatB,\regstats@skip,% |
| 217 |
% \regstats@timerfalse,\regstats@toks,\regstats@used,\regstats@write,% |
| 218 |
% \section,\SetupKeyvalOptions,\space,\TeX,\textsf,\texttt,\the,\usepackage,\varepsilon} |
| 219 |
% |
| 220 |
% \title{The \xpackage{regstats} package} |
| 221 |
% \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}} |
| 222 |
% \date{2025-01-28 v1.1b} |
| 223 |
% \maketitle |
| 224 |
% |
| 225 |
% \begin{abstract} |
| 226 |
% \noindent This \LaTeX{} package allows to count the number of used registers |
| 227 |
% (counter, dimen, skip, muskip, box, token, input, output, |
| 228 |
% math families, languages, insertions) |
| 229 |
% and compare these to the maximum available number of such registers. |
| 230 |
% The time needed for a compilation run can be announced. |
| 231 |
% \end{abstract} |
| 232 |
% \bigskip |
| 233 |
% |
| 234 |
% \noindent Disclaimer for web links: The author is not responsible for any contents |
| 235 |
% referred to in this work unless having full knowledge of illegal contents. |
| 236 |
% If any damage occurs by the use of information presented there, |
| 237 |
% only the author of the respective pages might be liable, |
| 238 |
% not the one who has referred to those pages. |
| 239 |
% |
| 240 |
% \tableofcontents |
| 241 |
% |
| 242 |
% \section{Introduction} |
| 243 |
% \indent This \LaTeX{} package allows to count the number of used registers |
| 244 |
% (counter, dimen, skip, muskip, box, token, input, output, |
| 245 |
% math families, languages, insertions). |
| 246 |
% Therefore the according |\count| is read. While |\count10| should be the number |
| 247 |
% of the counters, |\count11| the one of the dimens, and so on, if there is enough |
| 248 |
% room for another register of that type, then a new one of that register is used |
| 249 |
% and looked at |\the\allocationnumber|. The result for each register is compared |
| 250 |
% to the maximum available number of the respective register.\newline |
| 251 |
% With option |left| additionally the number of remaining registers of each type |
| 252 |
% is given, and with option |timer| the time needed for the compilation run (when |
| 253 |
% either \hologo{LuaLaTeX} with |\directlua{starttime = os.clock()}| before |
| 254 |
% |\documentclass| or |pdf(la)tex| is used). |
| 255 |
% |
| 256 |
% \section{Usage} |
| 257 |
% \indent Just load the package placing |
| 258 |
% \begin{quote} |
| 259 |
% |\usepackage[<|\textit{options}|>]{regstats}| |
| 260 |
% \end{quote} |
| 261 |
% \noindent at the end of the preamble of your \LaTeXe{} source file. When you |
| 262 |
% load packages |\AtBeginDocument|, \xpackage{regstats} should be the last one |
| 263 |
% of those packages. The resulting message will be presented at the end of the |
| 264 |
% compilation messages at the screen and in the \xfile{log} file. |
| 265 |
% \bigskip |
| 266 |
% |
| 267 |
% The examplefile provides (commented out) |\stressCounter|, |\stressDimen|, |
| 268 |
% \dots, and |\stressInsert| to try out how many counters, dimens, \dots, and |
| 269 |
% inserts your system can handle. |
| 270 |
% \pagebreak |
| 271 |
% |
| 272 |
% \subsection{Options} |
| 273 |
% \DescribeMacro{options} |
| 274 |
% \indent The \xpackage{regstats} package takes the following options: |
| 275 |
% |
| 276 |
% \subsubsection{left} |
| 277 |
% \DescribeMacro{left} |
| 278 |
% \indent When option \texttt{left} (or \texttt{left=true}) is chosen, |
| 279 |
% also the number of remaining registers of each type is given. The default |
| 280 |
% is \texttt{left=false}. |
| 281 |
% |
| 282 |
% \subsubsection{timer} |
| 283 |
% \DescribeMacro{timer} |
| 284 |
% \indent When option \texttt{timer} (or \texttt{timer=true}) is chosen, |
| 285 |
% also the time needed for the compilation run is given. The default |
| 286 |
% is \texttt{timer=false}. The used |\pdfelapsedtime| is not available, |
| 287 |
% when \hologo{LuaLaTeX} is used instead of |pdf(la)tex| to compile the document. |
| 288 |
% In that case at the very beginning of your \xfile{tex} file say\newline |
| 289 |
% \verb|\directlua{starttime = os.clock()}|\newline |
| 290 |
% (even before |\documentclass|!), and then the \texttt{timer} option can also |
| 291 |
% be used with \hologo{LuaLaTeX}. When neither \hologo{LuaLaTeX} nor \hologo{pdfLaTeX} is used |
| 292 |
% to compile the document, the \texttt{timer}(-option) does not work. |
| 293 |
% |
| 294 |
% \subsubsection{proof} |
| 295 |
% \DescribeMacro{proof} |
| 296 |
% \indent Option \texttt{proof} is \textbf{obsolete} and should no longer be used. |
| 297 |
% |
| 298 |
% \section{Alternatives\label{sec:Alternatives}} |
| 299 |
% \begin{description} |
| 300 |
% \item[-] \xpackage{regcount}, 1999/08/03, v1.0, by \textsc{Jean-Pierre F. Drucbert}~(\textdied), |
| 301 |
% provides the command |\rgcounts|, which can write the numbers of used registers |
| 302 |
% into the \xfile{log} file anywhere (not only at the end) and does this automatically |
| 303 |
% |\AtBeginDocument| and |\AtEndDocument|. The given number of allocated insertions is |
| 304 |
% \emph{wrong}, because these are not numbered $0$, $1$, $2$\ldots, |
| 305 |
% but start at a high number, which is then decreased (and additionally there are jumps, |
| 306 |
% see \hbox{p. \pageref{insertions}).} The package is compatible with the \xpackage{regstats} package |
| 307 |
% (i.\,e.~you can use both packages at the same time in one document) and available at |
| 308 |
% \url{https://ctan.org/pkg/regcount}. |
| 309 |
% |
| 310 |
% \item[-] One can manually search for the last appearance of |
| 311 |
% |\count|, |\dimen|, |\skip|, |\muskip|, |\box|, |\toks|, |\read| (input), |
| 312 |
% |\write| (output), |\mathgroup| (math family), and |\language|, |
| 313 |
% and find the according number there. This does not provide any information |
| 314 |
% about the number of remaining registers, of course. And it does not work for |
| 315 |
% |\insert|, see \hbox{p. \pageref{insertions}).} |
| 316 |
% \end{description} |
| 317 |
% |
| 318 |
% \bigskip |
| 319 |
% |
| 320 |
% \noindent You programmed or found another alternative, |
| 321 |
% which is available at \url{https://www.CTAN.org/}? |
| 322 |
% OK, send an e-mail to me with the name, location at CTAN, |
| 323 |
% and a short notice, and I will probably include it in the list above. |
| 324 |
% |
| 325 |
% \newpage |
| 326 |
% |
| 327 |
% \section{Example} |
| 328 |
% \begin{macrocode} |
| 329 |
%<*example> |
| 330 |
%% When compiling with LuaLaTeX (and wanting to use option timer=true), |
| 331 |
%% the following line must be uncommented (i.e. remove the "%% "). |
| 332 |
%% \directlua{starttime = os.clock()} |
| 333 |
\documentclass[british]{article} |
| 334 |
\usepackage[left=true,timer=true]{regstats}[2025/01/28]% v1.1b Counting used registers (HMM) |
| 335 |
\ifpdf\ifluatex\else |
| 336 |
\pdfinfo{ |
| 337 |
/Author (H.-Martin Muench) |
| 338 |
/Title (regstats package example) |
| 339 |
/Subject (Example for the regstats package) |
| 340 |
/Keywords (LaTeX;registers;read;write;language;box;dimen;count;toks;muskip;skip;counter;regstats) |
| 341 |
} |
| 342 |
\fi\fi |
| 343 |
%% If you use the hyperref package, use the options of that package |
| 344 |
%% to set the pdf information. |
| 345 |
%% Do NOT use \pdfinfo AND the hyperref package! |
| 346 |
|
| 347 |
%%\usepackage{etex} |
| 348 |
%%\usepackage{morewrites} |
| 349 |
|
| 350 |
\makeatletter |
| 351 |
\newcommand{\stressCounter}[1]{% |
| 352 |
\ifnum\the\count10<#1\relax\else\message{Already \the\count10 \space counters used.} \fi% |
| 353 |
\@tempcnta=0\relax% |
| 354 |
\@whilenum\the\count10<#1\do% |
| 355 |
{\advance\@tempcnta +1\relax% |
| 356 |
\newcounter{TestCounter\the\@tempcnta} \message{counter \the\allocationnumber ^^J}% |
| 357 |
}% |
| 358 |
} |
| 359 |
|
| 360 |
\newcommand{\stressDimen}[1]{% |
| 361 |
\ifnum\the\count11<#1\relax\else\message{Already \the\count11 \space dimens used.} \fi% |
| 362 |
\@tempcnta=0\relax% |
| 363 |
\@whilenum\the\count11<#1\do% |
| 364 |
{\advance\@tempcnta +1\relax% |
| 365 |
\expandafter\newdimen\csname TestDimen\the\@tempcnta\endcsname \message{dimen \the\allocationnumber ^^J}% |
| 366 |
}% |
| 367 |
} |
| 368 |
|
| 369 |
\newcommand{\stressSkip}[1]{\% |
| 370 |
\ifnum\the\count12<#1\relax\else\message{Already \the\count11 \space skips used.} \fi% |
| 371 |
\@tempcnta=0\relax% |
| 372 |
\@whilenum\the\count12<#1\do% |
| 373 |
{\advance\@tempcnta +1\relax% |
| 374 |
\expandafter\newskip\csname TestSkip\the\@tempcnta\endcsname \message{skip \the\allocationnumber ^^J}% |
| 375 |
}% |
| 376 |
} |
| 377 |
|
| 378 |
\newcommand{\stressMuskip}[1]{% |
| 379 |
\ifnum\the\count13<#1\relax\else\message{Already \the\count11 \space muskips used.} \fi% |
| 380 |
\@tempcnta=0\relax% |
| 381 |
\@whilenum\the\count13<#1\do% |
| 382 |
{\advance\@tempcnta +1\relax% |
| 383 |
\expandafter\newmuskip\csname TestMuskip\the\@tempcnta\endcsname \message{muskip \the\allocationnumber ^^J}% |
| 384 |
}% |
| 385 |
} |
| 386 |
|
| 387 |
\newcommand{\stressBox}[1]{% |
| 388 |
\ifnum\the\count14<#1\relax\else\message{Already \the\count11 \space boxes used.} \fi% |
| 389 |
\@tempcnta=0\relax% |
| 390 |
\@whilenum\the\count14<#1\do% |
| 391 |
{\advance\@tempcnta +1\relax% |
| 392 |
\expandafter\newbox\csname TestBox\the\@tempcnta\endcsname \message{box \the\allocationnumber ^^J}% |
| 393 |
}% |
| 394 |
} |
| 395 |
|
| 396 |
\newcommand{\stressToks}[1]{% |
| 397 |
\ifnum\the\count15<#1\relax\else\message{Already \the\count11 \space toks used.} \fi% |
| 398 |
\@tempcnta=0\relax% |
| 399 |
\@whilenum\the\count15<#1\do% |
| 400 |
{\advance\@tempcnta +1\relax% |
| 401 |
\expandafter\newtoks\csname TestToks\the\@tempcnta\endcsname \message{toks \the\allocationnumber ^^J}% |
| 402 |
}% |
| 403 |
} |
| 404 |
|
| 405 |
\newcommand{\stressRead}[1]{% |
| 406 |
\ifnum\the\count16<#1\relax\else\message{Already \the\count11 \space reads used.} \fi% |
| 407 |
\@tempcnta=0\relax% |
| 408 |
\@whilenum\the\count16<#1\do% |
| 409 |
{\advance\@tempcnta +1\relax% |
| 410 |
\expandafter\newread\csname TestRead\the\@tempcnta\endcsname \message{read \the\allocationnumber ^^J}% |
| 411 |
}% |
| 412 |
} |
| 413 |
|
| 414 |
\newcommand{\stressWrite}[1]{% |
| 415 |
\ifnum\the\count17<#1\relax\else\message{Already \the\count11 \space writes used.} \fi% |
| 416 |
\@tempcnta=0\relax% |
| 417 |
\@whilenum\the\count17<#1\do% |
| 418 |
{\advance\@tempcnta +1\relax% |
| 419 |
\expandafter\newwrite\csname TestWrite\the\@tempcnta\endcsname \message{write \the\allocationnumber ^^J}% |
| 420 |
}% |
| 421 |
} |
| 422 |
|
| 423 |
\newcommand{\stressFam}[1]{% |
| 424 |
\ifnum\the\count18<#1\relax\else\message{Already \the\count11 \space fams used.} \fi% |
| 425 |
\@tempcnta=0\relax% |
| 426 |
\@whilenum\the\count18<#1\do% |
| 427 |
{\advance\@tempcnta +1\relax% |
| 428 |
\expandafter\newfam\csname TestFam\the\@tempcnta\endcsname \message{fam \the\allocationnumber ^^J}% |
| 429 |
}% |
| 430 |
} |
| 431 |
|
| 432 |
\newcommand{\stressLanguage}[1]{% |
| 433 |
\ifnum\the\count19<#1\relax\else\message{Already \the\count11 \space languages used.} \fi% |
| 434 |
\@tempcnta=0\relax% |
| 435 |
\@whilenum\the\count19<#1\do% |
| 436 |
{\advance\@tempcnta +1\relax% |
| 437 |
\expandafter\newlanguage\csname TestLanguage\the\@tempcnta\endcsname \message{language \the\allocationnumber ^^J}% |
| 438 |
}% |
| 439 |
} |
| 440 |
|
| 441 |
\newcommand{\stressInsert}[1]{% |
| 442 |
\message{Declaring #1\space ADDITIONAL inserts:}% |
| 443 |
\@tempcnta=0\relax% |
| 444 |
\@whilenum\the\@tempcnta<#1\do% |
| 445 |
{\advance\@tempcnta +1\relax% |
| 446 |
\expandafter\newinsert\csname TestInsert\the\@tempcnta\endcsname% |
| 447 |
\message{insert \the\@tempcnta: \the\allocationnumber^^J}% |
| 448 |
}% |
| 449 |
} |
| 450 |
\makeatother |
| 451 |
|
| 452 |
\listfiles |
| 453 |
\begin{document} |
| 454 |
\pagenumbering{arabic} |
| 455 |
\section*{Example for regstats} |
| 456 |
|
| 457 |
This example demonstrates the use of package\newline |
| 458 |
\textsf{regstats}, v1.1b as of 2025-01-28.\newline |
| 459 |
The used options were \texttt{left=true,timer=true}.\par |
| 460 |
\texttt{left=false,timer=false} would be the defaults.\newline |
| 461 |
|
| 462 |
Regarding the use of |
| 463 |
\makeatletter% |
| 464 |
\ \@ifundefined{eTeX}{\hbox{$\m@th \varepsilon $-\TeX}}{\eTeX}, % |
| 465 |
\makeatother% |
| 466 |
the \texttt{morewrite} package, the reservation of \texttt{insert}s, |
| 467 |
and using more \texttt{math families} please see the documentation!\newline |
| 468 |
|
| 469 |
For the resulting message, please compile \texttt{regstats-example.tex} |
| 470 |
and have a look at the end of its \texttt{.log}-file.\newline |
| 471 |
|
| 472 |
Because the compilation time for this example is usually quite short, |
| 473 |
option \texttt{timer} is not demonstrated very spectacular.\newline |
| 474 |
|
| 475 |
To test a register type for the number of available registers, |
| 476 |
uncomment the respective line below and set the number to an interesting value. |
| 477 |
|
| 478 |
|
| 479 |
\makeatletter |
| 480 |
%%\stressCounter{233} |
| 481 |
%%\stressDimen{233} |
| 482 |
%%\stressSkip{233} |
| 483 |
%%\stressMuskip{255} |
| 484 |
%%\stressBox{233} |
| 485 |
%%\stressToks{255} |
| 486 |
%%\stressRead{15} |
| 487 |
%%\stressWrite{14} |
| 488 |
%%\stressFam{15} |
| 489 |
%%\stressLanguage{255} |
| 490 |
%%\stressInsert{20} |
| 491 |
\makeatother |
| 492 |
|
| 493 |
\end{document} |
| 494 |
%</example> |
| 495 |
% \end{macrocode} |
| 496 |
% |
| 497 |
% \StopEventually{} |
| 498 |
% \newpage |
| 499 |
% |
| 500 |
% \section{The implementation} |
| 501 |
% We start off by checking that we are loading into \LaTeXe{} and |
| 502 |
% announcing the name and version of this package. |
| 503 |
% |
| 504 |
% \begin{macrocode} |
| 505 |
%<*package> |
| 506 |
% \end{macrocode} |
| 507 |
% |
| 508 |
% \begin{macrocode} |
| 509 |
\NeedsTeXFormat{LaTeX2e} |
| 510 |
\ProvidesPackage{regstats}[2025/01/28 v1.1b Counting used registers (HMM)] |
| 511 |
|
| 512 |
% \end{macrocode} |
| 513 |
% |
| 514 |
% A short description of the \xpackage{regstats} package: |
| 515 |
% |
| 516 |
% \begin{macrocode} |
| 517 |
%% Allows to count the number of used registers |
| 518 |
%% (counter, dimen, skip, muskip, box, token, input, output, |
| 519 |
%% math families, languages, insertions) |
| 520 |
%% and compare these to the maximum available number of such registers. |
| 521 |
|
| 522 |
% \end{macrocode} |
| 523 |
% |
| 524 |
% We need the \xpackage{kvoptions} package: |
| 525 |
% |
| 526 |
% \begin{macrocode} |
| 527 |
\RequirePackage{kvoptions}% Key value format for package options (HO) |
| 528 |
|
| 529 |
% \end{macrocode} |
| 530 |
% |
| 531 |
% We process the options: |
| 532 |
% |
| 533 |
% \begin{macrocode} |
| 534 |
\SetupKeyvalOptions{family=regstats,prefix=regstats@} |
| 535 |
\DeclareBoolOption{left}% \regstats@left |
| 536 |
\DeclareBoolOption{timer} |
| 537 |
\DeclareBoolOption{proof}% OBSOLETE |
| 538 |
|
| 539 |
\ProcessKeyvalOptions* |
| 540 |
|
| 541 |
% \end{macrocode} |
| 542 |
% |
| 543 |
% Option |proof| is \textbf{obsolete}: |
| 544 |
% |
| 545 |
% \begin{macrocode} |
| 546 |
\ifregstats@proof |
| 547 |
\PackageWarningNoLine{regstats}{Option proof is obsolete. Please do not use it\MessageBreak% |
| 548 |
when loading the regstats package} |
| 549 |
\else |
| 550 |
\PackageInfo{regstats}{Option proof is obsolete.\MessageBreak% |
| 551 |
If you used proof=false, please remove this\@gobble} |
| 552 |
\fi |
| 553 |
|
| 554 |
% \end{macrocode} |
| 555 |
% |
| 556 |
% We need the \pkg{iftex} package (or its predecessors \pkg{ifpdf}, |
| 557 |
% \pkg{ifetex}, and \pkg{ifluatex}): |
| 558 |
% |
| 559 |
% \begin{macrocode} |
| 560 |
\IfFileExists{iftex.sty}{\RequirePackage{iftex}}{ |
| 561 |
\RequirePackage{ifpdf} |
| 562 |
\RequirePackage{ifetex} |
| 563 |
\RequirePackage{ifluatex} |
| 564 |
} |
| 565 |
|
| 566 |
% \end{macrocode} |
| 567 |
% \pagebreak |
| 568 |
% \begin{macrocode} |
| 569 |
\@ifundefined{ifluatex}{\newif\ifluatex \luatexfalse}{\relax} |
| 570 |
\@ifundefined{ifetex}{\newif\ifetex \etexfalse}{\relax} |
| 571 |
|
| 572 |
% \end{macrocode} |
| 573 |
% |
| 574 |
% Yes, if \hologo{LuaLaTeX} is used without defining |\ifluatex|, |
| 575 |
% then we fail safe with assuming \hologo{LuaLaTeX} is not used. |
| 576 |
% Otherwise everything (|\else|s and |\fi|s) gets mixed up, |
| 577 |
% but \hologo{LuaLaTeX} without |\ifluatex| is really broken. |
| 578 |
% Also if |\ifetex| is unknown, we assume that there is no |
| 579 |
% \hologo{eTeX} available. |
| 580 |
% |
| 581 |
% \medskip |
| 582 |
% |
| 583 |
% Option timer requires some condition: |
| 584 |
% |
| 585 |
% \begin{macrocode} |
| 586 |
\ifregstats@timer |
| 587 |
\ifpdf \RequirePackage{intcalc} |
| 588 |
\else \PackageError{regstats}{Option timer only works with pdf(la)tex\MessageBreak% |
| 589 |
and with lua(la)tex}{Neither appears to be used here.} |
| 590 |
\regstats@timerfalse |
| 591 |
\fi |
| 592 |
\fi |
| 593 |
|
| 594 |
% \end{macrocode} |
| 595 |
% |
| 596 |
% The timer: |
| 597 |
% |
| 598 |
% \begin{macrocode} |
| 599 |
\newcommand{\regst@ts@timer}{\message{^^J}% |
| 600 |
\@tempcnta=0% |
| 601 |
% \end{macrocode} |
| 602 |
% |
| 603 |
% For \hologo{LuaLaTeX}: |
| 604 |
% |
| 605 |
% \begin{macrocode} |
| 606 |
\ifluatex% |
| 607 |
\@tempcnta=% |
| 608 |
\directlua{ |
| 609 |
if starttime then |
| 610 |
tex.sprint((os.clock()-starttime)*65536) |
| 611 |
else |
| 612 |
tex.sprint(0) |
| 613 |
end |
| 614 |
}\relax% |
| 615 |
% \end{macrocode} |
| 616 |
% |
| 617 |
% and for pdf\LaTeX: |
| 618 |
% |
| 619 |
% \begin{macrocode} |
| 620 |
\else \ifpdf \@tempcnta=\the\pdfelapsedtime\relax\fi% |
| 621 |
\fi% |
| 622 |
% \end{macrocode} |
| 623 |
% |
| 624 |
% Checking the result: |
| 625 |
% |
| 626 |
% \begin{macrocode} |
| 627 |
\ifnum \the\@tempcnta = 0% |
| 628 |
\ifluatex% |
| 629 |
\PackageError{regstats}{Did you forget to start the timer?}{% |
| 630 |
Before \string\documentclass\space you need to say\MessageBreak% |
| 631 |
\string\directlua{starttime = os.clock()}}% |
| 632 |
\fi% |
| 633 |
\PackageError{regstats}{Could not determine the time used for compilation}{Reason is unknown.}% |
| 634 |
\else% |
| 635 |
% \end{macrocode} |
| 636 |
% |
| 637 |
% It worked! |
| 638 |
% \pagebreak |
| 639 |
% |
| 640 |
% \begin{macrocode} |
| 641 |
\xdef\regstatselapsedtime{\the\@tempcnta}% |
| 642 |
\divide \@tempcnta by 65536% scaled-seconds -> seconds |
| 643 |
\xdef\regstatsseconds{\the\@tempcnta}% |
| 644 |
\ifnum \regstatsseconds > 59% |
| 645 |
\xdef\regstatsseconds{\intcalcMod{\the\@tempcnta}{60}}% |
| 646 |
\divide \@tempcnta by 60% seconds -> minutes |
| 647 |
\else% |
| 648 |
\@tempcnta=0% minutes = 0 |
| 649 |
\fi% |
| 650 |
\ifnum \regstatsseconds < 10% |
| 651 |
\message{Time elapsed for the last compiler run:^^J% |
| 652 |
about \the\@tempcnta:0\regstatsseconds\space% |
| 653 |
(m:ss; \regstatselapsedtime /65536 s).^^J}% |
| 654 |
\else% |
| 655 |
\message{Time elapsed for the last compiler run:^^J% |
| 656 |
about \the\@tempcnta:\regstatsseconds \space% |
| 657 |
(m:ss; \regstatselapsedtime /65536 s).^^J}% |
| 658 |
\fi% |
| 659 |
\fi% |
| 660 |
} |
| 661 |
|
| 662 |
% \end{macrocode} |
| 663 |
% |
| 664 |
% If the |timer|-option was not used, we do not use the timer: |
| 665 |
% |
| 666 |
% \begin{macrocode} |
| 667 |
\ifregstats@timer\else\renewcommand{\regst@ts@timer}{\relax}\fi |
| 668 |
|
| 669 |
% \end{macrocode} |
| 670 |
% |
| 671 |
% Initialisation of some commands: |
| 672 |
% |
| 673 |
% \begin{macrocode} |
| 674 |
\long\def\regstats@firstofone#1{#1} |
| 675 |
|
| 676 |
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 677 |
|
| 678 |
\let\regst@tsNoeTeX\relax |
| 679 |
|
| 680 |
\xdef\regstats@lft{} |
| 681 |
|
| 682 |
% \end{macrocode} |
| 683 |
% |
| 684 |
% \LaTeXe{} 2011-06-27 changed the |\enddocument| command and thus |
| 685 |
% broke the \pkg{atveryend} package, which was then fixed. |
| 686 |
% If new \LaTeXe{} and old \xpackage{atveryend} are combined, |
| 687 |
% |\AtVeryVeryEnd| will never be called. |
| 688 |
% \LaTeXe{} 2020-10-01 introduced a new hook management. |
| 689 |
% For \LaTeXe-format 2022-11-01 and newer we use hooks instead of |
| 690 |
% loading the \pkg{atveryend} package. |
| 691 |
% |
| 692 |
% \begin{macrocode} |
| 693 |
\IfFormatAtLeastTF{2022/11/01}{ |
| 694 |
\let\regst@ts@statistics\regstats@firstofone% We do not use \AtVeryVeryEnd. |
| 695 |
\newcommand{\regst@ts@st@tistics}[1]{\AddToHook{begindocument}{% |
| 696 |
% \end{macrocode} |
| 697 |
% |
| 698 |
% The \pkg{morewrites} package allows for more writes (see \hbox{p. \pageref{write}):} |
| 699 |
% |
| 700 |
% \begin{macrocode} |
| 701 |
\AddToHook{begindocument/end}{\IfPackageLoadedTF{morewrites}{\def\regs@tsmw{65250}}{% |
| 702 |
\ifluatex\def\regs@tsmw{124}\else\def\regs@tsmw{16}\fi}% |
| 703 |
\AddToHook{enddocument}{\AddToHook{enddocument/afterlastpage}{\AddToHook{enddocument/afteraux}{% |
| 704 |
\AddToHook{enddocument/info}{\AddToHook{enddocument/end}{#1}}}}}}}} |
| 705 |
}{\RequirePackage{atveryend} |
| 706 |
\let\regst@ts@statistics\AtVeryVeryEnd |
| 707 |
\IfFormatAtLeastTF{2011/06/27}{ |
| 708 |
\@ifpackagelater{atveryend}{2011/06/29}{% 2011/06/30, v1.8, or even more recent: OK |
| 709 |
}{% else: older package version, no \AtVeryVeryEnd |
| 710 |
\let\regst@ts@statistics\regstats@firstofone |
| 711 |
} |
| 712 |
}{% else: older fmtversion: also OK |
| 713 |
} |
| 714 |
\newcommand{\regst@ts@st@tistics}[1]{\AtBeginDocument{\AtEndDocument{\AfterLastShipout{\AtVeryEndDocument{% |
| 715 |
\AtEndAfterFileList{#1}}}}}} |
| 716 |
% \end{macrocode} |
| 717 |
% |
| 718 |
% With the |seminar| class or the \pkg{slidesec} package |\AtVeryVeryEnd| must not be used: |
| 719 |
% |
| 720 |
% \begin{macrocode} |
| 721 |
\AtBeginDocument{% |
| 722 |
\@ifclassloaded{seminar}{% no \AtVeryVeryEnd |
| 723 |
\let\regst@ts@statistics\regstats@firstofone}{\relax} |
| 724 |
\@ifpackageloaded{slidesec}{% no \AtVeryVeryEnd |
| 725 |
\let\regst@ts@statistics\regstats@firstofone}{\relax} |
| 726 |
% \end{macrocode} |
| 727 |
% |
| 728 |
% The \pkg{morewrites} package allows for more writes (see \hbox{p. \pageref{write}):} |
| 729 |
% |
| 730 |
% \begin{macrocode} |
| 731 |
\@ifpackageloaded{morewrites}{\def\regs@tsmw{32767}}{\ifluatex\def\regs@tsmw{124}\else\def\regs@tsmw{15}\fi}% |
| 732 |
% \end{macrocode} |
| 733 |
% |
| 734 |
% If neither \eTeX{} is available nor the \pkg{etex} package loaded, |
| 735 |
% the number of available registers is drastically reduced: |
| 736 |
% |
| 737 |
% \begin{macrocode} |
| 738 |
\ifetex\else% |
| 739 |
\@ifpackageloaded{etex}{\relax}{% else |
| 740 |
\gdef\regst@tsNoeTeX{% |
| 741 |
\PackageWarning{regstats}{Neither eTeX nor the e-TeX-package found.\MessageBreak% |
| 742 |
That can mean that e-TeX was disabled or\MessageBreak% |
| 743 |
that your distribution of TeX does not contain e-TeX\MessageBreak% |
| 744 |
or that you simply forgot to say \string\usepackage{etex}\MessageBreak% |
| 745 |
in the preamble of \jobname.tex.\MessageBreak% |
| 746 |
The number of available counter, dimen, skip,\MessageBreak% |
| 747 |
muskip, box, and toks registers as well as the\MessageBreak% |
| 748 |
number of insertions would be larger when using\MessageBreak% |
| 749 |
eTeX or the e-TeX-package;% |
| 750 |
}% |
| 751 |
}% |
| 752 |
}% |
| 753 |
\fi% |
| 754 |
} |
| 755 |
} |
| 756 |
|
| 757 |
% \end{macrocode} |
| 758 |
% \pagebreak |
| 759 |
% \begin{macrocode} |
| 760 |
\regst@ts@st@tistics{% |
| 761 |
\regst@ts@statistics{% |
| 762 |
\xdef\regstats@message{\relax}% |
| 763 |
% \end{macrocode} |
| 764 |
% |
| 765 |
% |\regstats@regstatA| uses three arguments: 1.~the used number of registers |
| 766 |
% of some type, 2.~the \textquotedblleft regular\textquotedblright number |
| 767 |
% of available registers of that type, 3.~that number in case of extended |
| 768 |
% register range (\eTeX). Maximum available minus used registers gives |
| 769 |
% the number of free/currently available registers. |
| 770 |
% |
| 771 |
% \begin{macrocode} |
| 772 |
\newcommand{\regstats@regstatA}[3]{% |
| 773 |
\ifx\regst@tsNoeTeX\relax \xdef\regstats@max{#3}\else\xdef\regstats@max{#2}\fi% |
| 774 |
\@tempcnta=\regstats@max \relax% |
| 775 |
\advance\@tempcnta by -#1\relax% |
| 776 |
\xdef\regstats@free{\the\@tempcnta}% |
| 777 |
}% |
| 778 |
% \end{macrocode} |
| 779 |
% |
| 780 |
% |\regstats@regstatB| gives the singular (2nd~argument) or plural (3rd~argument) |
| 781 |
% of the name of that register type (1st~argument): |
| 782 |
% |
| 783 |
% \begin{macrocode} |
| 784 |
\newcommand{\regstats@regstatB}[3]{% |
| 785 |
\@tempcnta=\regstats@max\relax% |
| 786 |
\advance\@tempcnta by -#1\relax% |
| 787 |
\xdef\regstats@free{\the\@tempcnta}% |
| 788 |
\@tempcnta=#1\relax% |
| 789 |
\ifnum \the\@tempcnta = 0% |
| 790 |
\@tempcnta=2\relax% zero: same as plural |
| 791 |
\fi% |
| 792 |
\ifnum \the\@tempcnta > 1% |
| 793 |
\gdef\regstats@pl{#3}% plural |
| 794 |
\else% |
| 795 |
\gdef\regstats@pl{#2}% singular |
| 796 |
\fi% |
| 797 |
% \end{macrocode} |
| 798 |
% |
| 799 |
% The number of used registers is given as per cent of the available |
| 800 |
% registers of that type: |
| 801 |
% |
| 802 |
% \begin{macrocode} |
| 803 |
\@tempcnta=#1\relax% |
| 804 |
\multiply\@tempcnta by 100\relax% |
| 805 |
\@tempcntb=\regstats@max\relax% |
| 806 |
\divide\@tempcnta by\@tempcntb\relax% |
| 807 |
\xdef\regstats@used{\space(\the\@tempcnta\@percentchar\space used)}% |
| 808 |
% \end{macrocode} |
| 809 |
% |
| 810 |
% If option |left| was chosen, the number of remaining registers of that type is announced: |
| 811 |
% |
| 812 |
% \begin{macrocode} |
| 813 |
\ifregstats@left% |
| 814 |
\ifnum \regstats@free > 0\relax% |
| 815 |
\xdef\regstats@lft{, left: \regstats@free}% |
| 816 |
\else% |
| 817 |
\ifnum \regstats@free = 0\relax% |
| 818 |
\xdef\regstats@lft{, left: \regstats@free !!!}% |
| 819 |
\else% \regstats@free < 0 |
| 820 |
\xdef\regstats@lft{, left: \regstats@free ??? **********}% |
| 821 |
\fi% |
| 822 |
\fi% |
| 823 |
\fi% |
| 824 |
}% |
| 825 |
% \end{macrocode} |
| 826 |
% |
| 827 |
% We now just take the current numbers of the various |count|s: |
| 828 |
% |
| 829 |
% \begin{macrocode} |
| 830 |
\xdef\regstats@counter{\the\count10}% |
| 831 |
\xdef\regstats@dimen{\the\count11}% |
| 832 |
\xdef\regstats@skip{\the\count12}% |
| 833 |
\xdef\regstats@muskip{\the\count13}% |
| 834 |
\xdef\regstats@box{\the\count14}% |
| 835 |
\xdef\regstats@toks{\the\count15}% |
| 836 |
\xdef\regstats@read{\the\count16}% |
| 837 |
\xdef\regstats@write{\the\count17}% |
| 838 |
\xdef\regstats@fam{\the\count18}% |
| 839 |
\xdef\regstats@language{\the\count19}% |
| 840 |
\xdef\regstats@insert{\the\count20}% |
| 841 |
% \end{macrocode} |
| 842 |
% |
| 843 |
% |\countdef\insc@unt=20| is a synonym for the insertion counter.\par |
| 844 |
% |\countdef\allocationnumber=21| is a synonym for the allocation counter |
| 845 |
% |\count21|, which contains the most recently allocated number. |
| 846 |
% For example, if |\newdimen{\regstatsdimen}| allocated a new dimen, |
| 847 |
% and that dimen uses the $48\textsuperscript{th}$~dimen register, then |
| 848 |
% |\count21| contains the $48$.\par |
| 849 |
% |\count22| contains $-1$. |
| 850 |
% \medskip |
| 851 |
% |
| 852 |
% We build the |\regstats@message|: |
| 853 |
% |
| 854 |
% \begin{macrocode} |
| 855 |
\xdef\regstats@message{\regstats@message\message{^^J}}% |
| 856 |
\xdef\regstats@message{\regstats@message\message{Here is how much of TeX's registers you used^^J}}% |
| 857 |
\xdef\regstats@message{\regstats@message\message{\space (numbers of available registers are estimated!):^^J}}% |
| 858 |
% \end{macrocode} |
| 859 |
% |
| 860 |
% While |\xdef\regstats@...{\the\count...}| was used above, |
| 861 |
% if \eTeX{} is available we use another register of that type |
| 862 |
% and look at the register number it received.\par |
| 863 |
% Classic \TeX{} has $2^{8}=256$~registers, |
| 864 |
% \eTeX{} and \XeTeX{} have $2^{15}=32\,768$~registers, |
| 865 |
% and \hologo{LuaLaTeX} has even $2^{15}=65\,536$~registers |
| 866 |
% (for |\count|, |\dimen|, |\skip|, |\muskip|, |\box|, and |\toks|). |
| 867 |
% There are only 16~|\read|s available. |
| 868 |
% |\write|s and |\fam|s were traditionally also 16, |
| 869 |
% see page~\pageref{write} (write) and page~\pageref{families} (families) about using more. |
| 870 |
% |\lang|s are only 256 available. |
| 871 |
% |\insert|s are complicated (see \hbox{p. \pageref{insertions}). --}\ % |
| 872 |
% Each |\newlength| needs a skip register. |
| 873 |
% |
| 874 |
% \medskip |
| 875 |
% |
| 876 |
% \textbf{The counter registers:} |
| 877 |
% |
| 878 |
% \begin{macrocode} |
| 879 |
\regstats@regstatA{\regstats@counter}{255}{32767}% |
| 880 |
\ifetex\newcounter{regstatscount}\xdef\regstats@counter{\the\allocationnumber}\fi% |
| 881 |
\regstats@regstatB{\regstats@counter}{}{s}% |
| 882 |
\xdef\regstats@message{\regstats@message\message{ \regstats@counter\space counter register\regstats@pl\space% |
| 883 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 884 |
% |
| 885 |
% \end{macrocode} |
| 886 |
% \pagebreak |
| 887 |
% |
| 888 |
% \textbf{The dimen registers:} |
| 889 |
% |
| 890 |
% \begin{macrocode} |
| 891 |
\regstats@regstatA{\regstats@dimen}{255}{32767}% |
| 892 |
\ifetex\newdimen{\regstatsdimen}\xdef\regstats@dimen{\the\allocationnumber}\fi% |
| 893 |
\regstats@regstatB{\regstats@dimen}{}{s}% |
| 894 |
\xdef\regstats@message{\regstats@message\message{ \regstats@dimen\space dimen register\regstats@pl\space% |
| 895 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 896 |
% |
| 897 |
% \end{macrocode} |
| 898 |
% |
| 899 |
% \textbf{The skip registers:} |
| 900 |
% |
| 901 |
% \begin{macrocode} |
| 902 |
\regstats@regstatA{\regstats@skip}{255}{32767}% |
| 903 |
\ifetex\newskip\regstatsskip\xdef\regstats@skip{\the\allocationnumber}\fi% |
| 904 |
\regstats@regstatB{\regstats@skip}{}{s}% |
| 905 |
\xdef\regstats@message{\regstats@message\message{ \regstats@skip\space skip register\regstats@pl\space% |
| 906 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 907 |
% |
| 908 |
% \end{macrocode} |
| 909 |
% |
| 910 |
% \textbf{The muskip registers:} |
| 911 |
% |
| 912 |
% \begin{macrocode} |
| 913 |
\regstats@regstatA{\regstats@muskip}{255}{32767}% |
| 914 |
\ifetex\newmuskip\regstatsmuskip\xdef\regstats@muskip{\the\allocationnumber}\fi% |
| 915 |
\regstats@regstatB{\regstats@muskip}{}{s}% |
| 916 |
\xdef\regstats@message{\regstats@message\message{ \regstats@muskip\space muskip register\regstats@pl\space% |
| 917 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 918 |
% |
| 919 |
% \end{macrocode} |
| 920 |
% |
| 921 |
% \textbf{The box registers:} |
| 922 |
% |
| 923 |
% \begin{macrocode} |
| 924 |
\regstats@regstatA{\regstats@box}{255}{32767}% |
| 925 |
\ifetex\newbox\regstatsbox\xdef\regstats@box{\the\allocationnumber}\fi% |
| 926 |
\regstats@regstatB{\regstats@box}{}{s}% |
| 927 |
\xdef\regstats@message{\regstats@message\message{ \regstats@box\space box register\regstats@pl\space% |
| 928 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 929 |
% |
| 930 |
% \end{macrocode} |
| 931 |
% |
| 932 |
% \textbf{The toks registers:} |
| 933 |
% |
| 934 |
% \begin{macrocode} |
| 935 |
\regstats@regstatA{\regstats@toks}{255}{32767}% |
| 936 |
\ifetex\newtoks\regstatstoks\xdef\regstats@toks{\the\allocationnumber}\fi% |
| 937 |
\regstats@regstatB{\regstats@toks}{}{s}% |
| 938 |
\xdef\regstats@message{\regstats@message\message{ \regstats@toks\space toks register\regstats@pl\space% |
| 939 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 940 |
% |
| 941 |
% \end{macrocode} |
| 942 |
% |
| 943 |
% \textbf{The \textquotedblleft read registers\textquotedblright, i.\,e. input streams:} |
| 944 |
% |
| 945 |
% \begin{macrocode} |
| 946 |
\regstats@regstatA{\regstats@read}{15}{15}% |
| 947 |
\ifnum \regstats@free > 0\relax\newread\regstatsread\xdef\regstats@read{\the\allocationnumber}\fi% |
| 948 |
\regstats@regstatB{\regstats@read}{}{s}% |
| 949 |
\xdef\regstats@message{\regstats@message\message{ \regstats@read\space input stream\regstats@pl\space (read) % |
| 950 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 951 |
% |
| 952 |
% \end{macrocode} |
| 953 |
% |
| 954 |
% \phantomsection\label{write} |
| 955 |
% \textbf{The \textquotedblleft write registers\textquotedblright, i.\,e. output streams:}\newline |
| 956 |
% Traditionally, there are $16$~available output streams. Lua\TeX{} increases |
| 957 |
% this to $124$, and the \pkg{morewrites} package even to $65\,250$ for \LaTeX, |
| 958 |
% but not for \hologo{LuaLaTeX}. After write $32\,749\textsuperscript{th}$~write |
| 959 |
% on |\write32767|, morewrites additionally uses one count register |
| 960 |
% for each new write. And after the $65\,250\textsuperscript{th}$~write |
| 961 |
% uses |\count32766|, there is no room for another |\count|, |
| 962 |
% and therefore opening further writes fails. |
| 963 |
% |
| 964 |
% \begin{macrocode} |
| 965 |
\regstats@regstatA{\regstats@write}{15}{\regs@tsmw}% |
| 966 |
\ifnum \regstats@free > 0\relax\newwrite\regstatswrite\xdef\regstats@write{\the\allocationnumber}\fi% |
| 967 |
\regstats@regstatB{\regstats@write}{}{s}% |
| 968 |
\xdef\regstats@message{\regstats@message\message{ \regstats@write\space output stream\regstats@pl\space (write) % |
| 969 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 970 |
% |
| 971 |
% \end{macrocode} |
| 972 |
% |
| 973 |
% \phantomsection\label{families} |
| 974 |
% \textbf{The \textquotedblleft fam registers\textquotedblright, i.\,e. math families:}\newline |
| 975 |
% Traditionally, there are $16$~available math families. \hologo{LuaLaTeX} and \XeLaTeX{} |
| 976 |
% increase this to $256$ (at least since the 2015 release of \LaTeXe). |
| 977 |
% |
| 978 |
% \begin{quotation} |
| 979 |
% \TeX{}, or more exactly the 8-bit versions of \TeX, such as \pdfTeX{}, |
| 980 |
% have a hard limit of~16 on the number of different math font groups |
| 981 |
% (\cs{fam} or \cs{mathgroup}) that can be used in a single formula. For each symbol font |
| 982 |
% declared (by a package or in the preamble) an extra math group is allocated, |
| 983 |
% and the same happens for each math alphabet, (such as \cs{mathbf}) once it |
| 984 |
% gets used anywhere in the document. Up to now, these math |
| 985 |
% alphabet allocations were permanent, even if they were used only once; |
| 986 |
% the result was that in complex documents you |
| 987 |
% could easily run out of available math font groups. |
| 988 |
% The only remedy for this was to |
| 989 |
% define your own math version, which is a complicated and cumbersome process. |
| 990 |
% |
| 991 |
% This situation has now been improved by the introduction of a new counter |
| 992 |
% \texttt{localmathalphabets}: this counter governs how many of |
| 993 |
% the math group slots are assigned locally when a new math |
| 994 |
% alphabet (and a new math group) is needed. |
| 995 |
% |
| 996 |
% Once the current formula is finished, every such further (local) |
| 997 |
% allocation is undone, giving you a fighting chance of being |
| 998 |
% able to use different new math alphabets in the next formula. |
| 999 |
% |
| 1000 |
% The default value of \texttt{localmathalphabets} is 2, |
| 1001 |
% but if you need more local alphabets because of the complexity of your |
| 1002 |
% document, you can set this to a higher value such as 4 or~5. |
| 1003 |
% Setting it even higher is possible, but this would seldom |
| 1004 |
% be useful because many group slots will be taken up by |
| 1005 |
% symbol fonts and such slots are always permanently allocated, |
| 1006 |
% whether used or not.\par |
| 1007 |
% \hfill{}(Undo math alphabet allocations if necessary, in: |
| 1008 |
% \LaTeX{} News, Issue 34, 2021-11-15) |
| 1009 |
% \end{quotation} |
| 1010 |
% |
| 1011 |
% So the number of math family groups should have become less relevant.\newline |
| 1012 |
% |\setcounter{localmathalphabets}{| something larger than 2 |}| |
| 1013 |
% might help in case of issues. (|\stressFam| in the example file |
| 1014 |
% still does not find more than 15 (or 255 with \hologo{LuaLaTeX}) |
| 1015 |
% |\fam|s available, because it (intentionally) does not use anything local. |
| 1016 |
% |
| 1017 |
% \begin{macrocode} |
| 1018 |
\regstats@regstatA{\regstats@fam}{15}{\ifluatex 255 \else 15\fi}% |
| 1019 |
\ifnum \regstats@free > 0\relax\newfam\regstatsfam\xdef\regstats@fam{\the\allocationnumber}\fi% |
| 1020 |
\regstats@regstatB{\regstats@fam}{y}{ies}% |
| 1021 |
\xdef\regstats@message{\regstats@message\message{ \regstats@fam\space math famil\regstats@pl\space (fam) % |
| 1022 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 1023 |
% |
| 1024 |
% \end{macrocode} |
| 1025 |
% \pagebreak |
| 1026 |
% |
| 1027 |
% \textbf{The \textquotedblleft language registers\textquotedblright, i.\,e. language codes:} |
| 1028 |
% |
| 1029 |
% \begin{macrocode} |
| 1030 |
\regstats@regstatA{\regstats@language}{255}{255}% |
| 1031 |
\ifnum \regstats@free > 0\relax\newlanguage\regstatslanguage\xdef\regstats@language{\the\allocationnumber}\fi% |
| 1032 |
\regstats@regstatB{\regstats@language}{}{s}% |
| 1033 |
\xdef\regstats@message{\regstats@message\message{ \regstats@language\space language code\regstats@pl\space% |
| 1034 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 1035 |
% |
| 1036 |
% \end{macrocode} |
| 1037 |
% |
| 1038 |
% \phantomsection\label{insertions}% |
| 1039 |
% \textbf{The \textquotedblleft insert registers\textquotedblright, i.\,e.~insertions:}\newline |
| 1040 |
% \textquotedblleft Inserts are given numbers $254$, $253$, etc., |
| 1041 |
% since they require a |\count|, |\dimen|, |\skip|, and |\box| |
| 1042 |
% all with the same number\textquotedblright{} (source2e.pdf, |
| 1043 |
% File~02: ltplain.dtx Date:~2024/02/08 Version~v2.3j).\newline |
| 1044 |
% Because counter, dimen, skip, and box registers are also used independently |
| 1045 |
% from inserts, it can be expected to have no room for a new insert long before |
| 1046 |
% the 255 inserts are used.\medskip |
| 1047 |
% |
| 1048 |
% When testing, the first |\newinsert| registered into |\insert199|, |
| 1049 |
% followed by |\insert198|, \ldots, |\insert185|, and then apparently some |
| 1050 |
% |\count|, |\dimen|, |\skip|, or |\box| register was not available for |
| 1051 |
% |\insert184|. Therefore the |\newinsert| registered into |\insert252|, |
| 1052 |
% followed by |\insert251|, \ldots, |\insert201|, and then the already |
| 1053 |
% used insert registers were reached and there was |
| 1054 |
% |! No room for a new \insert|.\medskip |
| 1055 |
% |
| 1056 |
% With \hologo{LuaLaTeX} after |\insert183|~(!) the next |\newinsert| registered |
| 1057 |
% into |\insert252|, followed by |\insert251|, \ldots, |\insert201|, |
| 1058 |
% and then the next |\newinsert| registered into |\insert65534|, |
| 1059 |
% followed by |\insert65533|, \ldots, |\insert318|, and then there was |
| 1060 |
% |! No room for a new \insert|. (\LaTeX-format before 2023-06-01 erroneously |
| 1061 |
% assigned some inserts twice~-- use a current format!)\medskip |
| 1062 |
% |
| 1063 |
% Historic versions of \LaTeX{} were limited to less registers, |
| 1064 |
% therefore it was possible to |\usepackage{etex} \reserveinserts{17}|, |
| 1065 |
% in order to reserve room for up to 17 (or another number given) |
| 1066 |
% additional insertion classes, that will not be taken away by |
| 1067 |
% |\newcount|, |\newdimen|, |\newskip|, or |\newbox|. |
| 1068 |
% For resent \LaTeX-versions this is neither necessary nor recommendable: |
| 1069 |
% do not use the etex-package. (It would \emph{reduce} the number of |
| 1070 |
% available insers!)\medskip |
| 1071 |
% |
| 1072 |
% When the inserts are needed for floats, the |
| 1073 |
% \href{https://ctan.org/pkg/morefloats}{morefloats} package can be used |
| 1074 |
% to \textquotedblleft increased the number of inserts available |
| 1075 |
% to the float mechanism\textquotedblright{} (\url{https://texfaq.org/FAQ-noroom}% |
| 1076 |
% \ at 2025-01-28). At the last given url \textquotedblleft No room for a new |
| 1077 |
% \guillemetright thing\guillemetleft\textquotedblright{} is treated. |
| 1078 |
% |
| 1079 |
% \begin{macrocode} |
| 1080 |
\ifx\regst@tsNoeTeX\relax% |
| 1081 |
\newinsert\regstatsinsert% |
| 1082 |
\xdef\regstats@insert{\the\allocationnumber}% |
| 1083 |
\xdef\regstats@max{200}% |
| 1084 |
\ifnum \regstats@insert < \regstats@max\relax% |
| 1085 |
\xdef\regstats@free{\regstats@insert}% |
| 1086 |
\@tempcnta=200\relax% |
| 1087 |
\advance\@tempcnta by -\regstats@insert\relax% |
| 1088 |
\xdef\regstats@insert{\the\@tempcnta}% |
| 1089 |
\regstats@regstatB{\regstats@insert}{}{s}% |
| 1090 |
\xdef\regstats@message{\regstats@message\message{ \regstats@insert\space insertion\regstats@pl\space% |
| 1091 |
out of \regstats@max\regstats@used\regstats@lft ^^J}}% |
| 1092 |
\else% |
| 1093 |
\ifnum \regstats@insert = 200\relax% |
| 1094 |
\xdef\regstats@message{\regstats@message\message{Number of insertions could not be calculated. ^^J}}% |
| 1095 |
\else% |
| 1096 |
\ifnum % \regstats@insert > 200 AND % |
| 1097 |
\regstats@insert < 253\relax% |
| 1098 |
\@tempcnta=253\relax% |
| 1099 |
\advance\@tempcnta by -\regstats@insert\relax% |
| 1100 |
\@tempcntb=-200\relax% |
| 1101 |
\advance\@tempcntb by \regstats@insert\relax% |
| 1102 |
\ifluatex% |
| 1103 |
\@tempcntb=-65534\relax% |
| 1104 |
\advance\@tempcntb by \regstats@insert\relax% |
| 1105 |
\xdef\regstats@message{\regstats@message\message{at least \the\@tempcnta\space insertions out of 253 used, % |
| 1106 |
about 65 000 left ^^J}}% |
| 1107 |
\else% |
| 1108 |
\xdef\regstats@message{\regstats@message\message{at least \the\@tempcnta\space insertions out of 253 used, % |
| 1109 |
maybe \the\@tempcntb\space left ^^J}}% |
| 1110 |
\fi% |
| 1111 |
\else% \regstats@insert > 252, LuaTeX |
| 1112 |
\@tempcntb=65534\relax% |
| 1113 |
\advance\@tempcntb by -\regstats@insert\relax% |
| 1114 |
\advance\@tempcntb by -253\relax% |
| 1115 |
\xdef\regstats@message{\regstats@message\message{a lot of insertions out of 65 534 used, % |
| 1116 |
about \the\@tempcntb\space left ^^J}}% |
| 1117 |
\fi% |
| 1118 |
\fi% |
| 1119 |
\fi% |
| 1120 |
\else% |
| 1121 |
\xdef\regstats@max{101}% |
| 1122 |
\@tempcnta=\regstats@max\relax% |
| 1123 |
\advance\@tempcnta by -\regstats@insert\relax% |
| 1124 |
\xdef\regstats@insert{\the\@tempcnta}% |
| 1125 |
\@tempcnta=\regstats@max\relax% |
| 1126 |
\advance\@tempcnta by -\regstats@insert\relax% |
| 1127 |
\xdef\regstats@free{\the\@tempcnta}% |
| 1128 |
\regstats@regstatB{\regstats@insert}{}{s}% |
| 1129 |
\xdef\regstats@message{\regstats@message\message{ \regstats@insert\space insertion\regstats@pl\space out of % |
| 1130 |
\regstats@max\regstats@used\regstats@lft ^^J}}% |
| 1131 |
\xdef\regstats@message{\regstats@message\message{* The number of available inserts might be increased by using % |
| 1132 |
\string\reserveinserts .^^J}}% |
| 1133 |
\fi% |
| 1134 |
% \end{macrocode} |
| 1135 |
% |
| 1136 |
% The construction of the message is now finished, the message is delivered: |
| 1137 |
% |
| 1138 |
% \begin{macrocode} |
| 1139 |
\regstats@message% |
| 1140 |
% \end{macrocode} |
| 1141 |
% \pagebreak |
| 1142 |
% |
| 1143 |
% A note about morewrites: |
| 1144 |
% |
| 1145 |
% \begin{macrocode} |
| 1146 |
\ifluatex% |
| 1147 |
\else% |
| 1148 |
\def\regs@wmst{16}% |
| 1149 |
\ifx\regs@tsmw\regs@wmst\relax% |
| 1150 |
\message{The morewrites package was not loaded.^^J}% |
| 1151 |
\message{\space With recent LaTeX and morewrites about 32 766 output streams would be available.^^J}% |
| 1152 |
\fi% |
| 1153 |
\fi% |
| 1154 |
% \end{macrocode} |
| 1155 |
% |
| 1156 |
% If neither \eTeX{} nor the e-\TeX-package was found, |
| 1157 |
% the respective warning is given: |
| 1158 |
% |
| 1159 |
% \begin{macrocode} |
| 1160 |
\regst@tsNoeTeX% |
| 1161 |
% \end{macrocode} |
| 1162 |
% |
| 1163 |
% When option |timer| (or |timer=true|) was used, the \xpackage{regstats} package |
| 1164 |
% additionally gives the time, which was needed for the (last) compilation (run). |
| 1165 |
% When more than one compilation run is necessary to compile the document, |
| 1166 |
% the individual times have to be added up manually. |
| 1167 |
% If~|\pdfelapsedtime| was reset by another package, the result is not correct, |
| 1168 |
% of course, but unfortunately it is not possible to check for this. You could say |
| 1169 |
% |\def\pdfresettimer{\relax}| immediately after |\documentclass[...]{...}| |
| 1170 |
% to prevent this. Better use\newline |
| 1171 |
% |\long\def\pdfresettimer{%|\newline |
| 1172 |
% \ |\PackageError{regstats}{\string\pdfresettimer\space used}}|\newline |
| 1173 |
% to be notified thereof. This redefinition could be implemented in this |
| 1174 |
% \xpackage{regstats} package, but this would have no effect for the use of |
| 1175 |
% |\pdfresettimer| before this package is called. Because this package |
| 1176 |
% should be called as late as immediately before |\begin{document}|, this would mean |
| 1177 |
% that resetting would be possible during the whole loading of all packages. |
| 1178 |
% |
| 1179 |
% |\pdfelapsedtime| is not available when |lua(la)tex| is used instead of |
| 1180 |
% |pdf(la)tex| to compile the document. In that case at the very beginning |
| 1181 |
% of your \xfile{tex} file say\newline |
| 1182 |
% \verb|\directlua{starttime = os.clock()}|\newline |
| 1183 |
% (even before |\documentclass|!), and the \texttt{timer} option can also |
| 1184 |
% be used with \hologo{LuaLaTeX}. When neither |lualatex| nor |pdflatex| is used to |
| 1185 |
% compile the document, the timer(-option) does not work. |
| 1186 |
% |
| 1187 |
% \begin{macrocode} |
| 1188 |
\regst@ts@timer% |
| 1189 |
}% |
| 1190 |
} |
| 1191 |
|
| 1192 |
%</package> |
| 1193 |
% \end{macrocode} |
| 1194 |
% \pagebreak |
| 1195 |
% |
| 1196 |
% \section{Installation} |
| 1197 |
% \subsection{Downloads} |
| 1198 |
% Everything is available at \url{https://ctan.org}, |
| 1199 |
% but may need additional packages themselves.\bigskip |
| 1200 |
% |
| 1201 |
% \DescribeMacro{regstats.dtx} |
| 1202 |
% For unpacking the |regstats.dtx| file and constructing the documentation |
| 1203 |
% it is required: |
| 1204 |
% \begin{description} |
| 1205 |
% \item[-] \TeX-Format \LaTeXe{}: \url{https://www.CTAN.org/} |
| 1206 |
% |
| 1207 |
% \item[-] document class \xpackage{ltxdoc}, 2024/02/08, v2.1j, \url{https://ctan.org/pkg/ltxdoc} |
| 1208 |
% |
| 1209 |
% \item[-] package \xpackage{geometry}, 2020/01/02, v5.9, \url{https://ctan.org/pkg/geometry} |
| 1210 |
% |
| 1211 |
% \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, \url{https://ctan.org/pkg/holtxdoc} |
| 1212 |
% |
| 1213 |
% \item[-] package \xpackage{fontenc}, 2021/04/29, v2.0v, \url{https://ctan.org/pkg/fontenc} |
| 1214 |
% \end{description} |
| 1215 |
% |
| 1216 |
% \DescribeMacro{regstats.sty} |
| 1217 |
% The |regstats.sty| for \LaTeXe{} (i.\,e.~each document using |
| 1218 |
% the \xpackage{regstats} package) requires: |
| 1219 |
% \begin{description} |
| 1220 |
% \item[-] \TeX Format \LaTeXe{}, \url{https://www.CTAN.org/} |
| 1221 |
% |
| 1222 |
% \item[-] package \xpackage{kvoptions}, 2022-06-15, v3.15, \url{http://ctan.org/pkg/kvoptions} |
| 1223 |
% |
| 1224 |
% \item[-] package \xpackage{iftex}, \url{http://ctan.org/pkg/iftex}, or, if that is not available, |
| 1225 |
% \begin{description} |
| 1226 |
% \item[+] package \xpackage{ifpdf}, \url{http://ctan.org/pkg/ifpdf} |
| 1227 |
% \item[+] package \xpackage{ifetex}, \url{http://ctan.org/pkg/ifetex} |
| 1228 |
% \item[+] package \xpackage{ifluatex}, \url{http://ctan.org/pkg/ifluatex} |
| 1229 |
% \end{description} |
| 1230 |
% |
| 1231 |
% \item[-] only for old \LaTeX-formats the \xpackage{atveryend} package is used, |
| 1232 |
% \url{https://ctan.org/pkg/atveryend}, otherwise that package is not loaded but |
| 1233 |
% the new hook management is used. |
| 1234 |
% |
| 1235 |
% \item[-] package \xpackage{regstats}, 2025-01-28, v1.1b, \url{https://ctan.org/pkg/regstats}\newline |
| 1236 |
% (Because you are reading the documentation for the |
| 1237 |
% \xpackage{pagecolor} package, it can be assumed that you already |
| 1238 |
% have some version of it~-- is it the current one?) |
| 1239 |
% \end{description} |
| 1240 |
% |
| 1241 |
% When option |timer| is used, additionally |
| 1242 |
% \begin{description} |
| 1243 |
% \item[-] package \xpackage{intcalc}, \url{https://ctan.org/pkg/intcalc} |
| 1244 |
% \end{description} |
| 1245 |
% is needed.\bigskip |
| 1246 |
% |
| 1247 |
% \DescribeMacro{regstats-example.tex} |
| 1248 |
% The |regstats-example.tex| requires the same files as all |
| 1249 |
% documents using the \xpackage{regstats} package |
| 1250 |
% (see preceding paragraph |regstats.sty|) and additionally: |
| 1251 |
% \begin{description} |
| 1252 |
% \item[-] class \xpackage{article}, 2022/07/02, v1.4n, from \xpackage{classes}: % |
| 1253 |
% \url{https://ctan.org/pkg/classes} |
| 1254 |
% \end{description} |
| 1255 |
% \pagebreak |
| 1256 |
% |
| 1257 |
% \DescribeMacro{Alternative} |
| 1258 |
% \DescribeMacro{regcount} |
| 1259 |
% As possible alternative in section~\ref{sec:Alternatives} there is listed |
| 1260 |
% \begin{description} |
| 1261 |
% \item[-] package \xpackage{regcount}, 1999/08/03, v1.0, \url{https://ctan.org/pkg/regcount}, |
| 1262 |
% which gives the wrong number for insertions, because it uses |\the\count20|, |
| 1263 |
% but insertions are \emph{not} allocated from 0 upwards but starting at a higher number moving downward |
| 1264 |
% (and having some jumps to other number ranges, see \hbox{p. \pageref{insertions}).} |
| 1265 |
% \end{description} |
| 1266 |
% |
| 1267 |
% \DescribeMacro{Oberdiek} |
| 1268 |
% \DescribeMacro{holtxdoc} |
| 1269 |
% \DescribeMacro{kvoptions} |
| 1270 |
% All packages of the `oberdiek' bundle |
| 1271 |
% (especially \xpackage{holtxdoc} and \xpackage{kvoptions}) |
| 1272 |
% are also available in a TDS compliant ZIP archive:\newline |
| 1273 |
% \url{https://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}. |
| 1274 |
% It is probably best to download and use this, because the packages in there |
| 1275 |
% are quite probably both recent and compatible among themselves. |
| 1276 |
% |
| 1277 |
% \DescribeMacro{hyperref} |
| 1278 |
% \noindent \xpackage{hyperref} is not included in that bundle and needs to be |
| 1279 |
% downloaded separately,\newline |
| 1280 |
% \url{https://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}. |
| 1281 |
% |
| 1282 |
% \DescribeMacro{atveryend} |
| 1283 |
% \noindent \xpackage{atveryend} is only loaded for and used with old \LaTeX-formats, |
| 1284 |
% otherwise that package is not loaded but the new hook management is used. |
| 1285 |
% The \xpackage{atveryend} package is available from |
| 1286 |
% \url{https://mirrors.ctan.org/macros/latex/contrib/atveryend.zip} |
| 1287 |
% |
| 1288 |
% \DescribeMacro{intcalc} |
| 1289 |
% \noindent \xpackage{intcalc} is available from |
| 1290 |
% \url{https://mirrors.ctan.org/install/macros/latex/contrib/intcalc.tds.zip}. |
| 1291 |
% |
| 1292 |
% \DescribeMacro{iftex} |
| 1293 |
% \DescribeMacro{ifetex} |
| 1294 |
% \DescribeMacro{ifluatex} |
| 1295 |
% \DescribeMacro{ifpdf} |
| 1296 |
% \noindent \xpackage{iftex} is available from |
| 1297 |
% \url{https://mirrors.ctan.org/install/macros/generic/iftex.tds.zip}, |
| 1298 |
% its predecessors \xpackage{ifetex}, \xpackage{ifluatex}, and \xpackage{ifpdf} |
| 1299 |
% are no longer officially available for separate download. |
| 1300 |
% |
| 1301 |
% \vskip 1cm |
| 1302 |
% |
| 1303 |
% \DescribeMacro{Münch} |
| 1304 |
% A hyperlinked list of my (other) packages can be found at |
| 1305 |
% \url{https://ctan.org/author/muench-hm}.\bigskip |
| 1306 |
% |
| 1307 |
% \subsection{Package, unpacking TDS} |
| 1308 |
% \paragraph{Package.} This package is available on \url{https://www.CTAN.org}. |
| 1309 |
% \begin{description} |
| 1310 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/regstats/regstats.dtx}]\ % |
| 1311 |
% The source file. |
| 1312 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/regstats/regstats.pdf}]\ % |
| 1313 |
% The documentation. |
| 1314 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/regstats/regstats-example.pdf}]\ % |
| 1315 |
% The compiled example file. |
| 1316 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/regstats/regstats-example.log}]\ % |
| 1317 |
% A \xfile{log} file for the example. |
| 1318 |
% \item[\url{https://mirror.ctan.org/macros/latex/contrib/regstats/README}]\ % |
| 1319 |
% The README file. |
| 1320 |
% \end{description} |
| 1321 |
% |
| 1322 |
% There is also a |regstats.tds.zip| available: |
| 1323 |
% \begin{description} |
| 1324 |
% \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/regstats.tds.zip}]\ % |
| 1325 |
% Everything in TDS compliant, compiled format. |
| 1326 |
% \end{description} |
| 1327 |
% which additionally contains\newline |
| 1328 |
% \begin{tabular}{ll} |
| 1329 |
% regstats.ins & The installation file.\\ |
| 1330 |
% regstats.drv & The driver to generate the documentation.\\ |
| 1331 |
% regstats.sty & The \xext{sty}le file.\\ |
| 1332 |
% regstats-example.tex & The example file.\\ |
| 1333 |
% regstats-example.log & A \xfile{log} file for the example. |
| 1334 |
% \end{tabular} |
| 1335 |
% |
| 1336 |
% \bigskip |
| 1337 |
% |
| 1338 |
% \noindent For required other packages please see the preceding subsection. |
| 1339 |
% |
| 1340 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 1341 |
% \docstrip{} archive. The files are extracted by running the |
| 1342 |
% \xext{dtx} through \plainTeX{}: |
| 1343 |
% \begin{quote} |
| 1344 |
% \verb|tex regstats.dtx| |
| 1345 |
% \end{quote} |
| 1346 |
% |
| 1347 |
% About generating the documentation see paragraph~\ref{GenDoc} below.\bigskip |
| 1348 |
% |
| 1349 |
% \paragraph{TDS.} Now the different files must be moved into |
| 1350 |
% the different directories in your installation TDS tree |
| 1351 |
% (also known as \xfile{texmf} tree): |
| 1352 |
% \begin{quote} |
| 1353 |
% \def\t{^^A |
| 1354 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1355 |
% regstats.sty & tex/latex/regstats/regstats.sty\\ |
| 1356 |
% regstats.pdf & doc/latex/regstats/regstats.pdf\\ |
| 1357 |
% regstats-example.tex & doc/latex/regstats/regstats-example.tex\\ |
| 1358 |
% regstats-example.pdf & doc/latex/regstats/regstats-example.pdf\\ |
| 1359 |
% regstats-example.log & doc/latex/regstats/regstats-example.log\\ |
| 1360 |
% regstats.dtx & source/latex/regstats/regstats.dtx |
| 1361 |
% \end{tabular}^^A |
| 1362 |
% }^^A |
| 1363 |
% \sbox0{\t}^^A |
| 1364 |
% \ifdim\wd0>\linewidth |
| 1365 |
% \begingroup |
| 1366 |
% \advance\linewidth by\leftmargin |
| 1367 |
% \advance\linewidth by\rightmargin |
| 1368 |
% \edef\x{\endgroup |
| 1369 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1370 |
% }\x |
| 1371 |
% \def\lwbox{^^A |
| 1372 |
% \leavevmode |
| 1373 |
% \hbox to \linewidth{^^A |
| 1374 |
% \kern-\leftmargin\relax |
| 1375 |
% \hss |
| 1376 |
% \usebox0 |
| 1377 |
% \hss |
| 1378 |
% \kern-\rightmargin\relax |
| 1379 |
% }^^A |
| 1380 |
% }^^A |
| 1381 |
% \ifdim\wd0>\lw |
| 1382 |
% \sbox0{\small\t}^^A |
| 1383 |
% \ifdim\wd0>\linewidth |
| 1384 |
% \ifdim\wd0>\lw |
| 1385 |
% \sbox0{\footnotesize\t}^^A |
| 1386 |
% \ifdim\wd0>\linewidth |
| 1387 |
% \ifdim\wd0>\lw |
| 1388 |
% \sbox0{\scriptsize\t}^^A |
| 1389 |
% \ifdim\wd0>\linewidth |
| 1390 |
% \ifdim\wd0>\lw |
| 1391 |
% \sbox0{\tiny\t}^^A |
| 1392 |
% \ifdim\wd0>\linewidth |
| 1393 |
% \lwbox |
| 1394 |
% \else |
| 1395 |
% \usebox0 |
| 1396 |
% \fi |
| 1397 |
% \else |
| 1398 |
% \lwbox |
| 1399 |
% \fi |
| 1400 |
% \else |
| 1401 |
% \usebox0 |
| 1402 |
% \fi |
| 1403 |
% \else |
| 1404 |
% \lwbox |
| 1405 |
% \fi |
| 1406 |
% \else |
| 1407 |
% \usebox0 |
| 1408 |
% \fi |
| 1409 |
% \else |
| 1410 |
% \lwbox |
| 1411 |
% \fi |
| 1412 |
% \else |
| 1413 |
% \usebox0 |
| 1414 |
% \fi |
| 1415 |
% \else |
| 1416 |
% \lwbox |
| 1417 |
% \fi |
| 1418 |
% \else |
| 1419 |
% \usebox0 |
| 1420 |
% \fi |
| 1421 |
% \end{quote} |
| 1422 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1423 |
% TDS installing feature, then some files can already be in the right |
| 1424 |
% place, see the documentation of \docstrip{}. |
| 1425 |
% |
| 1426 |
% \subsection{Refresh file name databases} |
| 1427 |
% |
| 1428 |
% If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on |
| 1429 |
% file name databases, you must refresh these. For example, \TeX\,Live\ users |
| 1430 |
% run \verb|texhash| or \verb|mktexlsr|. |
| 1431 |
% |
| 1432 |
% \subsection{Some details for the interested} |
| 1433 |
% \paragraph{Unpacking with \LaTeX{}.} |
| 1434 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1435 |
% \begin{description} |
| 1436 |
% \item[\plainTeX:] Run \docstrip{} and extract the files. |
| 1437 |
% \item[\LaTeX:] Generate the documentation. |
| 1438 |
% \end{description} |
| 1439 |
% If you insist on using \LaTeX{} for \docstrip{} (really, |
| 1440 |
% \docstrip{} does not need \LaTeX ), then inform the auto-detect routine |
| 1441 |
% about your intention: |
| 1442 |
% \begin{quote} |
| 1443 |
% \verb|latex \let\install=y\input{regstats.dtx}| |
| 1444 |
% \end{quote} |
| 1445 |
% Do not forget to quote the argument according to the demands |
| 1446 |
% of your shell. |
| 1447 |
% |
| 1448 |
% \paragraph{Generating the documentation.\label{GenDoc}} |
| 1449 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1450 |
% the documentation. The process can be configured by a |
| 1451 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put the following |
| 1452 |
% line into this file, if you want to have A4 as paper format: |
| 1453 |
% \begin{quote} |
| 1454 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1455 |
% \end{quote} |
| 1456 |
% |
| 1457 |
% \noindent An example follows how to generate the |
| 1458 |
% documentation with \pdfLaTeX : |
| 1459 |
% |
| 1460 |
% \begin{quote} |
| 1461 |
%\begin{verbatim} |
| 1462 |
%pdflatex regstats.dtx |
| 1463 |
%makeindex -s gind.ist regstats.idx |
| 1464 |
%pdflatex regstats.dtx |
| 1465 |
%makeindex -s gind.ist regstats.idx |
| 1466 |
%pdflatex regstats.dtx |
| 1467 |
%\end{verbatim} |
| 1468 |
% \end{quote} |
| 1469 |
% |
| 1470 |
% \subsection{Compiling the example} |
| 1471 |
% |
| 1472 |
% The example file, \textsf{regstats-example.tex}, can be compiled via\newline |
| 1473 |
% |(pdf)(la)tex regstats-example.tex|\newline |
| 1474 |
% or (after removing the |%% | before |\directlua{starttime = os.clock()}| |
| 1475 |
% in the line before |\documentclass|\ldots) via\newline |
| 1476 |
% |lua(la)tex regstats-example.tex|.\bigskip |
| 1477 |
% |
| 1478 |
% \section{Acknowledgements} |
| 1479 |
% |
| 1480 |
% I would like to thank \textsc{Heiko Oberdiek} for providing a lot of |
| 1481 |
% useful packages (from which I also got everything I know about creating |
| 1482 |
% a file in \xext{dtx} format, OK, say it: copying), |
| 1483 |
% \textsc{Jean-Pierre F. Drucbert}~(\textdied) for his \xpackage{regcount} package, |
| 1484 |
% \textsc{Robin Fairbairns} for pointing me to the \xpackage{regcount} package. |
| 1485 |
% |
| 1486 |
% \phantomsection |
| 1487 |
% \begin{History}\label{History} |
| 1488 |
% \begin{Version}{2011/05/14 v1.0a} |
| 1489 |
% \item Upload to CTAN. |
| 1490 |
% \end{Version} |
| 1491 |
% \begin{Version}{2011/05/16 v1.0b} |
| 1492 |
% \item Fixed a name clash with \xfile{regcount} package. |
| 1493 |
% \item \xfile{regcount} package listed as possible alternative. |
| 1494 |
% \item Bug: |skip| and |muskip| mixed up, fixed. |
| 1495 |
% \item Counting of skips, math families, and insertions added. |
| 1496 |
% \item Bug fix: insertions are numbered high to low. |
| 1497 |
% \item Option |proof| added [obsolete now]. |
| 1498 |
% \end{Version} |
| 1499 |
% \begin{Version}{2011/06/08 v1.0c} |
| 1500 |
% \item Bug Fix: Number of available |\skip| registers with \eTeX{}. |
| 1501 |
% \item Change in \eTeX{}-detection. |
| 1502 |
% \item New option |left|. |
| 1503 |
% \end{Version} |
| 1504 |
% \begin{Version}{2011/06/18 v1.0d} |
| 1505 |
% \item Bug Fix: Information about used registers/counters fixed. |
| 1506 |
% \item New option |timer|. |
| 1507 |
% \end{Version} |
| 1508 |
% \begin{Version}{2011/08/22 v1.0e} |
| 1509 |
% \item The information about the used registers is now presented even later. |
| 1510 |
% \item Quite some details in the documentation. |
| 1511 |
% \item Hot fix: \TeX{} 2011/06/27 has changed |\enddocument| and |
| 1512 |
% thus broken the |\AtVeryVeryEnd| command/hooking |
| 1513 |
% of \xpackage{atveryend} package as of 2011/04/23, v1.7. |
| 1514 |
% Until it is fixed, |\AtEndAfterFileList| \emph{was} used. |
| 1515 |
% \end{Version} |
| 1516 |
% \begin{Version}{2011/08/23 v1.0f} |
| 1517 |
% \item The \xpackage{atveryend} package was fixed (2011/06/30, v.1.8). |
| 1518 |
% Now \xpackage{regstats} differentiates according to \TeX{} format |
| 1519 |
% and \xpackage{atveryend} package version. 2011/06/30, v.1.8 |
| 1520 |
% should become available at CTAN soon. \xpackage{regstats} also |
| 1521 |
% works with the old version, the information is just presented |
| 1522 |
% a little bit earlier during compilation, thus theoretically |
| 1523 |
% there could be missed some register use after that information, |
| 1524 |
% which would be obvious in the \xfile{log}-file.~-- |
| 1525 |
% [\xpackage{atveryend} is no longer used after v1.0i of regstats, |
| 1526 |
% when a recent \LaTeX-format with hook-management is used.] |
| 1527 |
% \end{Version} |
| 1528 |
% \begin{Version}{2012/01/01 v1.0g} |
| 1529 |
% \item Now supports (but does not require) \hologo{LuaLaTeX} for option \texttt{timer}. |
| 1530 |
% \item Bug fix: wrong path given in the documentation, fixed. |
| 1531 |
% \item Due to the use of temporary counters, no longer a new counter is used |
| 1532 |
% (except when option \texttt{proof=true} is chosen, of course). [deprecated now] |
| 1533 |
% \item Circumvention of the incompatibility of the \xpackage{atveryend} |
| 1534 |
% package with \xclass{seminar} class and \xpackage{slidesec} package |
| 1535 |
% introduced. |
| 1536 |
% \item Quite some additional changes in the \xfile{dtx} and README files. |
| 1537 |
% \end{Version} |
| 1538 |
% \begin{Version}{2012/01/07 v1.0h} |
| 1539 |
% \item Bug fix: |\ifluatex| undefined without \xpackage{ifluatex} leads to wrong |
| 1540 |
% association of |\else|\ldots|\fi|. Fixed by moving |\ifregstats@timer|. |
| 1541 |
% \end{Version} |
| 1542 |
% \begin{Version}{2012/04/01 v1.0i} |
| 1543 |
% \item Bug fix: removed |.| before |on line|. |
| 1544 |
% \item Bug fix: removed a |\pagebreak| after the first line of a page |
| 1545 |
% from the documentation. |
| 1546 |
% \item Bug fix: added a lot of |%|-signs at the end of lines in the code. |
| 1547 |
% \item This version has been archived at |
| 1548 |
% \url{https://web.archive.org/web/20170107053910/https://mirrors.ctan.org/install/macros/latex/contrib/regstats.tds.zip}. |
| 1549 |
% \end{Version} |
| 1550 |
% \begin{Version}{2023-04-04 v1.1a} |
| 1551 |
% \item No longer uses the \pkg{atveryend} package for new \LaTeX-format but its hook-management. |
| 1552 |
% \item No longer uses the \pkg{ltxcmds} package (but it is still loaded by the \xpackage{kvoptions} package). |
| 1553 |
% \item No longer uses the deprecated |\BeforeClearDocument|. |
| 1554 |
% \item Option proof is now deprecated. |
| 1555 |
% \item Converted to UTF-8. |
| 1556 |
% \item Added |\stress...| commands to the example. |
| 1557 |
% \item Updates to documentation and README. |
| 1558 |
% \end{Version} |
| 1559 |
% \begin{Version}{2025-01-28 v1.1b} |
| 1560 |
% \item Documentation update for \LaTeX -format 2024-11-01. |
| 1561 |
% \end{Version} |
| 1562 |
% \end{History} |
| 1563 |
% |
| 1564 |
% \bigskip |
| 1565 |
% |
| 1566 |
% When you find a mistake or have a suggestion for an improvement of this package, |
| 1567 |
% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) |
| 1568 |
% |
| 1569 |
% \bigskip |
| 1570 |
% |
| 1571 |
% \PrintIndex |
| 1572 |
% |
| 1573 |
% \Finale |
| 1574 |
\endinput |