diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-22 20:50:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-22 20:50:14 +0000 |
commit | 4534b7761399644b12ee2446c134bacebf4bdfda (patch) | |
tree | 635c8ed9fbfa63f420ff3616e2a953a8b48efa20 | |
parent | aa0f864bc4950c2113dffb9a7ec6bea901f6edd1 (diff) |
register (22mar20)
git-svn-id: svn://tug.org/texlive/trunk@54485 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/register/README | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/register/register.pdf | bin | 178459 -> 309043 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/register/register.dtx | 81 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/register/register.sty | 37 |
4 files changed, 90 insertions, 37 deletions
diff --git a/Master/texmf-dist/doc/latex/register/README b/Master/texmf-dist/doc/latex/register/README index f250c7dbc2d..bcfbf4d89e1 100644 --- a/Master/texmf-dist/doc/latex/register/README +++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/register/register.pdf b/Master/texmf-dist/doc/latex/register/register.pdf Binary files differindex 1a0ad7f95c1..c6f74959f65 100644 --- a/Master/texmf-dist/doc/latex/register/register.pdf +++ b/Master/texmf-dist/doc/latex/register/register.pdf 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} % % diff --git a/Master/texmf-dist/tex/latex/register/register.sty b/Master/texmf-dist/tex/latex/register/register.sty index 1f1500a1d89..15c42b02771 100644 --- a/Master/texmf-dist/tex/latex/register/register.sty +++ b/Master/texmf-dist/tex/latex/register/register.sty @@ -22,7 +22,7 @@ -\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] @@ -34,22 +34,28 @@ hyperref/LyX support] \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 \ifthenelse{\boolean{RegisterColors}}{\RequirePackage{xcolor}[2007/01/21]}{} @@ -59,7 +65,8 @@ hyperref/LyX support] \newcommand{\regListName}{List of Registers} \newcommand{\regResetName}{Reset} -\floatstyle{plaintop} \@ifundefined{chapter} +\ifthenelse{\boolean{RegisterBottom}}{\floatstyle{plain}}{\floatstyle{plaintop}} +\@ifundefined{chapter} {\newfloat{Regfloat}{tbp}{rdf}[section]} {\newfloat{Regfloat}{tbp}{rdf}[chapter]} \floatname{Regfloat}{\regFloatName} @@ -80,7 +87,7 @@ hyperref/LyX support] \newcommand{\regResetSize}{\scriptsize} \newcommand{\regLabelSize}{\footnotesize} \newcommand{\regLabelFamily}{\rmfamily} -\newcommand{\regDescFamily}{\bf} +\newcommand{\regDescFamily}{\bfseries} \newlength{\regdescsep} \newlength{\oldregdescsep} \setlength{\regdescsep}{-\medskipamount} @@ -136,9 +143,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@% @@ -398,6 +407,10 @@ hyperref/LyX support] \@starttoc{\@nameuse{ext@Regfloat}}}} \newcommand\l@Regfloat{\@dottedtocline{1}{1.5em}{2.3em}} \@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 @@ -422,7 +435,7 @@ hyperref/LyX support] \@makechapterhead{#2}% \@afterheading \fi} -} +}} \newcommand\@GetTRSecondParam{} \long\def\@GetTRSecondParam#1#2#3\@nil{#2} \newcommand*{\GetTRPageRef}[1]{% |