| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: askinclude.dtx |
| 4 |
% Version: 2020-04-12 v2.7 |
| 5 |
% Info: Interactive asking of included files |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 1991-1994 Pablo A. Straub |
| 9 |
% 2007, 2008, 2011 Heiko Oberdiek |
| 10 |
% 2016-2020 Oberdiek Package Support Group |
| 11 |
% https://github.com/ho-tex/askinclude/issues |
| 12 |
% |
| 13 |
% This work may be distributed and/or modified under the |
| 14 |
% conditions of the LaTeX Project Public License, either |
| 15 |
% version 1.3c of this license or (at your option) any later |
| 16 |
% version. This version of this license is in |
| 17 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 18 |
% and the latest version of this license is in |
| 19 |
% https://www.latex-project.org/lppl.txt |
| 20 |
% and version 1.3 or later is part of all distributions of |
| 21 |
% LaTeX version 2005/12/01 or later. |
| 22 |
% |
| 23 |
% This work has the LPPL maintenance status "maintained". |
| 24 |
% |
| 25 |
% The Current Maintainers of this work are |
| 26 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 27 |
% https://github.com/ho-tex/askinclude/issues |
| 28 |
% |
| 29 |
% This work consists of the main source file askinclude.dtx |
| 30 |
% and the derived files |
| 31 |
% askinclude.sty, askinclude.pdf, askinclude.ins, askinclude.drv, |
| 32 |
% |
| 33 |
% Distribution: |
| 34 |
% CTAN:macros/latex/contrib/askinclude/askinclude.dtx |
| 35 |
% CTAN:macros/latex/contrib/askinclude/askinclude.pdf |
| 36 |
% |
| 37 |
% Unpacking: |
| 38 |
% (a) If askinclude.ins is present: |
| 39 |
% tex askinclude.ins |
| 40 |
% (b) Without askinclude.ins: |
| 41 |
% tex askinclude.dtx |
| 42 |
% (c) If you insist on using LaTeX |
| 43 |
% latex \let\install=y\input{askinclude.dtx} |
| 44 |
% (quote the arguments according to the demands of your shell) |
| 45 |
% |
| 46 |
% Documentation: |
| 47 |
% (a) If askinclude.drv is present: |
| 48 |
% latex askinclude.drv |
| 49 |
% (b) Without askinclude.drv: |
| 50 |
% latex askinclude.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 |
% Programm calls to get the documentation (example): |
| 57 |
% pdflatex askinclude.dtx |
| 58 |
% bibtex askinclude.aux |
| 59 |
% makeindex -s gind.ist askinclude.idx |
| 60 |
% pdflatex askinclude.dtx |
| 61 |
% makeindex -s gind.ist askinclude.idx |
| 62 |
% pdflatex askinclude.dtx |
| 63 |
% |
| 64 |
% Installation: |
| 65 |
% TDS:tex/latex/askinclude/askinclude.sty |
| 66 |
% TDS:doc/latex/askinclude/askinclude.pdf |
| 67 |
% TDS:source/latex/askinclude/askinclude.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: askinclude 2020-04-12 v2.7 Interactive asking of included files} |
| 85 |
\Msg{************************************************************************} |
| 86 |
|
| 87 |
\keepsilent |
| 88 |
\askforoverwritefalse |
| 89 |
|
| 90 |
\let\MetaPrefix\relax |
| 91 |
\preamble |
| 92 |
|
| 93 |
This is a generated file. |
| 94 |
|
| 95 |
Project: askinclude |
| 96 |
Version: 2020-04-12 v2.7 |
| 97 |
|
| 98 |
Copyright (C) |
| 99 |
1991-1994 Pablo A. Straub |
| 100 |
2007, 2008, 2011 Heiko Oberdiek |
| 101 |
2016-2020 Oberdiek Package Support Group |
| 102 |
|
| 103 |
This work may be distributed and/or modified under the |
| 104 |
conditions of the LaTeX Project Public License, either |
| 105 |
version 1.3c of this license or (at your option) any later |
| 106 |
version. This version of this license is in |
| 107 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 108 |
and the latest version of this license is in |
| 109 |
https://www.latex-project.org/lppl.txt |
| 110 |
and version 1.3 or later is part of all distributions of |
| 111 |
LaTeX version 2005/12/01 or later. |
| 112 |
|
| 113 |
This work has the LPPL maintenance status "maintained". |
| 114 |
|
| 115 |
The Current Maintainers of this work are |
| 116 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 117 |
https://github.com/ho-tex/askinclude/issues |
| 118 |
|
| 119 |
|
| 120 |
This work consists of the main source file askinclude.dtx |
| 121 |
and the derived files |
| 122 |
askinclude.sty, askinclude.pdf, askinclude.ins, askinclude.drv, |
| 123 |
|
| 124 |
\endpreamble |
| 125 |
\let\MetaPrefix\DoubleperCent |
| 126 |
|
| 127 |
\generate{% |
| 128 |
\file{askinclude.ins}{\from{askinclude.dtx}{install}}% |
| 129 |
\file{askinclude.drv}{\from{askinclude.dtx}{driver}}% |
| 130 |
\nopreamble |
| 131 |
\nopostamble |
| 132 |
\file{askinclude.bib}{\from{askinclude.dtx}{bib}}% |
| 133 |
\usepreamble\defaultpreamble |
| 134 |
\usepostamble\defaultpostamble |
| 135 |
\usedir{tex/latex/askinclude}% |
| 136 |
\file{askinclude.sty}{\from{askinclude.dtx}{package}}% |
| 137 |
} |
| 138 |
|
| 139 |
\catcode32=13\relax% active space |
| 140 |
\let =\space% |
| 141 |
\Msg{************************************************************************} |
| 142 |
\Msg{*} |
| 143 |
\Msg{* To finish the installation you have to move the following} |
| 144 |
\Msg{* file into a directory searched by TeX:} |
| 145 |
\Msg{*} |
| 146 |
\Msg{* askinclude.sty} |
| 147 |
\Msg{*} |
| 148 |
\Msg{* To produce the documentation run the file `askinclude.drv'} |
| 149 |
\Msg{* through LaTeX.} |
| 150 |
\Msg{*} |
| 151 |
\Msg{* Happy TeXing!} |
| 152 |
\Msg{*} |
| 153 |
\Msg{************************************************************************} |
| 154 |
|
| 155 |
\endbatchfile |
| 156 |
%</install> |
| 157 |
%<*bib> |
| 158 |
@online{texlive, |
| 159 |
author={Fairbairns, Robin}, |
| 160 |
title={[tex-live] licence on includeonly.sty}, |
| 161 |
date={2007-10-13}, |
| 162 |
url={https://www.tug.org/pipermail/tex-live/2007-October/014928.html}, |
| 163 |
urldate={2011-12-02}, |
| 164 |
} |
| 165 |
@online{newsthread, |
| 166 |
author={Vo{\ss}, Herbert}, |
| 167 |
title={askinclude.sty}, |
| 168 |
note={Thread in newsgroup {\xnewsgroup{comp.text.tex}}; |
| 169 |
Message-ID: {\texttt{fev72m\$b35\$02\[email protected]}}}, |
| 170 |
date={2007-10-15}, |
| 171 |
url={https://groups.google.com/group/comp.text.tex/browse_thread/thread/728a3e73c04c6789/349e31865c40d00c}, |
| 172 |
urldate={2011-12-02}, |
| 173 |
} |
| 174 |
@manual{makematch, |
| 175 |
author={Kastrup, David}, |
| 176 |
title={makematch.sty: Pattern matching with wildcards}, |
| 177 |
date={2007-02-23}, |
| 178 |
version={1.7925}, |
| 179 |
url={https://ctan.org/pkg/qstest}, |
| 180 |
urldate={2011-12-02}, |
| 181 |
} |
| 182 |
@manual{excludeonly, |
| 183 |
author={Luecking, Daniel H. and Arseneau, Donald}, |
| 184 |
title={The excludeonly package}, |
| 185 |
date={2003-03-14}, |
| 186 |
url={https://ctan.org/pkg/excludeonly}, |
| 187 |
urldate={2011-12-02}, |
| 188 |
} |
| 189 |
%</bib> |
| 190 |
%<*ignore> |
| 191 |
\fi |
| 192 |
%</ignore> |
| 193 |
%<*driver> |
| 194 |
\NeedsTeXFormat{LaTeX2e} |
| 195 |
\ProvidesFile{askinclude.drv}% |
| 196 |
[2020-04-12 v2.7 Interactive asking of included files]% |
| 197 |
\documentclass{ltxdoc} |
| 198 |
\usepackage{holtxdoc}[2011/11/22] |
| 199 |
\usepackage{iftex} |
| 200 |
\ifluatex |
| 201 |
\else |
| 202 |
\usepackage[T1]{fontenc}% |
| 203 |
\usepackage{lmodern}% |
| 204 |
\fi |
| 205 |
\usepackage{csquotes} |
| 206 |
\usepackage[ |
| 207 |
backend=bibtex, |
| 208 |
bibencoding=ascii, |
| 209 |
alldates=iso,seconds=true, |
| 210 |
]{biblatex}[2011/11/13] |
| 211 |
\bibliography{oberdiek-source} |
| 212 |
\bibliography{askinclude} |
| 213 |
\begin{document} |
| 214 |
\DocInput{askinclude.dtx}% |
| 215 |
\end{document} |
| 216 |
%</driver> |
| 217 |
% \fi |
| 218 |
% |
| 219 |
% |
| 220 |
% |
| 221 |
% \GetFileInfo{askinclude.drv} |
| 222 |
% |
| 223 |
% \title{The \xpackage{askinclude} package} |
| 224 |
% \date{2020-04-12 v2.7} |
| 225 |
% \author{ |
| 226 |
% Pablo A. Straub\\[1ex] |
| 227 |
% Heiko Oberdiek\thanks |
| 228 |
% {Please report any issues at \url{https://github.com/ho-tex/askinclude/issues}}} |
| 229 |
% |
| 230 |
% |
| 231 |
% \maketitle |
| 232 |
% |
| 233 |
% \begin{abstract} |
| 234 |
% This package replaces \cs{includeonly} by an interactive user |
| 235 |
% interface. |
| 236 |
% \end{abstract} |
| 237 |
% |
| 238 |
% \tableofcontents |
| 239 |
% |
| 240 |
% \section{Documentation} |
| 241 |
% |
| 242 |
% \subsection{User interface} |
| 243 |
% |
| 244 |
% The \cs{include} feature of \LaTeX\ allows the division of |
| 245 |
% the text body in separate compilation units. It is page |
| 246 |
% based and stores counter settings in additional auxiliary |
| 247 |
% files. \cs{includeonly} limits the actually included files |
| 248 |
% to the ones, listed in its argument. |
| 249 |
% |
| 250 |
% Example: |
| 251 |
%\begin{quote} |
| 252 |
%\begin{verbatim} |
| 253 |
%\documentclass{report} |
| 254 |
% |
| 255 |
%\usepackage{askinclude} |
| 256 |
% |
| 257 |
% % Don't use \include in the preamble. |
| 258 |
% % Instead \input can be used or make a package |
| 259 |
% |
| 260 |
%\begin{document} |
| 261 |
%\include{title} |
| 262 |
%\include{introduction} |
| 263 |
%\include{summary} |
| 264 |
%\include{index} |
| 265 |
%\end{document} |
| 266 |
%\end{verbatim} |
| 267 |
%\end{quote} |
| 268 |
% |
| 269 |
% Package \xpackage{askinclude} adds an interactive user interface. |
| 270 |
% The user is asked which files he want to include and sets |
| 271 |
% \cs{includeonly} accordingly. |
| 272 |
% |
| 273 |
% The first time the package is used the question looks like: |
| 274 |
%\begin{quote} |
| 275 |
%\begin{verbatim} |
| 276 |
%*********************************** |
| 277 |
%*** Package askinclude Question *** |
| 278 |
%*********************************** |
| 279 |
% |
| 280 |
%Previous answer (noregexp): |
| 281 |
% [*] |
| 282 |
% |
| 283 |
%Regular expressions: |
| 284 |
% --> [noregexp] disabled |
| 285 |
% [makematch] enabled, using package `makematch' |
| 286 |
% [pdfmatch] enabled, using pdfTeX's \pdfmatch |
| 287 |
% |
| 288 |
%Which files do you want to include? |
| 289 |
% [foo,bar] comma separated file or pattern list |
| 290 |
% [*] all files |
| 291 |
% [-] no files |
| 292 |
% [?] ask for each file |
| 293 |
% [] use the previous answer |
| 294 |
% |
| 295 |
%\answer=chapter2,summary |
| 296 |
%\end{verbatim} |
| 297 |
%\end{quote} |
| 298 |
% Square brackets are used as quotation symbols, |
| 299 |
% they are not part of the answer. |
| 300 |
% The answer by the user follows in the last line after |\answer=|. |
| 301 |
% \begin{description} |
| 302 |
% \def\Item[#1]{\item[{[\texttt{#1}]:}]} |
| 303 |
% \Item[foo,bar] |
| 304 |
% A comma separated file list (also one file only) is passed |
| 305 |
% to macro \cs{includeonly} directly. If regular expression support |
| 306 |
% is enabled, the entries in the list are interpreted as |
| 307 |
% file name patterns that will be matched against the file names |
| 308 |
% in \cs{include}, see \hyperref[sec:regexp]{section \ref*{sec:regexp}}. |
| 309 |
% \Item[*] This is a shortcut for specifying \emph{all} files. |
| 310 |
% \Item[-] This means \emph{none} of the files is included. |
| 311 |
% \Item[?] The switches in single asking mode. |
| 312 |
% The user will be asked at each \cs{include}. |
| 313 |
% See section \hyperref[sec:single]{section \ref*{sec:single}}. |
| 314 |
% \Item[] Just pressing return (empty string) uses the default |
| 315 |
% answer, that was stored in the auxiliary file (\xfile{.aux}) |
| 316 |
% of the previous \LaTeX run with package \xpackage{askinclude}. |
| 317 |
% Without previous runs the default is [|*|] for all files. |
| 318 |
% \Item[noregexp] Turns regular expression support off. |
| 319 |
% \Item[makematch] Enables regular expression support |
| 320 |
% package \xpackage{makematch} provides. |
| 321 |
% \Item[pdfmatch] It is shown, if \pdfTeX~1.30 or later is used. |
| 322 |
% It relies on an undocumented feature \cs{pdfmatch} that may |
| 323 |
% change in future versions of \pdfTeX. |
| 324 |
% \end{description} |
| 325 |
% Package \xpackage{askinclude} remembers the files of \cs{include} |
| 326 |
% in the auxiliary file and the given answer. they are |
| 327 |
% presented at the next run |
| 328 |
% at the start of the question: |
| 329 |
%\begin{quote} |
| 330 |
%\begin{verbatim} |
| 331 |
%*********************************** |
| 332 |
%*** Package askinclude Question *** |
| 333 |
%*********************************** |
| 334 |
% |
| 335 |
%Files, found by previous run in \include: |
| 336 |
% (-) title |
| 337 |
% (-) introduction |
| 338 |
% (-) chapter1 |
| 339 |
% (+) chapter2 |
| 340 |
% (-) chapter3 |
| 341 |
% (+) summary |
| 342 |
% |
| 343 |
%Previous answer (noregexp): |
| 344 |
% [chapter2,summary] |
| 345 |
%... |
| 346 |
%\end{verbatim} |
| 347 |
%\end{quote} |
| 348 |
% |(+)| and |(-)| marks files that were and were not included in |
| 349 |
% the previous run. The file list and marks are not always correct. |
| 350 |
% For example, if \cs{include} statements are added or removed. |
| 351 |
% If the method of regular expression support is different, |
| 352 |
% then the marks only reflects the mode of the previous answer. |
| 353 |
% |
| 354 |
% \subsection{Single asking mode} |
| 355 |
% \label{sec:single} |
| 356 |
% |
| 357 |
% The special answer `|?|' trigger single asking mode, |
| 358 |
% at the next \cs{include} the user is asked again: |
| 359 |
%\begin{quote} |
| 360 |
%\begin{verbatim} |
| 361 |
%*********************************** |
| 362 |
%*** Package askinclude Question *** |
| 363 |
%*********************************** |
| 364 |
% |
| 365 |
%Include `title'? [y]es, [n]o, [A]ll, [N]one, [D]efault (n): |
| 366 |
% |
| 367 |
%\answer= |
| 368 |
%\end{verbatim} |
| 369 |
%\end{quote} |
| 370 |
% Use the letter inside the square brackets as answer. |
| 371 |
% An empty string uses the default answer, the letter in parentheses. |
| 372 |
% The answers are: |
| 373 |
% \begin{description} |
| 374 |
% \def\Item[#1]{\item[{[\texttt{#1}]:}]} |
| 375 |
% \Item[y] The file is included. |
| 376 |
% \Item[n] The file is excluded. |
| 377 |
% \Item[A] This file and all following files are included. |
| 378 |
% \Item[N] This file and all following files are excluded. |
| 379 |
% \Item[D] Use the default answer for this and all following files. |
| 380 |
% \end{description} |
| 381 |
% If the file is known from the previous run, then the |
| 382 |
% default is `|y|' or `|n|' corresponding to the mark |
| 383 |
% `|(+)|' or `|(-)|' in the list of previous files. |
| 384 |
% Otherwise `|y|' is used as default. |
| 385 |
% |
| 386 |
% \subsection{Regular expressions} |
| 387 |
% \label{sec:regexp} |
| 388 |
% |
| 389 |
% Three methods are available that can also set by package options: |
| 390 |
% \begin{description} |
| 391 |
% \def\Item[#1]{\item[\xoption{#1}:]} |
| 392 |
% \Item[noregexp] Regular expression support is disabled. |
| 393 |
% \Item[makematch] Use package \xpackage{makematch}. |
| 394 |
% \Item[pdfmatch] Use \pdfTeX's \cs{pdfmatch} if available. |
| 395 |
% \end{description} |
| 396 |
% Without options the value remembered in the auxiliary file |
| 397 |
% is used, otherwise the default is \xoption{noregexp}. |
| 398 |
% |
| 399 |
% \subsubsection{Method \xoption{makematch}} |
| 400 |
% |
| 401 |
% Package \xpackage{makematch} (part of \xpackage{qstest}), written |
| 402 |
% by David Kastrup provides pattern matching based on wildcards: |
| 403 |
% \begin{description} |
| 404 |
% \item[{[\texttt{*}]}:] The star matches zero or more characters. |
| 405 |
% Thus a lonely star machtes anything. |
| 406 |
% \item[{[\texttt{!}]}:] The exclamation mark at the begin of a |
| 407 |
% pattern negates it, thus the matching files are excluded. |
| 408 |
% \end{description} |
| 409 |
% The pattern list is evaluated for a file name from left to |
| 410 |
% right. Always a file name must match the whole pattern. |
| 411 |
% The file is included if it is matched by a pattern and |
| 412 |
% not excluded afterwards. Examples: |
| 413 |
% \begin{quote} |
| 414 |
% \def\no{\textrm{$\emptyset$}} |
| 415 |
% \begin{tabular}{>{\ttfamily}l|>{\ttfamily}l|>{\ttfamily}l} |
| 416 |
% \textrm{Pattern list} & \textrm{File names} & \textrm{Result}\\ |
| 417 |
% \hline |
| 418 |
% foobar & foobar,dummy & foobar\\ |
| 419 |
% foo* & foobar,xfoobar & foobar\\ |
| 420 |
% \relax *foo* & xfoobar & xfoobar\\ |
| 421 |
% f*b*r & foobar & foobar\\ |
| 422 |
% \relax * & any & any\\ |
| 423 |
% !foobar & foobar,other & other\\ |
| 424 |
% !foo* & xfoobar & xfoobar\\ |
| 425 |
% in*,!*dex & intro,index & intro\\ |
| 426 |
% !index,in* & intro,index & intro,index\\ |
| 427 |
% \relax *,!chap2 & chap1,chap2,chap3 & chap1,chap3\\ |
| 428 |
% \end{tabular} |
| 429 |
% \end{quote} |
| 430 |
% The example in the last line shows, how the behaviour of package |
| 431 |
% \xpackage{excludeonly} \cite{excludeonly} can be simulated. |
| 432 |
% |
| 433 |
% The documentation of package \xpackage{makematch} tells the |
| 434 |
% the empty pattern does not match anything. But if you answer |
| 435 |
% the question with an empty string the answer of the previous |
| 436 |
% run is used. Also curly braces are not reliable because the |
| 437 |
% can get stripped during the processing of the answer. |
| 438 |
% Using a pair of empty curly braces or the comma for two empty |
| 439 |
% patterns currently works, but this is specific for the current |
| 440 |
% implementation and may change in future. But the special |
| 441 |
% answer `-' is available. |
| 442 |
% |
| 443 |
% \subsubsection{Method \xoption{pdfmatch}} |
| 444 |
% |
| 445 |
% In \pdfTeX\ 1.30 the new primitive \cs{pdfmatch} was introduced. |
| 446 |
% It is not documented yet, because it was not decided if it remains |
| 447 |
% and which implementation of regular expressions should be used. |
| 448 |
% Thus the situation may change in later versions of \pdfTeX. |
| 449 |
% Currently (1.30 until 1.40) it uses a library for POSIX 1003.2 regular |
| 450 |
% expressions, see manual page ``regex(7)''. |
| 451 |
% |
| 452 |
% If a pattern in the pattern list is invalid, the package prints |
| 453 |
% a warning and removes the pattern from the list. Actually there |
| 454 |
% are two warnings, the other warning is generated by \pdfTeX\ itself. |
| 455 |
% |
| 456 |
% In opposite to \xoption{makematch} the pattern only needs to |
| 457 |
% match the specified part of the file name. |
| 458 |
% For matching the whole name, the symbols `|^|' and `|$|' for |
| 459 |
% begin and end of string must be included. |
| 460 |
% |
| 461 |
% Additionally an initial exclamation mark `|!|' implements the |
| 462 |
% same logic as method \xoption{makematch}. The match result is |
| 463 |
% inverted, the matched file excluded. |
| 464 |
% |
| 465 |
% Examples: |
| 466 |
% \begin{quote} |
| 467 |
% \def\no{\textrm{$\emptyset$}} |
| 468 |
% \begin{tabular}{>{\ttfamily}l|>{\ttfamily}l|>{\ttfamily}l} |
| 469 |
% \textrm{Pattern list} & \textrm{File names} & \textrm{Result}\\ |
| 470 |
% \hline |
| 471 |
% foobar & foobar,dummy & foobar\\ |
| 472 |
% foo.* & foobar,xfoobar & foobar,xfoobar\\ |
| 473 |
% |^|foo.* & foobar,xfoobar & foobar\\ |
| 474 |
% foo|$| & foo,foobar & foo\\ |
| 475 |
% fo?bar & fbar,fobar,foobar & fbar,fobar\\ |
| 476 |
% fo+bar & fbar,fobar,foobar & fobar,foobar\\ |
| 477 |
% fo*bar & fbar,fobar,foobar & fbar,fobar,foobar\\ |
| 478 |
% chap3 & chap3,chap32 & chap1,chap3,chap32\\ |
| 479 |
% chap[13] & chap1,chap2,chap3 & chap1,chap3\\ |
| 480 |
% chap(1\string|3)|$| & chap1,chap3,chap33 & chap1,chap3\\ |
| 481 |
% .* & any & any\\ |
| 482 |
% !foobar & foobar,other & other\\ |
| 483 |
% in.*,!dex & intro,index & intro\\ |
| 484 |
% !index,in.* & intro,index & intro,index\\ |
| 485 |
% .*,!chap2 & chap1,chap2,chap3 & chap1,chap3\\ |
| 486 |
% .*,!bla & foo,bla,blabla & foo\\ |
| 487 |
% .*,!|^|bla|$| & foo,bla,blabla & foo,blabla\\ |
| 488 |
% \end{tabular} |
| 489 |
% \end{quote} |
| 490 |
% The example in the last line shows, how the behaviour of package |
| 491 |
% \xpackage{excludeonly} \cite{excludeonly} can be simulated. |
| 492 |
% As the third last line shows, that sometimes `|^|' and `|$|' can |
| 493 |
% be omitted, but this will not work always, shown in the second |
| 494 |
% last line. |
| 495 |
% |
| 496 |
% \subsection{History} |
| 497 |
% |
| 498 |
% Package \xpackage{askinclude} was invented by Pablo A. Straub in 1991 |
| 499 |
% and maintained until 1994. |
| 500 |
% ^^A Email address: pablo.straub \symbol{64} gmail.com |
| 501 |
% |
| 502 |
% In October 2007 it was removed from ``TeX Live'' because of |
| 503 |
% the no-commercial license \cite{texlive}. Herbert Vo\ss\ initiated |
| 504 |
% a search for the author in the newsgroup \xnewsgroup{comp.text.tex} |
| 505 |
% \cite{newsthread} to ask him to change the license. |
| 506 |
% |
| 507 |
% It seems that the author could not be reached any more. |
| 508 |
% Joseph Wright suggested a reimplementation that I (HO) have done |
| 509 |
% as package \xpackage{askinc}. Soon it was enhanced by |
| 510 |
% feature requests. |
| 511 |
% |
| 512 |
% Then Ulrike Fischer found email addresses of the original author |
| 513 |
% and Jim Hefferon succeeded in contacting him. He allowed a change |
| 514 |
% of the license to LPPL and the transfer of the maintainership |
| 515 |
% to someone else. |
| 516 |
% |
| 517 |
% Thus I merged both packages as \xpackage{askinclude} in a new |
| 518 |
% major version 2. The license is LPPL. |
| 519 |
% |
| 520 |
% \subsection{New features of version 2} |
| 521 |
% |
| 522 |
% \begin{itemize} |
| 523 |
% \item License is now LPPL. |
| 524 |
% \item A list of \cs{include} files that are detected by the previous |
| 525 |
% run is printed before the question. |
| 526 |
% \item If the special answer `|?|' is given, then the user is |
| 527 |
% asked at each \cs{include}. |
| 528 |
% \item Support for regular expressions. |
| 529 |
% \item The remaining stuff in the \xfile{.aux} file does not |
| 530 |
% cause errors, if the package is removed. |
| 531 |
% \item The use of \cs{includeonly} before the package loading time |
| 532 |
% is detected and respected by taking precedence. After the package |
| 533 |
% is loaded, \cs{includeonly} is disabled and prints a warning. |
| 534 |
% \end{itemize} |
| 535 |
% |
| 536 |
% \subsection{Compatibility to version 1} |
| 537 |
% |
| 538 |
% \begin{itemize} |
| 539 |
% \item The user interface of version 1 with its special answers |
| 540 |
% `|*|', `|-|', and `' remain unchanged, but it is extended by |
| 541 |
% version 2 with the special answer `|?|' and support for |
| 542 |
% regular expressions can be enabled. |
| 543 |
% \item As reimplementation the internal macros have changed of course. |
| 544 |
% \item \xfile{.aux} files that are written by version 1.x will work |
| 545 |
% with version 2.x because \cs{@includeonly} is recognized. |
| 546 |
% \item \LaTeX\ 2.09: The package works as \cs{documentstyle} option |
| 547 |
% in compatibility mode of \LaTeXe. It is possible that it |
| 548 |
% will not work in pure \LaTeX\ 2.09. |
| 549 |
% \end{itemize} |
| 550 |
% |
| 551 |
% \StopEventually{ |
| 552 |
% } |
| 553 |
% |
| 554 |
% \section{Implementation} |
| 555 |
% |
| 556 |
% \subsection{Header and catcodes} |
| 557 |
% |
| 558 |
% \begin{macrocode} |
| 559 |
%<*package> |
| 560 |
\NeedsTeXFormat{LaTeX2e} |
| 561 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 562 |
\catcode13=5 % ^^M |
| 563 |
\endlinechar=13 % |
| 564 |
\catcode123=1 % { |
| 565 |
\catcode125=2 % } |
| 566 |
\catcode64=11 % @ |
| 567 |
\def\x{\endgroup |
| 568 |
\expandafter\edef\csname AskInc@AtEnd\endcsname{% |
| 569 |
\endlinechar=\the\endlinechar\relax |
| 570 |
\catcode13=\the\catcode13\relax |
| 571 |
\catcode32=\the\catcode32\relax |
| 572 |
\catcode35=\the\catcode35\relax |
| 573 |
\catcode61=\the\catcode61\relax |
| 574 |
\catcode64=\the\catcode64\relax |
| 575 |
\catcode123=\the\catcode123\relax |
| 576 |
\catcode125=\the\catcode125\relax |
| 577 |
}% |
| 578 |
}% |
| 579 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 580 |
\catcode13=5 % ^^M |
| 581 |
\endlinechar=13 % |
| 582 |
\catcode35=6 % # |
| 583 |
\catcode64=11 % @ |
| 584 |
\catcode123=1 % { |
| 585 |
\catcode125=2 % } |
| 586 |
\def\TMP@EnsureCode#1#2{% |
| 587 |
\edef\AskInc@AtEnd{% |
| 588 |
\AskInc@AtEnd |
| 589 |
\catcode#1=\the\catcode#1\relax |
| 590 |
}% |
| 591 |
\catcode#1=#2\relax |
| 592 |
} |
| 593 |
\TMP@EnsureCode{33}{12}% ! |
| 594 |
\TMP@EnsureCode{39}{12}% ' |
| 595 |
\TMP@EnsureCode{40}{12}% ( |
| 596 |
\TMP@EnsureCode{41}{12}% ) |
| 597 |
\TMP@EnsureCode{42}{12}% * |
| 598 |
\TMP@EnsureCode{43}{12}% + |
| 599 |
\TMP@EnsureCode{44}{12}% , |
| 600 |
\TMP@EnsureCode{45}{12}% - |
| 601 |
\TMP@EnsureCode{46}{12}% . |
| 602 |
\TMP@EnsureCode{47}{12}% / |
| 603 |
\TMP@EnsureCode{58}{12}% : |
| 604 |
\TMP@EnsureCode{62}{12}% > |
| 605 |
\TMP@EnsureCode{63}{12}% ? |
| 606 |
\TMP@EnsureCode{91}{12}% [ |
| 607 |
\TMP@EnsureCode{93}{12}% ] |
| 608 |
\TMP@EnsureCode{96}{12}% ` |
| 609 |
\edef\AskInc@AtEnd{\AskInc@AtEnd\noexpand\endinput} |
| 610 |
\ProvidesPackage{askinclude}% |
| 611 |
[2020-04-12 v2.7 Interactive asking of included files]% |
| 612 |
% \end{macrocode} |
| 613 |
% |
| 614 |
% Luatex compat |
| 615 |
% \begin{macrocode} |
| 616 |
\ifx\pdfextension\@undefined\else |
| 617 |
\protected\def\pdflastobj {\numexpr\pdffeedback lastobj\relax} |
| 618 |
\protected\def\pdfnames {\pdfextension names } |
| 619 |
\protected\def\pdfobj {\pdfextension obj } |
| 620 |
\let\pdfoutput \outputmode |
| 621 |
\fi |
| 622 |
% \end{macrocode} |
| 623 |
% |
| 624 |
% \subsection{Delay action after preamble} |
| 625 |
% |
| 626 |
% \begin{macro}{\AskInc@AtBeginDocument} |
| 627 |
% Some actions such as \xfile{.aux} file writing cannot be |
| 628 |
% performed in the preamble. \cs{AtBeginDocument} delays |
| 629 |
% such action until |\begin{document}|. However \cs{AtBeginDocument} |
| 630 |
% must not be used after that time (\cs{@onlypreamble}). |
| 631 |
% Thus \cs{AskInc@AtBeginDocument} uses \cs{AtBeginDocument} |
| 632 |
% in the preamble and afterwards executes the code immediately. |
| 633 |
% \begin{macrocode} |
| 634 |
\AtBeginDocument{% |
| 635 |
\let\AskInc@AtBeginDocument\@firstofone |
| 636 |
} |
| 637 |
\providecommand*{\AskInc@AtBeginDocument}{\AtBeginDocument} |
| 638 |
% \end{macrocode} |
| 639 |
% \end{macro} |
| 640 |
% |
| 641 |
% \subsection{Write entry in \xfile{.aux} file} |
| 642 |
% |
| 643 |
% \begin{macro}{\AskInc@WriteAux} |
| 644 |
% The first argument is written to the main \xfile{.aux} file |
| 645 |
% and the second argument is executed if writing was possible. |
| 646 |
% Remember \cs{nofiles} prevents writing to auxiliary files. |
| 647 |
% \begin{macrocode} |
| 648 |
\def\AskInc@WriteAux#1#2{% |
| 649 |
\AskInc@AtBeginDocument{% |
| 650 |
\if@filesw |
| 651 |
\immediate\write\@mainaux{#1}% |
| 652 |
#2% |
| 653 |
\fi |
| 654 |
}% |
| 655 |
} |
| 656 |
% \end{macrocode} |
| 657 |
% \end{macro} |
| 658 |
% |
| 659 |
% \subsection{Remember \cs{include} files} |
| 660 |
% |
| 661 |
% \begin{macro}{\AskInc@CharHash} |
| 662 |
% \begin{macrocode} |
| 663 |
\edef\AskInc@CharHash{\string#} |
| 664 |
% \end{macrocode} |
| 665 |
% \end{macro} |
| 666 |
% |
| 667 |
% \begin{macro}{\AskInc@WriteDefAddList} |
| 668 |
% \begin{macrocode} |
| 669 |
\def\AskInc@WriteDefAddList{% |
| 670 |
\AskInc@WriteAux{% |
| 671 |
% \end{macrocode} |
| 672 |
% \begin{macro}{\AskInc@AddList} |
| 673 |
% \begin{macrocode} |
| 674 |
\string\providecommand*\string\AskInc@AddList[2]{% |
| 675 |
\string\ifcase\string\ifx\AskInc@CharHash1\string\@undefined |
| 676 |
\string\else |
| 677 |
\string\ifx\AskInc@CharHash1\string\relax |
| 678 |
\string\else |
| 679 |
\string\ifx\AskInc@CharHash1\string\@empty |
| 680 |
\string\else |
| 681 |
1% |
| 682 |
\string\fi |
| 683 |
\string\fi |
| 684 |
\string\fi |
| 685 |
0 % |
| 686 |
\string\gdef\AskInc@CharHash1{\AskInc@CharHash2}% |
| 687 |
\string\else |
| 688 |
\string\g@addto@macro\AskInc@CharHash1{,\AskInc@CharHash2}% |
| 689 |
\string\fi |
| 690 |
}% |
| 691 |
% \end{macrocode} |
| 692 |
% \end{macro} |
| 693 |
% \begin{macrocode} |
| 694 |
}{% |
| 695 |
\global\let\AskInc@WriteDefAddList\relax |
| 696 |
}% |
| 697 |
} |
| 698 |
% \end{macrocode} |
| 699 |
% \end{macro} |
| 700 |
% \begin{macro}{\AskInc@WriteDefAddFile} |
| 701 |
% \begin{macrocode} |
| 702 |
\def\AskInc@WriteDefAddFile{% |
| 703 |
\AskInc@WriteDefAddList |
| 704 |
\AskInc@WriteAux{% |
| 705 |
% \end{macrocode} |
| 706 |
% \begin{macro}{\AskInc@AddFile} |
| 707 |
% \begin{macrocode} |
| 708 |
\string\providecommand\string\AskInc@AddFile{% |
| 709 |
\string\AskInc@AddList\string\AskInc@Files |
| 710 |
}% |
| 711 |
% \end{macrocode} |
| 712 |
% \end{macro} |
| 713 |
% \begin{macrocode} |
| 714 |
}{% |
| 715 |
\global\let\AskInc@WriteDefAddFile\relax |
| 716 |
}% |
| 717 |
} |
| 718 |
% \end{macrocode} |
| 719 |
% \end{macro} |
| 720 |
% \begin{macro}{\AskInc@AddFile} |
| 721 |
% \begin{macrocode} |
| 722 |
\AtBeginDocument{% |
| 723 |
\global\let\AskInc@AddFile\@gobble |
| 724 |
} |
| 725 |
% \end{macrocode} |
| 726 |
% \end{macro} |
| 727 |
% \begin{macro}{\AskInc@WriteAddFile} |
| 728 |
% \begin{macrocode} |
| 729 |
\def\AskInc@WriteAddFile#1{% |
| 730 |
\AskInc@WriteDefAddFile |
| 731 |
\AskInc@WriteAux{% |
| 732 |
\string\AskInc@AddFile{#1}% |
| 733 |
}{}% |
| 734 |
} |
| 735 |
% \end{macrocode} |
| 736 |
% \end{macro} |
| 737 |
% \begin{macro}{\AskInc@Files} |
| 738 |
% \begin{macrocode} |
| 739 |
\providecommand*{\AskInc@Files}{} |
| 740 |
% \end{macrocode} |
| 741 |
% \end{macro} |
| 742 |
% |
| 743 |
% \paragraph{Summary:} |
| 744 |
% Now \cs{AskInc@Files} is always defined |
| 745 |
% and either empty or contains a comma separated list of |
| 746 |
% \cs{include} files of previous run. |
| 747 |
% |
| 748 |
% The \cs{include} files are remembered by using |
| 749 |
% \cs{AskInc@WriteAddFile} at each \cs{include}. |
| 750 |
% |
| 751 |
% \subsection{Redefine \cs{include}} |
| 752 |
% |
| 753 |
% \begin{macro}{\AskInc@OrgInclude} |
| 754 |
% \begin{macrocode} |
| 755 |
\newcommand{\AskInc@OrgInclude}{} |
| 756 |
\let\AskInc@OrgInclude\include |
| 757 |
% \end{macrocode} |
| 758 |
% \end{macro} |
| 759 |
% \begin{macro}{\AskInc@AskFile} |
| 760 |
% \begin{macrocode} |
| 761 |
\let\AskInc@AskFile\@gobble |
| 762 |
% \end{macrocode} |
| 763 |
% \end{macro} |
| 764 |
% \begin{macro}{\AskInc@MatchFile} |
| 765 |
% \begin{macrocode} |
| 766 |
\let\AskInc@MatchFile\@gobble |
| 767 |
% \end{macrocode} |
| 768 |
% \end{macro} |
| 769 |
% \begin{macro}{\include} |
| 770 |
% \begin{macrocode} |
| 771 |
\renewcommand*{\include}[1]{% |
| 772 |
\AskInc@WriteAddFile{#1}% |
| 773 |
\AskInc@AskFile{#1}% |
| 774 |
\AskInc@MatchFile{#1}% |
| 775 |
\AskInc@OrgInclude{#1}% |
| 776 |
} |
| 777 |
% \end{macrocode} |
| 778 |
% \end{macro} |
| 779 |
% |
| 780 |
% \subsection{Store answer and match method in \xfile{.aux} file} |
| 781 |
% |
| 782 |
% \begin{macrocode} |
| 783 |
\AtEndOfPackage{% |
| 784 |
\AtBeginDocument{% |
| 785 |
\@ifundefined{AskInc@Answer}{}{% |
| 786 |
\AskInc@WriteAux{% |
| 787 |
\string\gdef\string\AskInc@Answer{\AskInc@Answer}% |
| 788 |
}{}% |
| 789 |
}% |
| 790 |
\@ifundefined{AskInc@MatchMethod}{}{% |
| 791 |
\AskInc@WriteAux{% |
| 792 |
\string\gdef\string\AskInc@MatchMethod{\AskInc@MatchMethod}% |
| 793 |
}{}% |
| 794 |
}% |
| 795 |
}% |
| 796 |
} |
| 797 |
% \end{macrocode} |
| 798 |
% |
| 799 |
% \subsection{Support for \cs{@includeonly}} |
| 800 |
% |
| 801 |
% \begin{macro}{\@includeonly} |
| 802 |
% Macro \cs{@includeonly} is defined for compatiblity reasons only, |
| 803 |
% if the \xfile{.aux} file was written by versions before 2 of package |
| 804 |
% \xpackage{askinclude}. |
| 805 |
% \begin{macrocode} |
| 806 |
\providecommand*{\@includeonly}[1]{% |
| 807 |
\gdef\AskInc@Answer{#1}% |
| 808 |
\ifx\AskInc@Answer\@empty |
| 809 |
\gdef\AskInc@Answer{-}% |
| 810 |
\fi |
| 811 |
\global\let\AskInc@MatchMethod\@empty |
| 812 |
} |
| 813 |
% \end{macrocode} |
| 814 |
% \end{macro} |
| 815 |
% |
| 816 |
% \subsection{Stop if \cs{includeonly} is active} |
| 817 |
% |
| 818 |
% If \cs{includeonly} is used before, the questions are skipped |
| 819 |
% and the data in the main auxiliary file is preserved. |
| 820 |
% \begin{macrocode} |
| 821 |
\if@partsw |
| 822 |
\PackageWarningNoLine{askinclude}{% |
| 823 |
Previous \string\includeonly\space detected,\MessageBreak |
| 824 |
therefore asking for files is suppressed% |
| 825 |
}% |
| 826 |
% \end{macrocode} |
| 827 |
% Dummy options. |
| 828 |
% \begin{macrocode} |
| 829 |
\DeclareOption{makematch}{}% |
| 830 |
\DeclareOption{pdfmatch}{}% |
| 831 |
\DeclareOption{noregexp}{}% |
| 832 |
\ProcessOptions*% |
| 833 |
% \end{macrocode} |
| 834 |
% Preserve \cs{AskInc@MatchFiles}. |
| 835 |
% \begin{macrocode} |
| 836 |
\@ifundefined{AskInc@MatchFiles}{% |
| 837 |
}{% |
| 838 |
\ifx\AskInc@MatchMethod\@empty |
| 839 |
\else |
| 840 |
\AskInc@WriteAux{% |
| 841 |
\string\gdef\string\AskInc@MatchFiles{\AskInc@MatchFiles}% |
| 842 |
}{}% |
| 843 |
\fi |
| 844 |
}% |
| 845 |
\expandafter\AskInc@AtEnd |
| 846 |
\fi% |
| 847 |
% \end{macrocode} |
| 848 |
% |
| 849 |
% \subsection{\cs{includeonly}} |
| 850 |
% |
| 851 |
% \begin{macro}{\AskInc@OrgIncludeOnly} |
| 852 |
% \begin{macrocode} |
| 853 |
\newcommand{\AskInc@OrgIncludeOnly}{}% |
| 854 |
\let\AskInc@OrgIncludeOnly\includeonly |
| 855 |
% \end{macrocode} |
| 856 |
% \end{macro} |
| 857 |
% \begin{macro}{\includeonly} |
| 858 |
% \begin{macrocode} |
| 859 |
\renewcommand*{\includeonly}[1]{% |
| 860 |
\PackageWarning{askinclude}{% |
| 861 |
\string\includeonly\space is managed by package `askinclude',% |
| 862 |
\MessageBreak |
| 863 |
therefore it is ignored% |
| 864 |
}% |
| 865 |
} |
| 866 |
% \end{macrocode} |
| 867 |
% \end{macro} |
| 868 |
% |
| 869 |
% \subsection{Options} |
| 870 |
% |
| 871 |
% \begin{macro}{\AskInc@StringNoRegExp} |
| 872 |
% \begin{macrocode} |
| 873 |
\def\AskInc@StringNoRegExp{noregexp} |
| 874 |
% \end{macrocode} |
| 875 |
% \end{macro} |
| 876 |
% \begin{macro}{\AskInc@StringMakeMatch} |
| 877 |
% \begin{macrocode} |
| 878 |
\def\AskInc@StringMakeMatch{makematch} |
| 879 |
% \end{macrocode} |
| 880 |
% \end{macro} |
| 881 |
% \begin{macro}{\AskInc@StringPdfMatch} |
| 882 |
% \begin{macrocode} |
| 883 |
\def\AskInc@StringPdfMatch{pdfmatch} |
| 884 |
% \end{macrocode} |
| 885 |
% \end{macro} |
| 886 |
% \begin{macro}{\ifAskInc@PdfMatchAvailable} |
| 887 |
% \begin{macrocode} |
| 888 |
\newif\ifAskInc@PdfMatchAvailable |
| 889 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 890 |
\expandafter\ifx\csname pdfmatch\endcsname\relax |
| 891 |
\else |
| 892 |
\AskInc@PdfMatchAvailabletrue |
| 893 |
\fi |
| 894 |
% \end{macrocode} |
| 895 |
% \end{macro} |
| 896 |
% \begin{macrocode} |
| 897 |
\DeclareOption{makematch}{% |
| 898 |
\let\AskInc@MatchOption\AskInc@StringMakeMatch |
| 899 |
} |
| 900 |
\ifAskInc@PdfMatchAvailable |
| 901 |
\DeclareOption{pdfmatch}{% |
| 902 |
\let\AskInc@MatchOption\AskInc@StringPdfMatch |
| 903 |
}% |
| 904 |
\else |
| 905 |
\DeclareOption{pdfmatch}{% |
| 906 |
\PackageWarningNoLine{askinclude}{% |
| 907 |
Option `pdfmatch' is not available because\MessageBreak |
| 908 |
your pdfTeX does not provide \string\pdfmatch |
| 909 |
}% |
| 910 |
}% |
| 911 |
\fi |
| 912 |
\DeclareOption{noregexp}{% |
| 913 |
\let\AskInc@MatchOption\@empty |
| 914 |
} |
| 915 |
\ProcessOptions* |
| 916 |
% \end{macrocode} |
| 917 |
% |
| 918 |
% \subsection{Strings} |
| 919 |
% |
| 920 |
% \begin{macro}{\AskInc@CharAsterisk} |
| 921 |
% \begin{macrocode} |
| 922 |
\def\AskInc@CharAsterisk{*} |
| 923 |
% \end{macrocode} |
| 924 |
% \end{macro} |
| 925 |
% \begin{macro}{\AskInc@CharMinus} |
| 926 |
% \begin{macrocode} |
| 927 |
\def\AskInc@CharMinus{-} |
| 928 |
% \end{macrocode} |
| 929 |
% \end{macro} |
| 930 |
% \begin{macro}{\AskInc@CharPlus} |
| 931 |
% \begin{macrocode} |
| 932 |
\def\AskInc@CharPlus{+} |
| 933 |
% \end{macrocode} |
| 934 |
% \end{macro} |
| 935 |
% \begin{macro}{\AskInc@CharQuestion} |
| 936 |
% \begin{macrocode} |
| 937 |
\def\AskInc@CharQuestion{?} |
| 938 |
% \end{macrocode} |
| 939 |
% \end{macro} |
| 940 |
% \begin{macro}{\AskInc@CharExclam} |
| 941 |
% \begin{macrocode} |
| 942 |
\def\AskInc@CharExclam{!} |
| 943 |
% \end{macrocode} |
| 944 |
% \end{macro} |
| 945 |
% \begin{macro}{\AskInc@CharYes} |
| 946 |
% \begin{macrocode} |
| 947 |
\def\AskInc@CharYes{y} |
| 948 |
% \end{macrocode} |
| 949 |
% \end{macro} |
| 950 |
% \begin{macro}{\AskInc@CharNo} |
| 951 |
% \begin{macrocode} |
| 952 |
\def\AskInc@CharNo{n} |
| 953 |
% \end{macrocode} |
| 954 |
% \end{macro} |
| 955 |
% \begin{macro}{\AskInc@CharAll} |
| 956 |
% \begin{macrocode} |
| 957 |
\def\AskInc@CharAll{A} |
| 958 |
% \end{macrocode} |
| 959 |
% \end{macro} |
| 960 |
% \begin{macro}{\AskInc@CharNone} |
| 961 |
% \begin{macrocode} |
| 962 |
\def\AskInc@CharNone{N} |
| 963 |
% \end{macrocode} |
| 964 |
% \end{macro} |
| 965 |
% \begin{macro}{\AskInc@CharDefault} |
| 966 |
% \begin{macrocode} |
| 967 |
\def\AskInc@CharDefault{D} |
| 968 |
% \end{macrocode} |
| 969 |
% \end{macro} |
| 970 |
% |
| 971 |
% \subsection{Set defaults} |
| 972 |
% |
| 973 |
% \begin{macro}{\AskInc@SanitizeAnswer} |
| 974 |
% \begin{macrocode} |
| 975 |
\def\AskInc@SanitizeAnswer#1#2{% |
| 976 |
\begingroup |
| 977 |
\escapechar=`\\% |
| 978 |
\edef\[{\string\[}% |
| 979 |
\edef\]{\string\]}% |
| 980 |
\edef\({\string\(}% |
| 981 |
\edef\){\string\)}% |
| 982 |
\edef\*{\string\*}% |
| 983 |
\edef\+{\string\+}% |
| 984 |
\edef\?{\string\?}% |
| 985 |
\edef\|{\string\|}% |
| 986 |
\edef\^{\string\^}% |
| 987 |
\edef\${\string\$}% |
| 988 |
\edef\{{\string\{}% |
| 989 |
\edef\}{\string\}}% |
| 990 |
\edef\.{\string\.}% |
| 991 |
\xdef#1{% |
| 992 |
\expandafter\expandafter\expandafter\zap@space |
| 993 |
\expandafter#2\space\@empty |
| 994 |
}% |
| 995 |
\endgroup |
| 996 |
} |
| 997 |
% \end{macrocode} |
| 998 |
% \end{macro} |
| 999 |
% |
| 1000 |
% \begin{macrocode} |
| 1001 |
\AtBeginDocument{% |
| 1002 |
\@ifundefined{AskInc@Answer}{% |
| 1003 |
\global\let\AskInc@Answer\AskInc@CharAsterisk |
| 1004 |
}{% |
| 1005 |
\AskInc@SanitizeAnswer\AskInc@Answer\AskInc@Answer |
| 1006 |
}% |
| 1007 |
\global\let\AskInc@PreviousAnswer\AskInc@Answer |
| 1008 |
\@ifundefined{AskInc@MatchMethod}{% |
| 1009 |
\global\let\AskInc@MatchMethod\@empty |
| 1010 |
}{}% |
| 1011 |
\global\let\AskInc@PreviousMatchMethod\AskInc@MatchMethod |
| 1012 |
\@ifundefined{AskInc@MatchOption}{% |
| 1013 |
\let\AskInc@MatchOption\AskInc@MatchMethod |
| 1014 |
}{}% |
| 1015 |
\ifx\AskInc@MatchOption\AskInc@StringPdfMatch |
| 1016 |
\ifAskInc@PdfMatchAvailable |
| 1017 |
\else |
| 1018 |
\let\AskInc@MatchOption\@empty |
| 1019 |
\fi |
| 1020 |
\fi |
| 1021 |
\@ifundefined{AskInc@MatchFiles}{% |
| 1022 |
\let\AskInc@MatchFiles\@empty |
| 1023 |
}{}% |
| 1024 |
} |
| 1025 |
% \end{macrocode} |
| 1026 |
% |
| 1027 |
% \subsection{Questions} |
| 1028 |
% |
| 1029 |
% \subsubsection{Generic question header} |
| 1030 |
% |
| 1031 |
% \begin{macro}{\AskInc@QuestionHeader} |
| 1032 |
% \begin{macrocode} |
| 1033 |
\def\AskInc@QuestionHeader{% |
| 1034 |
\typeout{}% |
| 1035 |
\typeout{***********************************}% |
| 1036 |
\typeout{*** Package askinclude Question ***}% |
| 1037 |
\typeout{***********************************}% |
| 1038 |
\typeout{}% |
| 1039 |
} |
| 1040 |
% \end{macrocode} |
| 1041 |
% \end{macro} |
| 1042 |
% |
| 1043 |
% \subsubsection{Display files} |
| 1044 |
% |
| 1045 |
% \begin{macro}{\AskInc@TypeoutFiles} |
| 1046 |
% \begin{macrocode} |
| 1047 |
\def\AskInc@TypeoutFiles{% |
| 1048 |
\global\let\AskInc@PreviousMatches\@empty |
| 1049 |
\ifx\AskInc@Files\@empty |
| 1050 |
\else |
| 1051 |
\typeout{Files, found by previous run in \string\include:}% |
| 1052 |
\@for\AskInc@File:=\AskInc@Files\do{% |
| 1053 |
\ifx\AskInc@Answer\AskInc@CharAsterisk |
| 1054 |
\let\AskInc@Mark\AskInc@CharPlus |
| 1055 |
\else |
| 1056 |
\let\AskInc@Mark\AskInc@CharMinus |
| 1057 |
\ifx\AskInc@Answer\AskInc@CharMinus |
| 1058 |
\else |
| 1059 |
\ifx\AskInc@MatchMethod\@empty |
| 1060 |
\expandafter\@firstoftwo |
| 1061 |
\else |
| 1062 |
\expandafter\@secondoftwo |
| 1063 |
\fi |
| 1064 |
{\@for\AskInc@Temp:=\AskInc@Answer}% |
| 1065 |
{\@for\AskInc@Temp:=\AskInc@MatchFiles}% |
| 1066 |
\do{% |
| 1067 |
\ifx\AskInc@File\AskInc@Temp |
| 1068 |
\let\AskInc@Mark\AskInc@CharPlus |
| 1069 |
\fi |
| 1070 |
}% |
| 1071 |
\fi |
| 1072 |
\fi |
| 1073 |
\typeout{ \@spaces(\AskInc@Mark) \AskInc@File}% |
| 1074 |
\ifx\AskInc@Mark\AskInc@CharPlus |
| 1075 |
\ifx\AskInc@PreviousMatches\@empty |
| 1076 |
\global\let\AskInc@PreviousMatches\AskInc@File |
| 1077 |
\else |
| 1078 |
\expandafter\g@addto@macro |
| 1079 |
\expandafter\AskInc@PreviousMatches{% |
| 1080 |
\expandafter,\AskInc@File |
| 1081 |
}% |
| 1082 |
\fi |
| 1083 |
\fi |
| 1084 |
}% |
| 1085 |
\typeout{}% |
| 1086 |
\fi |
| 1087 |
} |
| 1088 |
% \end{macrocode} |
| 1089 |
% \end{macro} |
| 1090 |
% |
| 1091 |
% \subsubsection{Previous answer} |
| 1092 |
% |
| 1093 |
% \begin{macro}{\AskInc@TypeoutPreviousAnswer} |
| 1094 |
% \begin{macrocode} |
| 1095 |
\def\AskInc@TypeoutPreviousAnswer{% |
| 1096 |
\typeout{% |
| 1097 |
Previous answer (% |
| 1098 |
\ifx\AskInc@MatchMethod\@empty |
| 1099 |
noregexp% |
| 1100 |
\else |
| 1101 |
\AskInc@MatchMethod |
| 1102 |
\fi |
| 1103 |
):% |
| 1104 |
}% |
| 1105 |
\typeout{ \@spaces[\AskInc@Answer]}% |
| 1106 |
\typeout{}% |
| 1107 |
} |
| 1108 |
% \end{macrocode} |
| 1109 |
% \end{macro} |
| 1110 |
% |
| 1111 |
% \subsubsection{Current regular expression support} |
| 1112 |
% |
| 1113 |
% \begin{macro}{\AskInc@TypeoutMatchMethod} |
| 1114 |
% \begin{macrocode} |
| 1115 |
\def\AskInc@TypeoutMatchMethod{% |
| 1116 |
\typeout{Regular expressions:}% |
| 1117 |
\AskInc@TypeoutMethod\@empty{noregexp}{% |
| 1118 |
\space disabled% |
| 1119 |
}% |
| 1120 |
\AskInc@TypeoutMethod\AskInc@StringMakeMatch{makematch}{% |
| 1121 |
enabled, using package `makematch'% |
| 1122 |
}% |
| 1123 |
\ifAskInc@PdfMatchAvailable |
| 1124 |
\AskInc@TypeoutMethod\AskInc@StringPdfMatch{pdfmatch}{% |
| 1125 |
\space enabled, using pdfTeX's \string\pdfmatch |
| 1126 |
}% |
| 1127 |
\fi |
| 1128 |
\typeout{}% |
| 1129 |
} |
| 1130 |
% \end{macrocode} |
| 1131 |
% \end{macro} |
| 1132 |
% \begin{macro}{\AskInc@TypeoutMethod} |
| 1133 |
% \begin{macrocode} |
| 1134 |
\def\AskInc@TypeoutMethod#1#2#3{% |
| 1135 |
\typeout{% |
| 1136 |
\ifx#1\AskInc@MatchOption \space--> \else\@spaces\space\fi |
| 1137 |
[#2] #3% hash-ok |
| 1138 |
}% |
| 1139 |
} |
| 1140 |
% \end{macrocode} |
| 1141 |
% \end{macro} |
| 1142 |
% |
| 1143 |
% \subsubsection{Main question text} |
| 1144 |
% |
| 1145 |
% \begin{macro}{\AskInc@TypeoutMainQuestion} |
| 1146 |
% \begin{macrocode} |
| 1147 |
\def\AskInc@TypeoutMainQuestion{% |
| 1148 |
\typeout{Which files do you want to include?}% |
| 1149 |
\typeout{ \@spaces[foo,bar] \space\space |
| 1150 |
comma separated file or pattern list}% |
| 1151 |
\typeout{ \@spaces[*] \@spaces\@spaces all files}% |
| 1152 |
\typeout{ \@spaces[-] \@spaces\@spaces no files}% |
| 1153 |
\typeout{ \@spaces[?] \@spaces\@spaces ask for each file}% |
| 1154 |
} |
| 1155 |
% \end{macrocode} |
| 1156 |
% \end{macro} |
| 1157 |
% |
| 1158 |
% \subsubsection{Main question} |
| 1159 |
% |
| 1160 |
% \begin{macro}{\AskInc@MainQuestion} |
| 1161 |
% \begin{macrocode} |
| 1162 |
\def\AskInc@MainQuestion{% |
| 1163 |
\AskInc@QuestionHeader |
| 1164 |
\AskInc@TypeoutFiles |
| 1165 |
\AskInc@TypeoutPreviousAnswer |
| 1166 |
\AskInc@TypeoutMatchMethod |
| 1167 |
\AskInc@TypeoutMainQuestion |
| 1168 |
\begingroup |
| 1169 |
\@makeother\*% |
| 1170 |
\@makeother\-% |
| 1171 |
\@makeother\?% |
| 1172 |
\@makeother\,% |
| 1173 |
\@makeother\!% |
| 1174 |
\@makeother\^% |
| 1175 |
\@makeother\$% |
| 1176 |
\@makeother\(% |
| 1177 |
\@makeother\)% |
| 1178 |
\@makeother\+% |
| 1179 |
\@makeother\[% |
| 1180 |
\@makeother\]% |
| 1181 |
\@makeother\\% |
| 1182 |
\@makeother\|% |
| 1183 |
\@makeother\:% |
| 1184 |
\@makeother\.% |
| 1185 |
\typein[\answer]% |
| 1186 |
{ \@spaces[] \space\@spaces\@spaces use the previous answer}% |
| 1187 |
\typeout{}% |
| 1188 |
\AskInc@SanitizeAnswer\AskInc@@Answer\answer |
| 1189 |
\endgroup |
| 1190 |
\let\AskInc@Next\AskInc@MainQuestion |
| 1191 |
\ifx\AskInc@@Answer\AskInc@StringNoRegExp |
| 1192 |
\let\AskInc@MatchOption\@empty |
| 1193 |
\else |
| 1194 |
\ifx\AskInc@@Answer\AskInc@StringMakeMatch |
| 1195 |
\let\AskInc@MatchOption\AskInc@StringMakeMatch |
| 1196 |
\else |
| 1197 |
\ifx\AskInc@@Answer\AskInc@StringPdfMatch |
| 1198 |
\ifAskInc@PdfMatchAvailable |
| 1199 |
\let\AskInc@MatchOption\AskInc@StringPdfMatch |
| 1200 |
\else |
| 1201 |
\PackageWarning{askinclude}{% |
| 1202 |
Method `pdfmatch' is not available because\MessageBreak |
| 1203 |
your pdfTeX does not provide \string\pdfmatch |
| 1204 |
}% |
| 1205 |
\let\AskInc@MatchOption\@empty |
| 1206 |
\fi |
| 1207 |
\else |
| 1208 |
\ifx\AskInc@@Answer\@empty |
| 1209 |
\global\let\AskInc@@Answer\AskInc@Answer |
| 1210 |
\fi |
| 1211 |
\let\AskInc@Next\AskInc@MainAnswer |
| 1212 |
\fi |
| 1213 |
\fi |
| 1214 |
\fi |
| 1215 |
\AskInc@Next |
| 1216 |
} |
| 1217 |
% \end{macrocode} |
| 1218 |
% \end{macro} |
| 1219 |
% |
| 1220 |
% \subsection{Evaluate answer of main question} |
| 1221 |
% |
| 1222 |
% \begin{macro}{\AskInc@MainAnswer} |
| 1223 |
% \begin{macrocode} |
| 1224 |
\def\AskInc@MainAnswer{% |
| 1225 |
\ifx\AskInc@@Answer\AskInc@CharQuestion |
| 1226 |
\global\let\AskInc@Answer\@empty |
| 1227 |
\global\let\AskInc@MatchMethod\@empty |
| 1228 |
\global\let\AskInc@AskFile\AskInc@DoAskFile |
| 1229 |
\AskInc@OrgIncludeOnly{}% |
| 1230 |
\else |
| 1231 |
\global\let\AskInc@Answer\AskInc@@Answer |
| 1232 |
\ifx\AskInc@@Answer\AskInc@CharAsterisk |
| 1233 |
\global\let\AskInc@MatchMethod\@empty |
| 1234 |
\else |
| 1235 |
\ifx\AskInc@@Answer\AskInc@CharMinus |
| 1236 |
\global\let\AskInc@MatchMethod\@empty |
| 1237 |
\AskInc@OrgIncludeOnly{}% |
| 1238 |
\else |
| 1239 |
\global\let\AskInc@MatchMethod\AskInc@MatchOption |
| 1240 |
\ifx\AskInc@MatchOption\@empty |
| 1241 |
\expandafter\AskInc@OrgIncludeOnly\expandafter{% |
| 1242 |
\AskInc@Answer |
| 1243 |
}% |
| 1244 |
\else |
| 1245 |
\AskInc@MatchInit |
| 1246 |
\AskInc@OrgIncludeOnly{}% |
| 1247 |
\fi |
| 1248 |
\fi |
| 1249 |
\fi |
| 1250 |
\fi |
| 1251 |
\let\AskInc@Include\AskInc@DoInclude |
| 1252 |
} |
| 1253 |
% \end{macrocode} |
| 1254 |
% \end{macro} |
| 1255 |
% |
| 1256 |
% \begin{macro}{\AskInc@MatchInit} |
| 1257 |
% \begin{macrocode} |
| 1258 |
\def\AskInc@MatchInit{% |
| 1259 |
\RequirePackage{kvsetkeys}[2007/09/29]% |
| 1260 |
\expandafter\comma@normalize\expandafter{\AskInc@Answer}% |
| 1261 |
\global\let\AskInc@MatchList\comma@list |
| 1262 |
% \end{macrocode} |
| 1263 |
% \begin{macro}{\AskInc@MatchFile} |
| 1264 |
% \begin{macrocode} |
| 1265 |
\def\AskInc@MatchFile##1{% |
| 1266 |
\AskInc@DoMatch{##1}{% |
| 1267 |
\AskInc@WriteAddMatch{##1}% |
| 1268 |
\ifx\@partlist\@empty |
| 1269 |
\expandafter\gdef\expandafter\@partlist\expandafter{\detokenize{##1}}% |
| 1270 |
\else |
| 1271 |
\expandafter\g@addto@macro\expandafter\@partlist\expandafter{\expandafter,\detokenize{##1}}% |
| 1272 |
\fi |
| 1273 |
}% |
| 1274 |
}% |
| 1275 |
% \end{macrocode} |
| 1276 |
% \end{macro} |
| 1277 |
% \begin{macrocode} |
| 1278 |
\ifx\AskInc@MatchMethod\AskInc@StringMakeMatch |
| 1279 |
\AskInc@MakeMatchInit |
| 1280 |
\else |
| 1281 |
\AskInc@PdfMatchInit |
| 1282 |
\fi |
| 1283 |
\let\AskInc@MatchInit\@undefined |
| 1284 |
} |
| 1285 |
% \end{macrocode} |
| 1286 |
% \end{macro} |
| 1287 |
% \begin{macro}{\AskInc@MakeMatchInit} |
| 1288 |
% \begin{macrocode} |
| 1289 |
\def\AskInc@MakeMatchInit{% |
| 1290 |
\RequirePackage{makematch}% |
| 1291 |
% \end{macrocode} |
| 1292 |
% \begin{macro}{\AskInc@DoMatch} |
| 1293 |
% \begin{macrocode} |
| 1294 |
\def\AskInc@DoMatch##1{% |
| 1295 |
\def\AskInc@Temp{% |
| 1296 |
\MakeMatcher[,]\AskInc@Temp |
| 1297 |
}% |
| 1298 |
\expandafter\AskInc@Temp\expandafter{\AskInc@MatchList}% |
| 1299 |
\AskInc@Temp{{##1}}\@firstofone\@gobble |
| 1300 |
}% |
| 1301 |
% \end{macrocode} |
| 1302 |
% \end{macro} |
| 1303 |
% \begin{macrocode} |
| 1304 |
\let\AskInc@MakeMatchInit\@undefined |
| 1305 |
} |
| 1306 |
% \end{macrocode} |
| 1307 |
% \end{macro} |
| 1308 |
% \begin{macro}{\AskInc@PdfMatchInit} |
| 1309 |
% \begin{macrocode} |
| 1310 |
\def\AskInc@PdfMatchInit{% |
| 1311 |
% \end{macrocode} |
| 1312 |
% \begin{macro}{\ifAskInc@Found} |
| 1313 |
% \begin{macrocode} |
| 1314 |
\newif\ifAskInc@Found |
| 1315 |
% \end{macrocode} |
| 1316 |
% \end{macro} |
| 1317 |
% \begin{macro}{\AskInc@DoMatch} |
| 1318 |
% \begin{macrocode} |
| 1319 |
\def\AskInc@DoMatch##1{% |
| 1320 |
\AskInc@Foundfalse |
| 1321 |
\expandafter\comma@parse@normalized\expandafter |
| 1322 |
{\AskInc@MatchList}{\AskInc@CheckMatch{##1}}% |
| 1323 |
\ifAskInc@Found |
| 1324 |
\expandafter\@firstofone |
| 1325 |
\else |
| 1326 |
\expandafter\@gobble |
| 1327 |
\fi |
| 1328 |
}% |
| 1329 |
% \end{macrocode} |
| 1330 |
% \end{macro} |
| 1331 |
% \begin{macro}{\AskInc@CheckMatch} |
| 1332 |
% \begin{macrocode} |
| 1333 |
\def\AskInc@CheckMatch##1##2{% |
| 1334 |
\AskInc@@CheckMatch##2\@empty\@nil{##1}% |
| 1335 |
}% |
| 1336 |
% \end{macrocode} |
| 1337 |
% \end{macro} |
| 1338 |
% \begin{macro}{\AskInc@@CheckMatch} |
| 1339 |
% \begin{macrocode} |
| 1340 |
\def\AskInc@@CheckMatch##1##2\@nil##3{% |
| 1341 |
\def\AskInc@Temp{##1}% |
| 1342 |
\ifx\AskInc@Temp\AskInc@CharExclam |
| 1343 |
\ifcase\pdfmatch{##2}{##3}=1 % |
| 1344 |
\or |
| 1345 |
\AskInc@Foundfalse |
| 1346 |
\else |
| 1347 |
\AskInc@InvalidPattern{##2}{##1##2}% |
| 1348 |
\fi |
| 1349 |
\else |
| 1350 |
\ifcase\pdfmatch{##1##2}{##3} % |
| 1351 |
\or |
| 1352 |
\AskInc@Foundtrue |
| 1353 |
\else |
| 1354 |
\AskInc@InvalidPattern{##1##2}{##1##2}% |
| 1355 |
\fi |
| 1356 |
\fi |
| 1357 |
}% |
| 1358 |
% \end{macrocode} |
| 1359 |
% \end{macro} |
| 1360 |
% \begin{macro}{\AskInc@InvalidPattern} |
| 1361 |
% Prints a warning with the regular expression and |
| 1362 |
% removes it from the list to prevent further warnings |
| 1363 |
% for the same expression. |
| 1364 |
% \begin{macrocode} |
| 1365 |
\def\AskInc@InvalidPattern##1##2{% |
| 1366 |
\edef\AskInc@Temp{##1}% |
| 1367 |
\PackageWarningNoLine{askinclude}{% |
| 1368 |
Invalid pattern `\AskInc@Temp' for \string\pdfmatch |
| 1369 |
}% |
| 1370 |
\edef\AskInc@Temp{##2}% |
| 1371 |
\global\expandafter\let\expandafter\AskInc@MatchList |
| 1372 |
\expandafter\@empty |
| 1373 |
\expandafter\comma@parse@normalized\expandafter |
| 1374 |
{\AskInc@MatchList}\AskInc@FilterPattern |
| 1375 |
}% |
| 1376 |
% \end{macrocode} |
| 1377 |
% \end{macro} |
| 1378 |
% \begin{macro}{\AskInc@FilterPattern} |
| 1379 |
% \begin{macrocode} |
| 1380 |
\def\AskInc@FilterPattern##1{% |
| 1381 |
\edef\AskInc@Pattern{##1}% |
| 1382 |
\ifx\AskInc@Temp\AskInc@Pattern |
| 1383 |
\else |
| 1384 |
\ifx\AskInc@MatchList\@empty |
| 1385 |
\global\let\AskInc@MatchList\AskInc@Pattern |
| 1386 |
\else |
| 1387 |
\expandafter\g@addto@macro\expandafter\AskInc@MatchList{% |
| 1388 |
\expandafter,\AskInc@Pattern |
| 1389 |
}% |
| 1390 |
\fi |
| 1391 |
\fi |
| 1392 |
}% |
| 1393 |
% \end{macrocode} |
| 1394 |
% \end{macro} |
| 1395 |
% \begin{macrocode} |
| 1396 |
\let\AskInc@PdfMatchInit\@undefined |
| 1397 |
} |
| 1398 |
% \end{macrocode} |
| 1399 |
% \end{macro} |
| 1400 |
% |
| 1401 |
% \begin{macro}{\AskInc@WriteDefAddMatch} |
| 1402 |
% \begin{macrocode} |
| 1403 |
\def\AskInc@WriteDefAddMatch{% |
| 1404 |
\AskInc@WriteDefAddList |
| 1405 |
\AskInc@WriteAux{% |
| 1406 |
% \end{macrocode} |
| 1407 |
% \begin{macro}{\AskInc@AddMatch} |
| 1408 |
% \begin{macrocode} |
| 1409 |
\string\providecommand\string\AskInc@AddMatch{% |
| 1410 |
\string\AskInc@AddList\string\AskInc@MatchFiles |
| 1411 |
}% |
| 1412 |
% \end{macrocode} |
| 1413 |
% \end{macro} |
| 1414 |
% \begin{macrocode} |
| 1415 |
}{% |
| 1416 |
\global\let\AskInc@WriteDefAddMatch\relax |
| 1417 |
}% |
| 1418 |
} |
| 1419 |
% \end{macrocode} |
| 1420 |
% \end{macro} |
| 1421 |
% \begin{macro}{\AskInc@AddMatch} |
| 1422 |
% \begin{macrocode} |
| 1423 |
\AtBeginDocument{% |
| 1424 |
\global\let\AskInc@AddMatch\@gobble |
| 1425 |
} |
| 1426 |
% \end{macrocode} |
| 1427 |
% \end{macro} |
| 1428 |
% \begin{macro}{\AskInc@WriteAddMatch} |
| 1429 |
% \begin{macrocode} |
| 1430 |
\def\AskInc@WriteAddMatch#1{% |
| 1431 |
\AskInc@WriteDefAddMatch |
| 1432 |
\AskInc@WriteAux{% |
| 1433 |
\string\AskInc@AddMatch{#1}% |
| 1434 |
}{}% |
| 1435 |
} |
| 1436 |
% \end{macrocode} |
| 1437 |
% \end{macro} |
| 1438 |
% |
| 1439 |
% \begin{macro}{\AskInc@SaveAnswer} |
| 1440 |
% \begin{macrocode} |
| 1441 |
\def\AskInc@SaveAnswer{% |
| 1442 |
\AskInc@WriteAux{% |
| 1443 |
\string\gdef\string\AskInc@Answer{\AskInc@Answer}% |
| 1444 |
}{}% |
| 1445 |
} |
| 1446 |
% \end{macrocode} |
| 1447 |
% \end{macro} |
| 1448 |
% |
| 1449 |
% \subsection{Ask for each file} |
| 1450 |
% |
| 1451 |
% \begin{macro}{\AskInc@PreviousAnswer} |
| 1452 |
% \begin{macrocode} |
| 1453 |
\@ifundefined{AskInc@PreviousAnswer}{% |
| 1454 |
\let\AskInc@PreviousAnswer\AskInc@CharAsterisk |
| 1455 |
}{} |
| 1456 |
% \end{macrocode} |
| 1457 |
% \end{macro} |
| 1458 |
% \begin{macro}{\AskInc@PreviousMatchMethod} |
| 1459 |
% \begin{macrocode} |
| 1460 |
\@ifundefined{AskInc@PreviousMatchMethod}{% |
| 1461 |
\let\AskInc@PreviousMatchMethod\@empty |
| 1462 |
}{} |
| 1463 |
% \end{macrocode} |
| 1464 |
% \end{macro} |
| 1465 |
% \begin{macro}{\AskInc@DoAskFile} |
| 1466 |
% \begin{macrocode} |
| 1467 |
\def\AskInc@DoAskFile#1{% |
| 1468 |
\edef\AskInc@File{#1}% |
| 1469 |
\ifx\AskInc@PreviousAnswer\AskInc@CharAsterisk |
| 1470 |
\let\AskInc@Default\AskInc@CharYes |
| 1471 |
\else |
| 1472 |
\let\AskInc@Default\AskInc@CharNo |
| 1473 |
\ifx\AskInc@PreviousAnswer\AskInc@CharMinus |
| 1474 |
\else |
| 1475 |
\ifx\AskInc@PreviousMatchMethod\@empty |
| 1476 |
\expandafter\@firstoftwo |
| 1477 |
\else |
| 1478 |
\expandafter\@secondoftwo |
| 1479 |
\fi |
| 1480 |
{\@for\AskInc@Temp:=\AskInc@PreviousAnswer}% |
| 1481 |
{\@for\AskInc@Temp:=\AskInc@MatchFiles}% |
| 1482 |
\do{% |
| 1483 |
\ifx\AskInc@Temp\AskInc@File |
| 1484 |
\let\AskInc@Default\AskInc@CharYes |
| 1485 |
\fi |
| 1486 |
}% |
| 1487 |
\fi |
| 1488 |
\ifx\AskInc@Default\AskInc@CharNo |
| 1489 |
\let\AskInc@Default\AskInc@CharYes |
| 1490 |
\@for\AskInc@Temp:=\AskInc@Files\do{% |
| 1491 |
\ifx\AskInc@Temp\AskInc@File |
| 1492 |
\let\AskInc@Default\AskInc@CharNo |
| 1493 |
\fi |
| 1494 |
}% |
| 1495 |
\fi |
| 1496 |
\fi |
| 1497 |
\let\AskInc@@QuestionHeader\AskInc@QuestionHeader |
| 1498 |
\AskInc@AskQuestion |
| 1499 |
\ifx\AskInc@AskResult\AskInc@CharYes |
| 1500 |
\ifx\AskInc@Answer\@empty |
| 1501 |
\expandafter\gdef\expandafter\AskInc@Answer\expandafter{\detokenize{#1}}% |
| 1502 |
\else |
| 1503 |
\expandafter\g@addto@macro\expandafter\AskInc@Answer\expandafter{\expandafter,\detokenize{#1}}% |
| 1504 |
\fi |
| 1505 |
\AskInc@SaveAnswer |
| 1506 |
\let\@partlist\AskInc@Answer |
| 1507 |
\fi |
| 1508 |
} |
| 1509 |
% \end{macrocode} |
| 1510 |
% \end{macro} |
| 1511 |
% \begin{macro}{\AskInc@AskQuestion} |
| 1512 |
% \begin{macrocode} |
| 1513 |
\def\AskInc@AskQuestion{% |
| 1514 |
\let\AskInc@Temp\answer |
| 1515 |
\AskInc@@QuestionHeader |
| 1516 |
\let\AskInc@@QuestionHeader\relax |
| 1517 |
\typein[\answer]{% |
| 1518 |
Include `\AskInc@File'? [y]es, [n]o, [A]ll, [N]one, [D]efault % |
| 1519 |
(\AskInc@Default):% |
| 1520 |
}% |
| 1521 |
\typeout{}% |
| 1522 |
\let\AskInc@AskResult\answer |
| 1523 |
\let\answer\AskInc@Temp |
| 1524 |
\ifx\AskInc@AskResult\@empty |
| 1525 |
\let\AskInc@AskResult\AskInc@Default |
| 1526 |
\let\AskInc@Next\relax |
| 1527 |
\else |
| 1528 |
\ifx\AskInc@AskResult\AskInc@CharYes |
| 1529 |
\let\AskInc@Next\relax |
| 1530 |
\else |
| 1531 |
\ifx\AskInc@AskResult\AskInc@CharNo |
| 1532 |
\let\AskInc@Next\relax |
| 1533 |
\else |
| 1534 |
\ifx\AskInc@AskResult\AskInc@CharAll |
| 1535 |
\gdef\AskInc@AskQuestion{% |
| 1536 |
\let\AskInc@AskResult\AskInc@CharYes |
| 1537 |
}% |
| 1538 |
\else |
| 1539 |
\ifx\AskInc@AskResult\AskInc@CharNone |
| 1540 |
\gdef\AskInc@AskQuestion{% |
| 1541 |
\let\AskInc@AskResult\AskInc@CharNo |
| 1542 |
}% |
| 1543 |
\else |
| 1544 |
\ifx\AskInc@AskResult\AskInc@CharDefault |
| 1545 |
\gdef\AskInc@AskQuestion{% |
| 1546 |
\let\AskInc@AskResult\AskInc@Default |
| 1547 |
}% |
| 1548 |
\else |
| 1549 |
\PackageWarningNoLine{askinclude}{% |
| 1550 |
Invalid answer [\AskInc@AskResult].\MessageBreak |
| 1551 |
Answer must be one letter out of [ynAND]% |
| 1552 |
}% |
| 1553 |
\fi |
| 1554 |
\fi |
| 1555 |
\fi |
| 1556 |
\let\AskInc@Next\AskInc@AskQuestion |
| 1557 |
\fi |
| 1558 |
\fi |
| 1559 |
\fi |
| 1560 |
\AskInc@Next |
| 1561 |
} |
| 1562 |
% \end{macrocode} |
| 1563 |
% \end{macro} |
| 1564 |
% |
| 1565 |
% \begin{macrocode} |
| 1566 |
\AtBeginDocument{\AskInc@MainQuestion} |
| 1567 |
% \end{macrocode} |
| 1568 |
% |
| 1569 |
% \begin{macrocode} |
| 1570 |
\AskInc@AtEnd% |
| 1571 |
%</package> |
| 1572 |
% \end{macrocode} |
| 1573 |
% \section{Installation} |
| 1574 |
% |
| 1575 |
% \subsection{Download} |
| 1576 |
% |
| 1577 |
% \paragraph{Package.} This package is available on |
| 1578 |
% CTAN\footnote{\CTANpkg{askinclude}}: |
| 1579 |
% \begin{description} |
| 1580 |
% \item[\CTAN{macros/latex/contrib/askinclude/askinclude.dtx}] The source file. |
| 1581 |
% \item[\CTAN{macros/latex/contrib/askinclude/askinclude.pdf}] Documentation. |
| 1582 |
% \end{description} |
| 1583 |
% |
| 1584 |
% |
| 1585 |
% \paragraph{Bundle.} All the packages of the bundle `askinclude' |
| 1586 |
% are also available in a TDS compliant ZIP archive. There |
| 1587 |
% the packages are already unpacked and the documentation files |
| 1588 |
% are generated. The files and directories obey the TDS standard. |
| 1589 |
% \begin{description} |
| 1590 |
% \item[\CTANinstall{install/macros/latex/contrib/askinclude.tds.zip}] |
| 1591 |
% \end{description} |
| 1592 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 1593 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 1594 |
% with \xfile{texmf} in their name are usually organized this way. |
| 1595 |
% |
| 1596 |
% \subsection{Bundle installation} |
| 1597 |
% |
| 1598 |
% \paragraph{Unpacking.} Unpack the \xfile{askinclude.tds.zip} in the |
| 1599 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 1600 |
% Example (linux): |
| 1601 |
% \begin{quote} |
| 1602 |
% |unzip askinclude.tds.zip -d ~/texmf| |
| 1603 |
% \end{quote} |
| 1604 |
% |
| 1605 |
% \subsection{Package installation} |
| 1606 |
% |
| 1607 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 1608 |
% \docstrip\ archive. The files are extracted by running the |
| 1609 |
% \xfile{.dtx} through \plainTeX: |
| 1610 |
% \begin{quote} |
| 1611 |
% \verb|tex askinclude.dtx| |
| 1612 |
% \end{quote} |
| 1613 |
% |
| 1614 |
% \paragraph{TDS.} Now the different files must be moved into |
| 1615 |
% the different directories in your installation TDS tree |
| 1616 |
% (also known as \xfile{texmf} tree): |
| 1617 |
% \begin{quote} |
| 1618 |
% \def\t{^^A |
| 1619 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1620 |
% askinclude.sty & tex/latex/askinclude/askinclude.sty\\ |
| 1621 |
% askinclude.pdf & doc/latex/askinclude/askinclude.pdf\\ |
| 1622 |
% askinclude.dtx & source/latex/askinclude/askinclude.dtx\\ |
| 1623 |
% \end{tabular}^^A |
| 1624 |
% }^^A |
| 1625 |
% \sbox0{\t}^^A |
| 1626 |
% \ifdim\wd0>\linewidth |
| 1627 |
% \begingroup |
| 1628 |
% \advance\linewidth by\leftmargin |
| 1629 |
% \advance\linewidth by\rightmargin |
| 1630 |
% \edef\x{\endgroup |
| 1631 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1632 |
% }\x |
| 1633 |
% \def\lwbox{^^A |
| 1634 |
% \leavevmode |
| 1635 |
% \hbox to \linewidth{^^A |
| 1636 |
% \kern-\leftmargin\relax |
| 1637 |
% \hss |
| 1638 |
% \usebox0 |
| 1639 |
% \hss |
| 1640 |
% \kern-\rightmargin\relax |
| 1641 |
% }^^A |
| 1642 |
% }^^A |
| 1643 |
% \ifdim\wd0>\lw |
| 1644 |
% \sbox0{\small\t}^^A |
| 1645 |
% \ifdim\wd0>\linewidth |
| 1646 |
% \ifdim\wd0>\lw |
| 1647 |
% \sbox0{\footnotesize\t}^^A |
| 1648 |
% \ifdim\wd0>\linewidth |
| 1649 |
% \ifdim\wd0>\lw |
| 1650 |
% \sbox0{\scriptsize\t}^^A |
| 1651 |
% \ifdim\wd0>\linewidth |
| 1652 |
% \ifdim\wd0>\lw |
| 1653 |
% \sbox0{\tiny\t}^^A |
| 1654 |
% \ifdim\wd0>\linewidth |
| 1655 |
% \lwbox |
| 1656 |
% \else |
| 1657 |
% \usebox0 |
| 1658 |
% \fi |
| 1659 |
% \else |
| 1660 |
% \lwbox |
| 1661 |
% \fi |
| 1662 |
% \else |
| 1663 |
% \usebox0 |
| 1664 |
% \fi |
| 1665 |
% \else |
| 1666 |
% \lwbox |
| 1667 |
% \fi |
| 1668 |
% \else |
| 1669 |
% \usebox0 |
| 1670 |
% \fi |
| 1671 |
% \else |
| 1672 |
% \lwbox |
| 1673 |
% \fi |
| 1674 |
% \else |
| 1675 |
% \usebox0 |
| 1676 |
% \fi |
| 1677 |
% \else |
| 1678 |
% \lwbox |
| 1679 |
% \fi |
| 1680 |
% \else |
| 1681 |
% \usebox0 |
| 1682 |
% \fi |
| 1683 |
% \end{quote} |
| 1684 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1685 |
% TDS installing feature, then some files can already be in the right |
| 1686 |
% place, see the documentation of \docstrip. |
| 1687 |
% |
| 1688 |
% \subsection{Refresh file name databases} |
| 1689 |
% |
| 1690 |
% If your \TeX~distribution |
| 1691 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 1692 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 1693 |
% \verb|mktexlsr|. |
| 1694 |
% |
| 1695 |
% \subsection{Some details for the interested} |
| 1696 |
% |
| 1697 |
% \paragraph{Unpacking with \LaTeX.} |
| 1698 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1699 |
% \begin{description} |
| 1700 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 1701 |
% \item[\LaTeX:] Generate the documentation. |
| 1702 |
% \end{description} |
| 1703 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 1704 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 1705 |
% about your intention: |
| 1706 |
% \begin{quote} |
| 1707 |
% \verb|latex \let\install=y\input{askinclude.dtx}| |
| 1708 |
% \end{quote} |
| 1709 |
% Do not forget to quote the argument according to the demands |
| 1710 |
% of your shell. |
| 1711 |
% |
| 1712 |
% \paragraph{Generating the documentation.} |
| 1713 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1714 |
% the documentation. The process can be configured by the |
| 1715 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 1716 |
% line into this file, if you want to have A4 as paper format: |
| 1717 |
% \begin{quote} |
| 1718 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1719 |
% \end{quote} |
| 1720 |
% An example follows how to generate the |
| 1721 |
% documentation with pdf\LaTeX: |
| 1722 |
% \begin{quote} |
| 1723 |
%\begin{verbatim} |
| 1724 |
%pdflatex askinclude.dtx |
| 1725 |
%bibtex askinclude.aux |
| 1726 |
%makeindex -s gind.ist askinclude.idx |
| 1727 |
%pdflatex askinclude.dtx |
| 1728 |
%makeindex -s gind.ist askinclude.idx |
| 1729 |
%pdflatex askinclude.dtx |
| 1730 |
%\end{verbatim} |
| 1731 |
% \end{quote} |
| 1732 |
% |
| 1733 |
% \section{Acknowledgement} |
| 1734 |
% |
| 1735 |
% \begin{description} |
| 1736 |
% \item[Tom Scavo] |
| 1737 |
% suggested saving the include file list |
| 1738 |
% from the previous run and a simplified user interface. |
| 1739 |
% \item[Joseph Wright] suggested questions for each \cs{include}. |
| 1740 |
% \end{description} |
| 1741 |
% |
| 1742 |
% \printbibliography[ |
| 1743 |
% heading=bibnumbered, |
| 1744 |
% ] |
| 1745 |
% |
| 1746 |
% \begin{History} |
| 1747 |
|
| 1748 |
% \begin{Version}{1991/11/05 v0.95} |
| 1749 |
% \item |
| 1750 |
% First beta-test version (asked two questions). |
| 1751 |
% \end{Version} |
| 1752 |
% \begin{Version}{1991/11/05 v0.99} |
| 1753 |
% \item |
| 1754 |
% Second beta-test version (asks one question; uses `|*|' and `|-|'). |
| 1755 |
% \end{Version} |
| 1756 |
% \begin{Version}{1991/11/07 v1.0} |
| 1757 |
% \item |
| 1758 |
% Changed prompts (sent to \xnewsgroup{comp.text.tex}): |
| 1759 |
% \URL{``\link{Interactive inclusion of files in LaTeX}''}^^A |
| 1760 |
% {https://groups.google.com/group/comp.text.tex/msg/34b770a7c277e79c} |
| 1761 |
% \end{Version} |
| 1762 |
% \begin{Version}{1991/12/13 v1.1} |
| 1763 |
% \item |
| 1764 |
% \textit{Unknown}. |
| 1765 |
% \end{Version} |
| 1766 |
% \begin{Version}{1994/11/02 v1.2e} |
| 1767 |
% \item |
| 1768 |
% Two small changes to run under LaTeX2e [RF]. |
| 1769 |
% \item |
| 1770 |
% Additional documentation [TRS]. |
| 1771 |
% \end{Version} |
| 1772 |
% \begin{Version}{2007/10/15 v1.0 (askinc)} |
| 1773 |
% \item |
| 1774 |
% Reimplementation, published as \xpackage{askinc} in |
| 1775 |
% newsgroup \xnewsgroup{comp.text.tex}:\\ |
| 1776 |
% \URL{``\link{Re: askinclude.sty}''}^^A |
| 1777 |
% {https://groups.google.com/group/comp.text.tex/msg/2d638b84a858fdc8} |
| 1778 |
% \item |
| 1779 |
% Listing of included files, collected from the previous run before |
| 1780 |
% the question. |
| 1781 |
% \item |
| 1782 |
% No error message by \xfile{.aux} file if package is removed. |
| 1783 |
% \end{Version} |
| 1784 |
% \begin{Version}{2007/10/23 v2.0} |
| 1785 |
% \item |
| 1786 |
% The next version of \xpackage{askinc} becomes |
| 1787 |
% version 2.0 of \xpackage{askinclude}. |
| 1788 |
% \item |
| 1789 |
% `|?|' added for questioning each file. |
| 1790 |
% \item |
| 1791 |
% \cs{includeonly} has precedence until package loading. |
| 1792 |
% Then it is disabled by a warning. |
| 1793 |
% \item |
| 1794 |
% Documentation rewritten/added. |
| 1795 |
% \item |
| 1796 |
% Tests added. |
| 1797 |
% \end{Version} |
| 1798 |
% \begin{Version}{2008/08/11 v2.1} |
| 1799 |
% \item |
| 1800 |
% Code is not changed. |
| 1801 |
% \item |
| 1802 |
% URLs updated. |
| 1803 |
% \end{Version} |
| 1804 |
% \begin{Version}{2011/12/02 v2.2} |
| 1805 |
% \item |
| 1806 |
% Bibliography rewritten for biblatex. |
| 1807 |
% \end{Version} |
| 1808 |
% \begin{Version}{2016/05/14 v2.3} |
| 1809 |
% \item |
| 1810 |
% Luatex compatibility |
| 1811 |
% \end{Version} |
| 1812 |
% \begin{Version}{2018/11/01 v2.4} |
| 1813 |
% \item |
| 1814 |
% Remove luatex85 package dependency |
| 1815 |
% \end{Version} |
| 1816 |
% \begin{Version}{2019/12/09 v2.5} |
| 1817 |
% \item |
| 1818 |
% Documentation updates. |
| 1819 |
% \end{Version} |
| 1820 |
% \begin{Version}{2019-12-10 v2.6} |
| 1821 |
% \item Updated |
| 1822 |
% \end{Version} |
| 1823 |
% \begin{Version}{2020-04-12 v2.7} |
| 1824 |
% \item Fixed issue \#1, wrong catcode in filename match after kernel change. |
| 1825 |
% \end{Version} |
| 1826 |
% \end{History} |
| 1827 |
% |
| 1828 |
% \PrintIndex |
| 1829 |
% |
| 1830 |
% \Finale |
| 1831 |
\endinput |