From c06466531bdbf8090b8acb6e2252d78d61c95c12 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 31 Oct 2020 21:05:36 +0000 Subject: bytefield (31oct20) git-svn-id: svn://tug.org/texlive/trunk@56821 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/bytefield/bytefield.sty | 67 +++++++++++++++------- 1 file changed, 45 insertions(+), 22 deletions(-) (limited to 'Master/texmf-dist/tex/latex/bytefield') diff --git a/Master/texmf-dist/tex/latex/bytefield/bytefield.sty b/Master/texmf-dist/tex/latex/bytefield/bytefield.sty index 69067e54d8e..dbf8d8fc744 100644 --- a/Master/texmf-dist/tex/latex/bytefield/bytefield.sty +++ b/Master/texmf-dist/tex/latex/bytefield/bytefield.sty @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{bytefield} - [2020/10/22 v2.5 Network protocol diagrams] + [2020/10/31 v2.6 Network protocol diagrams] \RequirePackage{calc}[1998/07/07] \RequirePackage{keyval} \def\bf@newdimen#1{\advance\count11 by 1 @@ -69,6 +69,7 @@ \ignorespaces\global\counting@wordstrue\make@lspace\amp}% \vbox\bgroup\ialign\bgroup##\amp##\amp##\cr\amp }{% + \unskip \amp\show@wordlabelr\cr\egroup\egroup \end{lrbox}% \usebox{\entire@bytefield@picture}% @@ -394,6 +395,8 @@ \def\bf@rightlabelspace{0.5ex} \let\bf@leftcurly=\{ \let\bf@rightcurly=\} +\let\bf@leftcurlystyle=\relax +\let\bf@rightcurlystyle=\relax \newbox{\curly@box} \def\store@rcurly#1#2{% \begingroup @@ -406,11 +409,13 @@ \setlength{\curly@shift}{\half@curly@height + 0.5\curly@shift}% \global\sbox{#1}{\raisebox{\curly@shift}{% $\xdef\old@axis{\the\fontdimen22\textfont2}$% - $\fontdimen22\textfont2=0pt% - \left. - \vrule height\half@curly@height - width 0pt - depth\half@curly@height\right\bf@rightcurly$% + \bf@rightcurlystyle{% + $\fontdimen22\textfont2=0pt% + \left. + \vrule height\half@curly@height + width 0pt + depth\half@curly@height\right\bf@rightcurly$% + }% $\fontdimen22\textfont2=\old@axis$}}% \endgroup } @@ -425,57 +430,66 @@ \setlength{\curly@shift}{\half@curly@height + 0.5\curly@shift}% \global\sbox{#1}{\raisebox{\curly@shift}{% $\xdef\old@axis{\the\fontdimen22\textfont2}$% - $\fontdimen22\textfont2=0pt% - \left\bf@leftcurly - \vrule height\half@curly@height - width 0pt - depth\half@curly@height\right.$% + \bf@leftcurlystyle{% + $\fontdimen22\textfont2=0pt% + \left\bf@leftcurly + \vrule height\half@curly@height + width 0pt + depth\half@curly@height\right.$% + }% $\fontdimen22\textfont2=\old@axis$}}% \endgroup } \def\show@wordlabelr{} \newlength{\wordlabelr@start} \newlength{\wordlabelr@end} -\newenvironment{rightwordgroup}[1]{% +\newenvironment{rightwordgroup}[2][]{% \endgroup \global\wordlabelr@start=\bytefield@height - \gdef\wordlabelr@text{#1}% + \gdef\wordlabelr@params{#1}% + \gdef\wordlabelr@text{#2}% \ignorespaces }{% \begingroup \global\wordlabelr@end=\bytefield@height \gdef\show@wordlabelr{% \sbox{\word@label@box}{% - \begin{tabular}[b]{@{}l@{}}\wordlabelr@text\end{tabular}}% + \begin{tabular}[b]{@{}l@{}}\wordlabelr@text\end{tabular}% + }% \settowidth{\label@box@width}{\usebox{\word@label@box}}% \setlength{\label@box@height}{\wordlabelr@end-\wordlabelr@start}% + \expandafter\bf@bytefieldsetup\expandafter{\wordlabelr@params}% \store@rcurly{\curly@box}{\label@box@height}% \bf@newdimen\total@box@width \setlength{\total@box@width}{% \bf@rightcurlyspace + \widthof{\usebox{\curly@box}} + \bf@rightlabelspace + - \label@box@width}% + \label@box@width + }% \begin{picture}(\strip@pt\total@box@width,0) \put(0,0){% \hspace*{\bf@rightcurlyspace}% \usebox{\curly@box}% \hspace*{\bf@rightlabelspace}% \makebox(\strip@pt\label@box@width,\strip@pt\label@box@height){% - \usebox{\word@label@box}}} + \usebox{\word@label@box}% + }% + }% \end{picture}% \gdef\show@wordlabelr{}}% \def\@currenvir{rightwordgroup}% - \ignorespaces + \ignorespacesafterend } \newlength{\wordlabell@start} \newlength{\wordlabell@end} \newlength{\total@lbox@width} \gdef\make@lspace{} -\newenvironment{leftwordgroup}[1]{% - \endgroup +\newenvironment{leftwordgroup}[2][]{% \global\wordlabell@start=\bytefield@height - \gdef\wordlabell@text{#1}% + \gdef\wordlabell@params{#1}% + \gdef\wordlabell@text{#2}% + \bf@bytefieldsetup{#1}% \sbox{\word@label@box}{% \begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}% \settowidth{\label@box@width}{\usebox{\word@label@box}}% @@ -488,7 +502,9 @@ \global\total@lbox@width=\total@lbox@width \gdef\make@lspace{% \hspace*{\total@lbox@width}% - \gdef\make@lspace{}}% + \gdef\make@lspace{}% + }% + \endgroup \ignorespaces }{% \begingroup @@ -500,6 +516,7 @@ \begin{tabular}[b]{@{}l@{}}\wordlabell@text\end{tabular}}% \settowidth{\label@box@width}{\usebox{\word@label@box}}% \setlength{\label@box@height}{\wordlabell@end-\wordlabell@start}% + \expandafter\bf@bytefieldsetup\expandafter{\wordlabell@params}% \store@lcurly{\curly@box}{\label@box@height}% \begin{picture}(0,0) \put(\strip@pt\starting@point,0){% @@ -510,7 +527,7 @@ \hspace*{\bf@leftcurlyspace}} \end{picture}% \def\@currenvir{leftwordgroup}% - \ignorespaces + \ignorespacesafterend } \newlength{\label@box@width} \newlength{\label@box@height} @@ -606,6 +623,12 @@ \def\bf@leftcurlyshrinkage{#1}% \def\bf@rightcurlyshrinkage{#1}% } +\define@key{bytefield}{leftcurlystyle}{\def\bf@leftcurlystyle{#1}} +\define@key{bytefield}{rightcurlystyle}{\def\bf@rightcurlystyle{#1}} +\define@key{bytefield}{curlystyle}{% + \def\bf@leftcurlystyle{#1}% + \def\bf@rightcurlystyle{#1}% +} \define@key{bytefield}{endianness}{\bf@parse@endianness{#1}} \newcommand{\bf@parse@endianness}[1]{% \def\bf@little{little}% -- cgit v1.2.3