| 1 |
% \iffalse meta-comment |
| 2 |
% ====================================================================== |
| 3 |
% scraddr.dtx |
| 4 |
% Copyright (c) Markus Kohm, 2006-2025 |
| 5 |
% |
| 6 |
% This file is part of the LaTeX2e KOMA-Script bundle. |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the conditions of |
| 9 |
% the LaTeX Project Public License, version 1.3c of the license. |
| 10 |
% The latest version of this license is in |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 13 |
% version 2005/12/01 or later and of this work. |
| 14 |
% |
| 15 |
% This work has the LPPL maintenance status "author-maintained". |
| 16 |
% |
| 17 |
% The Current Maintainer and author of this work is Markus Kohm. |
| 18 |
% |
| 19 |
% This work consists of all files listed in MANIFEST.md. |
| 20 |
% ====================================================================== |
| 21 |
%%% From File: $Id: scraddr.dtx 4181 2025-06-14 09:11:13Z kohm $ |
| 22 |
%<*dtx> |
| 23 |
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi |
| 24 |
\ProvidesFile{scraddr.dtx} |
| 25 |
%</dtx>> |
| 26 |
%<scraddr>\NeedsTeXFormat{LaTeX2e}[1995/12/01] |
| 27 |
%<driver>\ProvidesFile{scraddr.drv} |
| 28 |
%<scraddr>\ProvidesPackage{scraddr} |
| 29 |
%<*dtx|scraddr|driver> |
| 30 |
[2022/01/24 v1.1d KOMA-Script |
| 31 |
%</dtx|scraddr|driver> |
| 32 |
%<scraddr> package] |
| 33 |
%<*dtx|driver> |
| 34 |
Script bundle] |
| 35 |
%</dtx|driver> |
| 36 |
%<*dtx> |
| 37 |
\ifx\documentclass\undefined |
| 38 |
\input scrdocstrip.tex |
| 39 |
\@@input scrkernel-version.dtx |
| 40 |
\@@input scrstrip.inc |
| 41 |
\KOMAdefVariable{COPYRIGHTFROM}{2006} |
| 42 |
\generate{\usepreamble\defaultpreamble |
| 43 |
\file{scraddr.sty}{% |
| 44 |
\from{scraddr.dtx}{scraddr}% |
| 45 |
\from{scrlogo.dtx}{logo}% |
| 46 |
}% |
| 47 |
} |
| 48 |
\@@input scrstrop.inc |
| 49 |
\else |
| 50 |
\let\endbatchfile\relax |
| 51 |
\fi |
| 52 |
\endbatchfile |
| 53 |
%</dtx> |
| 54 |
%<*driver> |
| 55 |
\documentclass{koma-script-source-doc} |
| 56 |
\usepackage[USenglish]{babel} |
| 57 |
\begin{document} |
| 58 |
\DocInput{scraddr.dtx} |
| 59 |
\end{document} |
| 60 |
%</driver> |
| 61 |
% \fi |
| 62 |
% |
| 63 |
% \changes{v1.1a}{2002/05/19}{first version, separated from \cls{scrlettr}} |
| 64 |
% \changes{v1.1d}{2022/01/24}{switched from \cls{scrdoc} to |
| 65 |
% \cls{koma-script-source-doc}} |
| 66 |
% \changes{v1.1d}{2022/01/24}{whole implementation documentation in English} |
| 67 |
% \changes{v3.40}{2023/04/17}{guide names changed} |
| 68 |
% |
| 69 |
% \GetFileInfo{scraddr.dtx} |
| 70 |
% \title{Parsing Address Files \\ |
| 71 |
% Using Package \pkg*{scraddr}} |
| 72 |
% \author{\href{mailto:[email protected]}{Markus Kohm} |
| 73 |
% \and Jens-Uwe Morawski} |
| 74 |
% \date{Version \fileversion{} of \filedate} |
| 75 |
% \maketitle |
| 76 |
% \begin{abstract} |
| 77 |
% Address files are not only of interest for letters using the \KOMAScript{} |
| 78 |
% class \cls*{scrlttr2} or the \KOMAScript{} package \pkg*{scrletter}. Other |
| 79 |
% applications such as the creation of address books or telephone directories |
| 80 |
% are also quite common. In addition, it can also be useful to access not only |
| 81 |
% the addressee's record in a letter, but also other records in an address |
| 82 |
% file. This is exactly the task of the \pkg*{scraddr} package. |
| 83 |
% \end{abstract} |
| 84 |
% \tableofcontents |
| 85 |
% |
| 86 |
% \section{User Manual} |
| 87 |
% |
| 88 |
% You can find the user manual of \pkg*{scraddr} in the \KOMAScript{} manual, |
| 89 |
% either the German \file{scrguide-de.pdf} or the English |
| 90 |
% \file{scrguide-en.pdf}. |
| 91 |
% |
| 92 |
% \MaybeStop{\PrintIndex} |
| 93 |
% |
| 94 |
% \section{Implementation} |
| 95 |
% |
| 96 |
%\iffalse |
| 97 |
% \begin{macrocode} |
| 98 |
%<*scraddr> |
| 99 |
%<*beta> |
| 100 |
\PackageWarningNoLine{scraddr} |
| 101 |
{THIS IS A BETA VERSION!\MessageBreak |
| 102 |
YOU SHOULD NOT USE THIS VERSION!\MessageBreak |
| 103 |
YOU SHOULD INSTALL THE RELEASE FROM CTAN\MessageBreak |
| 104 |
AND USE THAT INSTEAD OF THIS BETA VERSION} |
| 105 |
%</beta> |
| 106 |
%</scraddr> |
| 107 |
%\fi |
| 108 |
% |
| 109 |
% \changes{v1.0}{1996/01/22}{New package \pkg*{scraddr}} |
| 110 |
% |
| 111 |
% \begin{macrocode} |
| 112 |
%<*scraddr> |
| 113 |
% \end{macrocode} |
| 114 |
% |
| 115 |
% \subsection{Options} |
| 116 |
% |
| 117 |
% Preliminary note: \pkg*{scraddr} is a very, very old package from the early |
| 118 |
% days of \KOMAScript. Therefore it does not support \emph{key=value} options |
| 119 |
% as other \KOMAScript{} packages do. |
| 120 |
% |
| 121 |
% \begin{option}{adrFreeIVempty} |
| 122 |
% \changes{v1.1a}{2002/05/19}{added} |
| 123 |
% \begin{option}{adrFreeIVshow} |
| 124 |
% \changes{v1.1a}{2002/05/19}{added} |
| 125 |
% \begin{option}{adrFreeIVwarn} |
| 126 |
% \changes{v1.1a}{2002/05/19}{added} |
| 127 |
% \begin{option}{adrFreeIVstop} |
| 128 |
% \changes{v1.1a}{2002/05/19}{added} |
| 129 |
% \begin{macro}{\@adrFIVerror} |
| 130 |
% \changes{v1.1a}{2002/05/19}{added} |
| 131 |
% The options allow the choice whether \cs{FreeIV}, defined by \cs{adrentry}, |
| 132 |
% should be ignored, output, result in a warning or an error message. Default |
| 133 |
% is \opt{adrFreeIVshow}. The selected choice is stored as a number in |
| 134 |
% \cs{@adrFIVerror} (0 = \opt{adrFreeIVempty}, 1 = \opt{adrFreeIVshow}, |
| 135 |
% 2 = \opt{adrFreewarn}, 3 = \opt{adrFreeIVstop}). Unknown values should |
| 136 |
% be handled as \opt{adrFreeIVstop} too, but are not recommended. |
| 137 |
% \begin{macrocode} |
| 138 |
\newcommand*{\@adrFIVerror}{} |
| 139 |
\DeclareOption{adrFreeIVempty}{\renewcommand*{\@adrFIVerror}{0}} |
| 140 |
\DeclareOption{adrFreeIVshow}{\renewcommand*{\@adrFIVerror}{1}} |
| 141 |
\DeclareOption{adrFreeIVwarn}{\renewcommand*{\@adrFIVerror}{2}} |
| 142 |
\DeclareOption{adrFreeIVstop}{\renewcommand*{\@adrFIVerror}{3}} |
| 143 |
% \end{macrocode} |
| 144 |
% \end{macro} |
| 145 |
% \end{option} |
| 146 |
% \end{option} |
| 147 |
% \end{option} |
| 148 |
% \end{option} |
| 149 |
% |
| 150 |
% \changes{v1.0a}{2001/08/07}{\cs{ExecuteOption}\cs{relax} fixed} |
| 151 |
% \changes{v1.1a}{2002/05/19}{\texttt{adrFreeIVshow} is default} |
| 152 |
% \begin{macrocode} |
| 153 |
\ExecuteOptions{adrFreeIVshow} |
| 154 |
\ProcessOptions\relax |
| 155 |
% \end{macrocode} |
| 156 |
% |
| 157 |
% \subsection{Reading address files} |
| 158 |
% \begin{command}{\InputAdressFile} |
| 159 |
% This command reads the address file given as mandatory argument. While |
| 160 |
% reading global internal macros are generated for every \cs{adrentry} or |
| 161 |
% \cs{addrentry}. To do so, these two macros are redefined locally only. |
| 162 |
% \changes{v1.1}{2002/05/18}{extended by \cs{addrentry} handling} |
| 163 |
% \changes{v1.1b}{2002/06/02}{\cs{addrchar} and \cs{adrchar} are defined also |
| 164 |
% if undefined} |
| 165 |
% \begin{macrocode} |
| 166 |
\newcommand{\InputAddressFile}[1]{\begingroup |
| 167 |
\ifcase\@adrFIVerror |
| 168 |
\def\adrentry##1##2##3##4##5##6##7{% |
| 169 |
\addrentry{##1}{##2}{##3}{##4}{##5}{##6}{##7}{}}% |
| 170 |
\or |
| 171 |
\def\adrentry##1##2##3##4##5##6##7##8{% |
| 172 |
\addrentry{##1}{##2}{##3}{##4}{##5}{##6}{##7}{% |
| 173 |
(entry FreeIV undefined at `##8')}{##8}}% |
| 174 |
\or |
| 175 |
\def\adrentry##1##2##3##4##5##6##7##8{% |
| 176 |
\addrentry{##1}{##2}{##3}{##4}{##5}{##6}{##7}{% |
| 177 |
\PackageWarning{scraddr}{% |
| 178 |
`##8' was defined using \string\adrentry\MessageBreak |
| 179 |
so \string\FreeIV-entry is not defined}}{##8}}% |
| 180 |
\else |
| 181 |
\def\adrentry##1##2##3##4##5##6##7##8{% |
| 182 |
\addrentry{##1}{##2}{##3}{##4}{##5}{##6}{##7}{% |
| 183 |
\PackageError{scraddr}{% |
| 184 |
\string\FreeIV\space undefined at `##8'}{% |
| 185 |
`##8' was defined using \string\adrentry\MessageBreak |
| 186 |
so \string\FreeIV-entry is not defined.\MessageBreak |
| 187 |
You may continue but you should check output}}{##8}}% |
| 188 |
\fi |
| 189 |
\providecommand*{\addrchar}[1]{}% |
| 190 |
\providecommand*{\adrchar}{\addrchar}% |
| 191 |
\def\addrentry##1##2##3##4##5##6##7##8##9{% |
| 192 |
\def\@tempa{##9}\ifx\@tempa\@empty\else |
| 193 |
\expandafter\gdef\csname ##9.LN\endcsname{##1} |
| 194 |
\expandafter\gdef\csname ##9.FN\endcsname{##2} |
| 195 |
\expandafter\gdef\csname ##9.A\endcsname{##3} |
| 196 |
\expandafter\gdef\csname ##9.P\endcsname{##4} |
| 197 |
\expandafter\gdef\csname ##9.FI\endcsname{##5} |
| 198 |
\expandafter\gdef\csname ##9.FII\endcsname{##6} |
| 199 |
\expandafter\gdef\csname ##9.FIII\endcsname{##7} |
| 200 |
\expandafter\gdef\csname ##9.FIV\endcsname{##8} |
| 201 |
\fi} |
| 202 |
% \end{macrocode} |
| 203 |
% Not existing files result in an error message. Found files are only noted. |
| 204 |
% \changes{v3.42}{2024/02/01}{\cs{typeout} replaced by either |
| 205 |
% \cs{PackageNote} or \cs{PackageInfo}} |
| 206 |
% \begin{macrocode} |
| 207 |
\InputIfFileExists{#1.adr} |
| 208 |
{% |
| 209 |
\@ifundefined{PackageNote}{\PackageInfo}{\PackageNote}% |
| 210 |
{scraddr}{Address file `#1.adr' loaded}% |
| 211 |
}% |
| 212 |
{% |
| 213 |
\PackageError{scraddr} |
| 214 |
{File `#1.adr' not found} |
| 215 |
{The address file you wanted is not available}% |
| 216 |
} |
| 217 |
\endgroup} |
| 218 |
% \end{macrocode} |
| 219 |
% \end{command} |
| 220 |
% |
| 221 |
% \subsection{Using an element of an address file} |
| 222 |
% |
| 223 |
% Selecting the elements by names instead of cryptic macros, could be |
| 224 |
% easier. So we use well named macros for the selection. All these macros have |
| 225 |
% exactly one mandatory argument: the \meta{shortcut} which is argument 8 of |
| 226 |
% \cs{adrentry} resp. argument 9 of \cs{addrentry} in the address file. |
| 227 |
% |
| 228 |
% \begin{command}{\Name} |
| 229 |
% The \cs{Name} is a combination of \cs{Firstname} and \cs{Lastname} with a |
| 230 |
% normal word separator space in between. |
| 231 |
% \begin{macrocode} |
| 232 |
\newcommand*{\Name}[1]{\FirstName{#1}\ \LastName{#1}} |
| 233 |
% \end{macrocode} |
| 234 |
% \end{command} |
| 235 |
% \begin{command}{\FirstName} |
| 236 |
% Firstname or given from internal macro \cs{\meta{shortcut}.FN}. |
| 237 |
% \begin{macrocode} |
| 238 |
\newcommand*{\FirstName}[1]{\csname #1.FN\endcsname} |
| 239 |
% \end{macrocode} |
| 240 |
% \end{command} |
| 241 |
% \begin{command}{\LastName} |
| 242 |
% Lastname from internal macro \cs{\meta{shortcut}.LN}. |
| 243 |
% \begin{macrocode} |
| 244 |
\newcommand*{\LastName}[1]{\csname #1.LN\endcsname} |
| 245 |
% \end{macrocode} |
| 246 |
% \end{command} |
| 247 |
% \begin{command}{\Address} |
| 248 |
% Address from internal macro \cs{\meta{shortcut}.A}. |
| 249 |
% \begin{macrocode} |
| 250 |
\newcommand*{\Address}[1]{\csname #1.A\endcsname} |
| 251 |
% \end{macrocode} |
| 252 |
% \end{command} |
| 253 |
% \begin{command}{\Telephone} |
| 254 |
% Telephone number from internal macro \cs{\meta{shortcut}.P}. |
| 255 |
% \begin{macrocode} |
| 256 |
\newcommand*{\Telephone}[1]{\csname #1.P\endcsname} |
| 257 |
% \end{macrocode} |
| 258 |
% \end{command} |
| 259 |
% \begin{command}{\FreeI,\FreeII} |
| 260 |
% Two free entries from internal macros \cs{\meta{shortcut}.FI} and |
| 261 |
% \cs{\meta{shortcut}.FII}. |
| 262 |
% \begin{macrocode} |
| 263 |
\newcommand*{\FreeI}[1]{\csname #1.FI\endcsname} |
| 264 |
\newcommand*{\FreeII}[1]{\csname #1.FII\endcsname} |
| 265 |
% \end{macrocode} |
| 266 |
% \end{command} |
| 267 |
% \begin{command}{\Comment,\FreeIII} |
| 268 |
% The third free element is available by two commands, because originally it |
| 269 |
% was specified as \meta{comment}. It is stored in the internal macro |
| 270 |
% \cs{\meta{shortcut}.FIII}. |
| 271 |
% \changes{v1.1}{2002/05/18}{extended to \cs{addrentry}} |
| 272 |
% \begin{macrocode} |
| 273 |
\newcommand*{\Comment}{} |
| 274 |
\newcommand*{\FreeIII}[1]{\csname #1.FIII\endcsname} |
| 275 |
\let\Comment\FreeIII |
| 276 |
% \end{macrocode} |
| 277 |
% \end{command} |
| 278 |
% \begin{command}{\FreeIV} |
| 279 |
% Forth free entry from internal macro \cs{\meta{shortcut}.FIV} only available |
| 280 |
% with \cs{addrentry} but not woth \cs{adreentry}. |
| 281 |
% \changes{v1.1}{2002/05/18}{extended to \cs{addrentry}} |
| 282 |
% \begin{macrocode} |
| 283 |
\newcommand*{\FreeIV}[1]{\csname #1.FIV\endcsname} |
| 284 |
% \end{macrocode} |
| 285 |
% \end{command} |
| 286 |
% |
| 287 |
% \subsection{Ende of package} |
| 288 |
% \begin{macrocode} |
| 289 |
%</scraddr> |
| 290 |
% \end{macrocode} |
| 291 |
% |
| 292 |
% \Finale |
| 293 |
% \PrintChanges |
| 294 |
% |
| 295 |
\endinput |
| 296 |
% Local Variables: |
| 297 |
% mode: doctex |
| 298 |
% ispell-local-dictionary: "en_US" |
| 299 |
% eval: (flyspell-mode 1) |
| 300 |
% TeX-master: t |
| 301 |
% TeX-engine: luatex-dev |
| 302 |
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx")) |
| 303 |
% End: |
| 304 |
|