summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/register/register.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/register/register.dtx')
-rw-r--r--Master/texmf-dist/source/latex/register/register.dtx81
1 files changed, 60 insertions, 21 deletions
diff --git a/Master/texmf-dist/source/latex/register/register.dtx b/Master/texmf-dist/source/latex/register/register.dtx
index 2c2b41cf6de..edbc2f54b78 100644
--- a/Master/texmf-dist/source/latex/register/register.dtx
+++ b/Master/texmf-dist/source/latex/register/register.dtx
@@ -4,7 +4,7 @@
% Register diagrams with field descriptions
%
% Author: Matthew Lovell (lovells@gmail.com)
-% Copyright 2001-2019 by Matthew B. Lovell
+% Copyright 2001-2020 by Matthew B. Lovell
%
% Run LaTeX on the file `register.ins' to get a .sty-file and
% then on `register.dtx' to obtain instructions.
@@ -20,10 +20,10 @@
\ProvidesFile{register.dtx}
%</dtx>
% \fi
-% \CheckSum{785}
+% \CheckSum{804}
%
-% \def\fileversion{v1.9}
-% \def\filedate{2019/01/01}
+% \def\fileversion{v2.0}
+% \def\filedate{2020/03/22}
% \title{Register diagrams with field descriptions}
% \author{Matthew Lovell\\
% \texttt{lovells@gmail.com}
@@ -40,7 +40,8 @@
% they are thus a challenge to typeset in a consistent manner.
% This package attempts to address such issues. It is similar
% in some aspects to the |bitfield| package by Reuben Thomas and the
-% |bytefield| package by Scott Pakin.
+% |bytefield| package by Scott Pakin. Authors may also wish to
+% inspect the |bitpattern| package by Jean-Marc Bourguet.
% \end{abstract}
%
% \StopEventually
@@ -543,6 +544,8 @@
% \item [\textbf{v1.7}] (2018/08/18) Added color option to package, suggested by Marco Stolba
% \item [\textbf{v1.8}] (2018/11/10) Added unnumbered |register*| environment, suggested and written by Stephan Bauroth
% \item [\textbf{v1.9}] (2019/01/01) Switched to a re-definable macro to provide default float name and LoR name, suggested by Benyuan Liu.
+% \item [\textbf{v2.0}] (2020/03/22) Added package options for captions and replaced |\bf| usage, suggested by Andrea Bettati. %
+% Also attempt to work better with |memoir| class.
% \end{itemize}
%
%
@@ -562,7 +565,7 @@
%
% Announce the name and unconditionally load most of the required packages:
% \begin{macrocode}
-\ProvidesPackage{register} [2019/01/01 v1.9 Register macros with
+\ProvidesPackage{register} [2020/03/22 v2.0 Register macros with
hyperref/LyX support]
\RequirePackage{ifthen}[1997/11/02]
@@ -573,29 +576,42 @@ hyperref/LyX support]
%
% Declare the package options and some booleans. There are options indicating
% whether |register| is being used with \LyX{} or |hyperref|. The marginal
-% TR flags can also be turned on or off with an option.
+% TR flags can also be turned on or off with an option. A new package
+% option, |botcaption| serves to change the default caption location to
+% below the register diagram, rather than above. Finally, |nocaption| turns
+% off the |\caption| invocation internal to the |register| environment
+% entirely, for users who would rather craft their own caption. Note than
+% one can specify \emph{both} |botcaption| and |nocaption| -- explicit
+% author-specified captions would then appear at the bottom of each diagram.
% \begin{macrocode}
+%
\DeclareOption{LyX}{\setboolean{RegisterLyX}{true}}
\DeclareOption{hyperref}{\setboolean{RegisterHyperref}{true}}
\DeclareOption{TRflags}{\setboolean{RegisterTRFlags}{true}}
\DeclareOption{TRboxed}{\setboolean{RegisterTRBoxed}{true}}
\DeclareOption{color}{\setboolean{RegisterColors}{true}}
+\DeclareOption{botcaption}{\setboolean{RegisterBottom}{true}}
+\DeclareOption{nocaption}{\setboolean{RegisterNoCaption}{true}}
\DeclareOption*{% Emit a warning for other options
\PackageWarning{register}{Unknown option '\CurrentOption'}%
}
-\newboolean{RegisterLyX}
-\newboolean{RegisterHyperref}
-\newboolean{RegisterTRFlags}
-\newboolean{RegisterTRBoxed}
-\newboolean{RegisterColors}
+\newboolean{RegisterLyX}% Work with LyX
+\newboolean{RegisterHyperref}% Work with hyperref package
+\newboolean{RegisterTRFlags}% TR release flags
+\newboolean{RegisterTRBoxed}% Place frame around TR flags
+\newboolean{RegisterColors}% Permit color-filling register fields
+\newboolean{RegisterBottom}% Move caption location to beneath register
+\newboolean{RegisterNoCaption}% Disable environment's built-in caption
\setboolean{RegisterLyX}{false}
\setboolean{RegisterHyperref}{false}
\setboolean{RegisterTRFlags}{false}
\setboolean{RegisterTRBoxed}{false}
\setboolean{RegisterColors}{false}
+\setboolean{RegisterBottom}{false}
+\setboolean{RegisterNoCaption}{false}
\ProcessOptions\relax % Process package options
% \end{macrocode}
@@ -636,16 +652,26 @@ hyperref/LyX support]
% \end{macrocode}
-% \subsection{Float Declaration \& Lengths} \label{sec:float}
+% \subsection{New Float Declaration} \label{sec:float}
%
% Declare the new register float type and the lengths which the
% macros will use. The register diagrams tend to look best with
-% the caption at the top of the float. If |\chapter| is defined in
+% the caption at the top of the float. Note, however, that caption
+% placement \emph{can} be changed in the document itself. For example,
+% one can use the macro |\floatstyle{plain}|, followed by
+% |\restylefloat{Regfloat}|, to alter how all subsequent register
+% captions are typeset.
+%
+% \begin{macrocode}
+\ifthenelse{\boolean{RegisterBottom}}{\floatstyle{plain}}{\floatstyle{plaintop}}
+% \end{macrocode}
+%
+% If |\chapter| is defined in
% the current document class, then the register diagrams will count
% by chapter, otherwise they will count by section.
%
% \begin{macrocode}
-\floatstyle{plaintop} \@ifundefined{chapter}
+\@ifundefined{chapter}
{\newfloat{Regfloat}{tbp}{rdf}[section]}
{\newfloat{Regfloat}{tbp}{rdf}[chapter]}
\floatname{Regfloat}{\regFloatName}
@@ -699,7 +725,7 @@ hyperref/LyX support]
\newcommand{\regResetSize}{\scriptsize}
\newcommand{\regLabelSize}{\footnotesize}
\newcommand{\regLabelFamily}{\rmfamily}
-\newcommand{\regDescFamily}{\bf}
+\newcommand{\regDescFamily}{\bfseries}
% \end{macrocode}
% The lengths below control the vertical spacing between a
% register diagrams and the register field descriptions. This
@@ -806,9 +832,11 @@ hyperref/LyX support]
\setlength{\partopsep}{0pt}%
\setlength{\topsep}{0pt}%
\setboolean{RegisterContext}{true}%
- \ifthenelse{\equal{#3}{}}%
- {\caption[#2]{\textsc{#2}}}% else
- {\caption[#2]{\textsc{#2} ({#3})}}%
+ \ifthenelse{\boolean{RegisterNoCaption}}{}%
+ {\ifthenelse{\equal{#3}{}}%
+ {\caption[#2]{\textsc{#2}}}% else
+ {\caption[#2]{\textsc{#2} ({#3})}}%
+ }%
\centering}
{% restore lengths
\leftskip\z@%
@@ -1213,13 +1241,24 @@ hyperref/LyX support]
% \end{macrocode}
%
%
-%
% The |\chapter| command, if present, is also redefined in order
% to get identical chapter-related spacing in the list of registers
% as appears in the LoF and LoT. Kjetil Oftedal provided a fix
% wherein we test that @mainmatter is defined prior to using it.
+%
+% This change to |\chapter| is not particularly friendly if one is
+% using the |memoir| package, however! So, we first check what
+% document class is being used. If |memoir| is being used, we invoke
+% its |\memchapinfo| hook rather than attempt any redefinition of
+% |\chapter|.
+%
+%
% \begin{macrocode}
\@ifundefined{@mainmatter}{\newif\if@mainmatter \@mainmattertrue}{}
+\@ifclassloaded{memoir}{%
+\renewcommand{\memchapinfo}[4]{%
+ \addtocontents{rdf}{\protect\addvspace{10pt}}}
+}{%
\@ifundefined{chapter}{}
{% Adjust chapter definition slightly for Regfloats
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
@@ -1244,7 +1283,7 @@ hyperref/LyX support]
\@makechapterhead{#2}%
\@afterheading
\fi}
-}
+}}
% \end{macrocode}
%
%