summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/register
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-03-23 03:02:41 +0000
committerNorbert Preining <norbert@preining.info>2020-03-23 03:02:41 +0000
commit404e90e73ebdb6ecca01ae0b18e684a5f8fe83b3 (patch)
tree0299674ee5045793cc18684fce643597555a7f88 /macros/latex/contrib/register
parent75d8dfa80524727ddb7d8ae217ed6463efba84cf (diff)
CTAN sync 202003230302
Diffstat (limited to 'macros/latex/contrib/register')
-rw-r--r--macros/latex/contrib/register/README9
-rw-r--r--macros/latex/contrib/register/register.dtx81
-rw-r--r--macros/latex/contrib/register/register.pdfbin178459 -> 309043 bytes
3 files changed, 65 insertions, 25 deletions
diff --git a/macros/latex/contrib/register/README b/macros/latex/contrib/register/README
index f250c7dbc2..bcfbf4d89e 100644
--- a/macros/latex/contrib/register/README
+++ b/macros/latex/contrib/register/README
@@ -10,9 +10,10 @@ This package is designed for typesetting the programmable elements in
digital hardware, i.e., registers. Such registers typically have many
fields and can be quite wide; they are thus a challenge to typeset in
a consistent manner. Register is similar in some aspects to the
-bytefield package. Anyone doing hardware documentation using LaTeX
-should examine both packages. Register requires version 2001/07/25 or
-newer of the float package.
+bytefield and bitpattern packages. Anyone doing hardware
+documentation using LaTeX should examine those packages.
+
+Register requires version 2001/07/25 or newer of the float package.
An example Perl module and script are provided, to convert the
register specifications into structures suitable for, say, a
@@ -38,7 +39,7 @@ documentation includes some representative examples of package usage.
Copyright and license
---------------------
-Copyright (C) 2001-2018 Matthew Lovell, lovells@gmail.com
+Copyright (C) 2001-2020 Matthew Lovell, lovells@gmail.com
This package may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3 of this
diff --git a/macros/latex/contrib/register/register.dtx b/macros/latex/contrib/register/register.dtx
index 2c2b41cf6d..edbc2f54b7 100644
--- a/macros/latex/contrib/register/register.dtx
+++ b/macros/latex/contrib/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}
%
%
diff --git a/macros/latex/contrib/register/register.pdf b/macros/latex/contrib/register/register.pdf
index 1a0ad7f95c..c6f74959f6 100644
--- a/macros/latex/contrib/register/register.pdf
+++ b/macros/latex/contrib/register/register.pdf
Binary files differ