summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/gs1/rule-D.dtx
blob: 98cd347dfebf87748b9f677f5794fbd2850be2e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
% \iffalse meta-comment
%
%% File: rule-D.dtx Copyright (C) 2017-2021 Markus Kohm
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
%% license or (at your option) any later version.  The latest version
%% of this license is in the file
%%
%%    http://www.latex-project.org/lppl.txt
%%
%% This file is part of the "GS1 bundle" (The Work in LPPL)
%% and all files in that bundle must be distributed together.
%%
%% The released version of this bundle is available from CTAN.
%%
%% -------------------------------------------------------------------------
%
%<*driver|package>
\RequirePackage{expl3}[2019/01/17]
\GetIdInfo$Id: rule-D.dtx 23 2021-06-17 07:00:36Z mjk $
  {rule functions for LaTeX3}
%</driver|package>
%<*driver>
\documentclass{l3doc}
\begin{document}
  \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \title{^^A
%   The \pkg{rule-D} Package\\
%   Rule Functions\thanks
%     {^^A
%       This file describes v\ExplFileVersion,
%       last revised \ExplFileDate.^^A
%     }^^A
% }
%
% \author{^^A
%   Markus Kohm\thanks
%     {^^A
%       E-mail: \href{mailto:komascript@gmx.info}{komascript@gmx.info}^^A
%     }^^A
% }
%
% \date{Released \ExplFileDate}
%
% \maketitle
%
% \begin{documentation}
%   At \LaTeXe{} you have command \cmd{\rule} to make horizontal and vertical
%   rules and even boxes.  Currently there's no L3 command for this.  This
%   module provides two new L3 functions for rules.  The ``-D'' in the module
%   name indicates, that currently the implementation uses deprecated
%   functions like \cmd{\tex_vrule:D}.  Nevertheless, the new rule functions
%   aren't declared to be deprecated.
%
%   This package has been made only, because \pkg{GS1} needs such rule
%   functions.  So maybe it's simply a helper package for \pkg{GS1}.
%
%
% \begin{function}{\rule:nn , \rule:nnn}
%   \begin{syntax}
%     "\rule:nnn" \Arg{dimexpr_{raise}} \Arg{dimexpr_{width}}^^A
% \Arg{dimexpr_{height}}
%     "\rule:nn"  \Arg{dimexpr_{width}} \Arg{dimexpr_{height}}
%   \end{syntax}
%   Draw a rule of width \meta{dimexpr_{width}}, height
%   \meta{dimexpr_{height}} and raise it by \meta{dimexpr_{raise}}. It the
%   \meta{dimex_{raise}} has not been given, the rule will be drawn at the
%   base line.
% \end{function}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{rule-D} implementation}
% \label{sec:rule-D:implementation}
%
%    \begin{macrocode}
%<*package>
%<@@=rule>
%    \end{macrocode}
%
% First of all we have to setup package information:
%    \begin{macrocode}
\ProvidesExplPackage
  {rule-D} {\ExplFileDate} {\ExplFileVersion}
  {experimental~L3~rule~functions}
%    \end{macrocode}
%
% \begin{macro}[updated = 2021-06-17]{\rule:nn , \rule:nnn}
%    \begin{macrocode}
\cs_new:Npn \rule:nn #1#2
  {
    \rule:nnn { \c_zero_dim } { #1 } { #2 }
  }
\cs_new:Npn \rule:nnn #1#2#3
  {
%    \end{macrocode}
% \changes{v23}{2021/06/17}{deprecated \cs{hbox_unpack_clear} replaced by
%   \cs{hbox_unpack_drop}}
% Following line is same like \cs{leavevmode}, but it's \LaTeX3 instead of
% plain\TeX.
%    \begin{macrocode}
    \hbox_unpack_drop:N \c_empty_box
    \hbox:n
      {
        \tex_vrule:D width \dim_eval:n { #2 }
                     height \dim_eval:n { #1 + #3 } 
                     depth -\dim_eval:n { #1 }
      }
  }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex
%
\endinput
%
% end of file

% \endinput
% Local Variables:
% mode: doctex
% TeX-master: t
% End: