Debian Codegraph @

texmf-dist/source/latex/tabularht/tabularkv.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: tabularkv.dtx
4 % Version: 2026-05-13 v1.3
5 % Info: Tabular with key value interface
6 %
7 % Copyright (C)
8 % 2005, 2006 Heiko Oberdiek
9 % 2016-2026 Oberdiek Package Support Group
10 % https://github.com/ho-tex/oberdiek/issues
11 %
12 % This work may be distributed and/or modified under the
13 % conditions of the LaTeX Project Public License, either
14 % version 1.3c of this license or (at your option) any later
15 % version. This version of this license is in
16 % https://www.latex-project.org/lppl/lppl-1-3c.txt
17 % and the latest version of this license is in
18 % https://www.latex-project.org/lppl.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % This work has the LPPL maintenance status "maintained".
23 %
24 % The Current Maintainers of this work are
25 % Heiko Oberdiek and the Oberdiek Package Support Group
26 % https://github.com/ho-tex/tabularht/issues
27 %
28 % This work consists of the main source file tabularkv.dtx
29 % and the derived files
30 % tabularkv.sty, tabularkv.pdf, tabularkv.ins, tabularkv.drv,
31 % tabularkv-example.tex.
32 %
33 % Distribution:
34 % CTAN:macros/latex/contrib/tabularht/tabularkv.dtx
35 % CTAN:macros/latex/contrib/tabularht/tabularkv.pdf
36 %
37 % Unpacking:
38 % (a) If tabularkv.ins is present:
39 % tex tabularkv.ins
40 % (b) Without tabularkv.ins:
41 % tex tabularkv.dtx
42 % (c) If you insist on using LaTeX
43 % latex \let\install=y\input{tabularkv.dtx}
44 % (quote the arguments according to the demands of your shell)
45 %
46 % Documentation:
47 % (a) If tabularkv.drv is present:
48 % latex tabularkv.drv
49 % (b) Without tabularkv.drv:
50 % latex tabularkv.dtx; ...
51 % The class ltxdoc loads the configuration file ltxdoc.cfg
52 % if available. Here you can specify further options, e.g.
53 % use A4 as paper format:
54 % \PassOptionsToClass{a4paper}{article}
55 %
56 % Program calls to get the documentation (example):
57 % pdflatex tabularkv.dtx
58 % makeindex -s gind.ist tabularkv.idx
59 % pdflatex tabularkv.dtx
60 % makeindex -s gind.ist tabularkv.idx
61 % pdflatex tabularkv.dtx
62 %
63 % Installation:
64 % TDS:tex/latex/tabularht/tabularkv.sty
65 % TDS:doc/latex/tabularht/tabularkv.pdf
66 % TDS:doc/latex/tabularht/tabularkv-example.tex
67 % TDS:source/latex/tabularht/tabularkv.dtx
68 %
69 %<*ignore>
70 \begingroup
71 \catcode123=1 %
72 \catcode125=2 %
73 \def\x{LaTeX2e}%
74 \expandafter\endgroup
75 \ifcase 0\ifx\install y1\fi\expandafter
76 \ifx\csname processbatchFile\endcsname\relax\else1\fi
77 \ifx\fmtname\x\else 1\fi\relax
78 \else\csname fi\endcsname
79 %</ignore>
80 %<*install>
81 \input docstrip.tex
82 \Msg{************************************************************************}
83 \Msg{* Installation}
84 \Msg{* Package: tabularkv 2026-05-13 v1.3 Tabular with key value interface (HO)}
85 \Msg{************************************************************************}
86
87 \keepsilent
88 \askforoverwritefalse
89
90 \let\MetaPrefix\relax
91 \preamble
92
93 This is a generated file.
94
95 Project: tabularkv
96 Version: 2026-05-13 v1.3
97
98 Copyright (C)
99 2005, 2006 Heiko Oberdiek
100 2016-2026 Oberdiek Package Support Group
101
102 This work may be distributed and/or modified under the
103 conditions of the LaTeX Project Public License, either
104 version 1.3c of this license or (at your option) any later
105 version. This version of this license is in
106 https://www.latex-project.org/lppl/lppl-1-3c.txt
107 and the latest version of this license is in
108 https://www.latex-project.org/lppl.txt
109 and version 1.3 or later is part of all distributions of
110 LaTeX version 2005/12/01 or later.
111
112 This work has the LPPL maintenance status "maintained".
113
114 The Current Maintainers of this work are
115 Heiko Oberdiek and the Oberdiek Package Support Group
116 https://github.com/ho-tex/tabularht/issues
117
118
119 This work consists of the main source file tabularkv.dtx
120 and the derived files
121 tabularkv.sty, tabularkv.pdf, tabularkv.ins, tabularkv.drv,
122 tabularkv-example.tex.
123
124 \endpreamble
125 \let\MetaPrefix\DoubleperCent
126
127 \generate{%
128 \file{tabularkv.ins}{\from{tabularkv.dtx}{install}}%
129 \file{tabularkv.drv}{\from{tabularkv.dtx}{driver}}%
130 \usedir{tex/latex/tabularht}%
131 \file{tabularkv.sty}{\from{tabularkv.dtx}{package}}%
132 \usedir{doc/latex/tabularht}%
133 \file{tabularkv-example.tex}{\from{tabularkv.dtx}{example}}%
134 }
135
136 \catcode32=13\relax% active space
137 \let =\space%
138 \Msg{************************************************************************}
139 \Msg{*}
140 \Msg{* To finish the installation you have to move the following}
141 \Msg{* file into a directory searched by TeX:}
142 \Msg{*}
143 \Msg{* tabularkv.sty}
144 \Msg{*}
145 \Msg{* To produce the documentation run the file `tabularkv.drv'}
146 \Msg{* through LaTeX.}
147 \Msg{*}
148 \Msg{* Happy TeXing!}
149 \Msg{*}
150 \Msg{************************************************************************}
151
152 \endbatchfile
153 %</install>
154 %<*ignore>
155 \fi
156 %</ignore>
157 %<*driver>
158 \NeedsTeXFormat{LaTeX2e}
159 \ProvidesFile{tabularkv.drv}%
160 [2026-05-13 v1.3 Tabular with key value interface (HO)]%
161 \documentclass{ltxdoc}
162 \usepackage{holtxdoc}[2011/11/22]
163 \begin{document}
164 \DocInput{tabularkv.dtx}%
165 \end{document}
166 %</driver>
167 % \fi
168 %
169 %
170 %
171 % \GetFileInfo{tabularkv.drv}
172 %
173 % \title{The \xpackage{tabularkv} package}
174 % \date{2026-05-13 v1.3}
175 % \author{Heiko Oberdiek\thanks
176 % {Please report any issues at \url{https://github.com/ho-tex/tabularht/issues}}}
177 %
178 % \maketitle
179 %
180 % \begin{abstract}
181 % This package adds a key value interface for tabular
182 % by the new environment \texttt{tabularkv}. Thus the
183 % \TeX\ source code looks better by named parameters,
184 % especially if package \xpackage{tabularht} is used.
185 % \end{abstract}
186 %
187 % \tableofcontents
188 %
189 % \section{Usage}
190 % \begin{quote}
191 % |\usepackage{tabularkv}|
192 % \end{quote}
193 % The package provides the environment |tabularkv|
194 % that takes an optional argument with tabular
195 % parameters:
196 % \begin{description}
197 % \item[\texttt{width}:] width specification, "tabular*" is used.
198 % \item[\texttt{x}:]
199 % width specification, |tabularx| is used,
200 % package \xpackage{tabularx} must be loaded.
201 % \item[\texttt{height}:]
202 % height specification, see package \xpackage{tabularht}.
203 % \item[\texttt{valign}:] vertical positioning, this option is optional;\\
204 % values: top, bottom, center.
205 % \end{description}
206 % Parameter \xoption{valign} optional, the following are
207 % equivalent:
208 % \begin{quote}
209 % |\begin{tabularkv}[|\dots|, valign=top]{l}|\dots|\end{tabularkv}|\\
210 % |\begin{tabularkv}[|\dots|][t]{l}|\dots|\end{tabularkv}|
211 % \end{quote}
212 %
213 % \subsection{Example}
214 %
215 % \begin{macrocode}
216 %<*example>
217 \documentclass{article}
218 \usepackage{tabularkv}
219
220 \begin{document}
221 \fbox{%
222 \begin{tabularkv}[
223 width=4in,
224 height=1in,
225 valign=center
226 ]{@{}l@{\extracolsep{\fill}}r@{}}
227 upper left corner & upper right corner\\
228 \noalign{\vfill}%
229 \multicolumn{2}{@{}c@{}}{bounding box}\\
230 \noalign{\vfill}%
231 lower left corner & lower right corner\\
232 \end{tabularkv}%
233 }
234 \end{document}
235 %</example>
236 % \end{macrocode}
237 %
238 % \StopEventually{
239 % }
240 %
241 % \section{Implementation}
242 %
243 % \begin{macrocode}
244 %<*package>
245 % \end{macrocode}
246 % Package identification.
247 % \begin{macrocode}
248 \NeedsTeXFormat{LaTeX2e}
249 \ProvidesPackage{tabularkv}%
250 [2026-05-13 v1.3 Tabular with key value interface (HO)]
251 % \end{macrocode}
252 %
253 % \begin{macrocode}
254 \RequirePackage{keyval}
255 \RequirePackage{tabularht}
256
257 \let\tabKV@star@x\@empty
258 \let\tabKV@width\@empty
259 \let\tabKV@valign\@empty
260
261 \define@key{tabKV}{height}{%
262 \setlength{\dimen@}{#1}%
263 \edef\@toarrayheight{to\the\dimen@}%
264 }
265 \define@key{tabKV}{width}{%
266 \def\tabKV@width{{#1}}%
267 \def\tabKV@star@x{*}%
268 }
269 \define@key{tabKV}{x}{%
270 \def\tabKV@width{{#1}}%
271 \def\tabKV@star@x{x}%
272 }
273 \define@key{tabKV}{valign}{%
274 \edef\tabKV@valign{[\@car #1c\@nil]}%
275 }
276 % \end{macrocode}
277 % \begin{macrocode}
278 \newenvironment{tabularkv}[1][]{%
279 \setkeys{tabKV}{#1}%
280 \@nameuse{%
281 tabular\tabKV@star@x\expandafter\expandafter\expandafter
282 }%
283 \expandafter\tabKV@width\tabKV@valign
284 }{%
285 \@nameuse{endtabular\tabKV@star@x}%
286 }
287 % \end{macrocode}
288 %
289 % \begin{macrocode}
290 %</package>
291 % \end{macrocode}
292 %
293 % \section{Installation}
294 %
295 % \subsection{Download}
296 %
297 % \paragraph{Package.} This package is available on
298 % CTAN\footnote{\CTANpkg{tabularkv}}:
299 % \begin{description}
300 % \item[\CTAN{macros/latex/contrib/tabularht/tabularkv.dtx}] The source file.
301 % \item[\CTAN{macros/latex/contrib/tabularht/tabularkv.pdf}] Documentation.
302 % \end{description}
303 %
304 %
305 % \subsection{Package installation}
306 %
307 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
308 % \docstrip\ archive. The files are extracted by running the
309 % \xfile{.dtx} through \plainTeX:
310 % \begin{quote}
311 % \verb|tex tabularkv.dtx|
312 % \end{quote}
313 %
314 % \paragraph{TDS.} Now the different files must be moved into
315 % the different directories in your installation TDS tree
316 % (also known as \xfile{texmf} tree):
317 % \begin{quote}
318 % \def\t{^^A
319 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
320 % tabularkv.sty & tex/latex/tabularht/tabularkv.sty\\
321 % tabularkv.pdf & doc/latex/tabularht/tabularkv.pdf\\
322 % tabularkv-example.tex & doc/latex/tabularht/tabularkv-example.tex\\
323 % tabularkv.dtx & source/latex/tabularht/tabularkv.dtx\\
324 % \end{tabular}^^A
325 % }^^A
326 % \sbox0{\t}^^A
327 % \ifdim\wd0>\linewidth
328 % \begingroup
329 % \advance\linewidth by\leftmargin
330 % \advance\linewidth by\rightmargin
331 % \edef\x{\endgroup
332 % \def\noexpand\lw{\the\linewidth}^^A
333 % }\x
334 % \def\lwbox{^^A
335 % \leavevmode
336 % \hbox to \linewidth{^^A
337 % \kern-\leftmargin\relax
338 % \hss
339 % \usebox0
340 % \hss
341 % \kern-\rightmargin\relax
342 % }^^A
343 % }^^A
344 % \ifdim\wd0>\lw
345 % \sbox0{\small\t}^^A
346 % \ifdim\wd0>\linewidth
347 % \ifdim\wd0>\lw
348 % \sbox0{\footnotesize\t}^^A
349 % \ifdim\wd0>\linewidth
350 % \ifdim\wd0>\lw
351 % \sbox0{\scriptsize\t}^^A
352 % \ifdim\wd0>\linewidth
353 % \ifdim\wd0>\lw
354 % \sbox0{\tiny\t}^^A
355 % \ifdim\wd0>\linewidth
356 % \lwbox
357 % \else
358 % \usebox0
359 % \fi
360 % \else
361 % \lwbox
362 % \fi
363 % \else
364 % \usebox0
365 % \fi
366 % \else
367 % \lwbox
368 % \fi
369 % \else
370 % \usebox0
371 % \fi
372 % \else
373 % \lwbox
374 % \fi
375 % \else
376 % \usebox0
377 % \fi
378 % \else
379 % \lwbox
380 % \fi
381 % \else
382 % \usebox0
383 % \fi
384 % \end{quote}
385 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
386 % TDS installing feature, then some files can already be in the right
387 % place, see the documentation of \docstrip.
388 %
389 % \subsection{Refresh file name databases}
390 %
391 % If your \TeX~distribution
392 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
393 % these. For example, \TeX\,Live\ users run \verb|texhash| or
394 % \verb|mktexlsr|.
395 %
396 % \subsection{Some details for the interested}
397 %
398 % \paragraph{Unpacking with \LaTeX.}
399 % The \xfile{.dtx} chooses its action depending on the format:
400 % \begin{description}
401 % \item[\plainTeX:] Run \docstrip\ and extract the files.
402 % \item[\LaTeX:] Generate the documentation.
403 % \end{description}
404 % If you insist on using \LaTeX\ for \docstrip\ (really,
405 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
406 % about your intention:
407 % \begin{quote}
408 % \verb|latex \let\install=y\input{tabularkv.dtx}|
409 % \end{quote}
410 % Do not forget to quote the argument according to the demands
411 % of your shell.
412 %
413 % \paragraph{Generating the documentation.}
414 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
415 % the documentation. The process can be configured by the
416 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
417 % line into this file, if you want to have A4 as paper format:
418 % \begin{quote}
419 % \verb|\PassOptionsToClass{a4paper}{article}|
420 % \end{quote}
421 % An example follows how to generate the
422 % documentation with pdf\LaTeX:
423 % \begin{quote}
424 %\begin{verbatim}
425 %pdflatex tabularkv.dtx
426 %makeindex -s gind.ist tabularkv.idx
427 %pdflatex tabularkv.dtx
428 %makeindex -s gind.ist tabularkv.idx
429 %pdflatex tabularkv.dtx
430 %\end{verbatim}
431 % \end{quote}
432 %
433 % \begin{History}
434 % \begin{Version}{2005/09/22 v1.0}
435 % \item
436 % First public version.
437 % \end{Version}
438 % \begin{Version}{2006/02/20 v1.1}
439 % \item
440 % DTX framework.
441 % \item
442 % Code is not changed.
443 % \end{Version}
444 % \begin{Version}{2016/05/16 v1.2}
445 % \item
446 % Documentation updates.
447 % \end{Version}
448 % \begin{Version}{2026-05-13 v1.3}
449 % \item Updated ctan location to \texttt{tabularht} repository.
450 % \end{Version}
451 % \end{History}
452 %
453 % \PrintIndex
454 %
455 % \Finale
456 \endinput