%%% ==================================================================== %%% @LaTeX-file{ %%% filename = "amsintsm.dtx", %%% version = "1.2beta", %%% date = "1994/10/28", %%% time = "12:16:44 EDT", %%% author = "American Mathematical Society", %%% copyright = "Copyright (C) 1994 American Mathematical Society, %%% all rights reserved. Copying of this file is %%% authorized only if either: %%% (1) you make absolutely no changes to your copy, %%% including name; OR %%% (2) if you do make changes, you first rename it %%% to some other name.", %%% address = "American Mathematical Society, %%% Technical Support, %%% Electronic Products and Services, %%% P. O. Box 6248, %%% Providence, RI 02940, %%% USA", %%% telephone = "401-455-4080 or (in the USA and Canada) %%% 800-321-4AMS (321-4267)", %%% FAX = "401-331-3842", %%% checksum = "51467 355 1811 14705", %%% email = "tech-support@math.ams.org (Internet)", %%% codetable = "ISO/ASCII", %%% keywords = "latex, amslatex, ams-latex, integral, limits", %%% supported = "yes", %%% abstract = "This is part of the AMS-\LaTeX{} distribution. %%% It provides some commands for printing %%% integrals, sums, and derivatives.", %%% docstring = "The checksum field above contains a CRC-16 %%% checksum as the first value, followed by the %%% equivalent of the standard UNIX wc (word %%% count) utility output of lines, words, and %%% characters. This is produced by Robert %%% Solovay's checksum utility.", %%% } %%% ==================================================================== % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e} \documentclass{amsdtx} \title{The \pkg{amsintsm} package} \author{American Mathematical Society\\Michael Downes} \date{Version \fileversion, \filedate} \begin{document} \hDocInput{amsintsm.dtx} \end{document} % % \fi % % \maketitle % % \MakeShortVerb\| %^^A LaTeX's tabular works poorly when cell contents have unusual/varying %^^A heights. Let's define a substitute. % \newenvironment{tab1}{\par\addvspace\medskipamount % \tabskip0pt plus\textwidth \def\\{\cr}\openup2pt % \def\hline{\noalign{\nobreak\vskip2pt\hrule\nobreak\vskip3pt}}% % \halign to\columnwidth\bgroup\tabskip1em minus.6em % \tbox{.3}\xverb##\strut\par\egroup\hfil& % $\displaystyle##$\hfil& % \tbox{.3}\xverb##\strut\par\egroup\hfil % \tabskip0pt plus\textwidth\cr % }{% % \crcr\egroup \addvspace\medskipamount % } % %^^A Column head for tab1: % \newcommand\ch[1]{\omit\textbf{#1}\hfil} % % \newcommand{\tbox}[1]{% % \vtop\bgroup\hsize#1\columnwidth\raggedright\def\\{\cr}% % \noindent\hangindent1em \strut} % %^^A Define a pseudo-\verb that allows friendlier line breaking % \def\xverb"{\verb"\catcode`\\\active \catcode`\ =10 % \hyphenchar\font=`\}\relax} % \begingroup \lccode`\~=`\\\lowercase{\endgroup % \def~}{\penalty100 \char92 } % %^^A Emulate Sb so we don't need to load amstex for this documentation. % \newenvironment{Sb}{_\bgroup\renewcommand{\arraystretch}{0.8}% % \everymath{\scriptstyle}\array{@{}c@{}}% % }{ % \endarray\egroup % } % % \section{Introduction} % % In a new package \pkg{amsintsm} (`amsintsum' shortened to 8 % letters) I attempt to provide a more rational syntax for the % \cn{int} and \cn{sum} commands, with a view to supporting % information processing possibilities that require better markup % (e.g., indicating the end of the sum or integral body for a % vision-impaired `reader' hearing the formula through a % text-to-speech converter; or changing the font of the differential % $d$ according to different conventions). % % The basic goal is to make the simplest form of the \cn{int} command % cover most of the common variations for integral notation in a way % that clearly marks the variable of integration, the lower and upper % limits if present, and the boundaries of the integral body---and to % do this in a way that is convenient for authors to write. Because % the notation can vary widely, we won't attempt to make the primary % \cn{int} command handle all possibilities, but instead provide some % alternate versions of the \cn{int} command to handle special cases. % Here is a table showing various integral possibilities, typical % markup under current conventions, and proposed `rational' markup. % \begin{tab1} % \ch{Old markup}& \ch{Printed result}& \ch{Proposed markup}\\ % \hline % "\int f(x)"& \int f(x)& % "\int{f(x)}"\\ % "\int f(x)\,dx"& \int f(x)\,dx& % "\int[x]{f(x)}"\\ % "\int_0^1 f(x)\,dx"& \int_0^1 f(x)\,dx& % "\int[x,0,1]{f(x)}"\\ % "\int_S f(x)\,dx"& \int_S f(x)\,dx& % "\int[x,S]{f(x)}"\\ % "\int_0^1 \frac{dx}{f(x)}"& \int_0^1 \frac{dx}{f(x)}& % "\int[,0,1] {\frac{\diffl{x}}{f(x)}"\\ % "\int_A^B\!\!\int_{S'} f(x,y)\,dS\,dx"& % \int_A^B\!\!\int_{S'} f(x,y)\,dS\,dx& % "\int[x,A,B] {\int[S,S'] {f(x,y)}}"\\ % "\int\!\!\int f(x,y)\,dy\,dx"& \int\!\!\int f(x,y)\,dy\,dx& % "\ints[2,y,x] {f(x,y)}"\\ % "\int\!\!\int\!\!\int f(x,y,z)\,dz\,dy\,dx"& % \int\!\!\int\!\!\int f(x,y,z)\,dz\,dy\,dx& % "\ints[3,z,y,x] {f(x,y,z)}" % \end{tab1} % % Thus the \cn{int} command takes one mandatory argument (the % integral body) and three optional arguments in the form % \verb'[a,b,c]', where trailing arguments in the comma-separated % list can be dropped if not applicable. The \cn{ints} command takes % the body as a mandatory argument, and the number of optional % arguments varies according to the multiplicity of the integral % symbol, which is given as the first optional argument. For a first % argument $n=1,2,\ldots$, the next $n$ arguments are taken to be the % variables of integration and printed in reverse order at the end. % That is, \verb'\ints[2,x,y,S]' means a double integral with % variables $x$ and $y$, over the area labeled $S$. % % Commands \cn{dx}, \cn{dy}, etc., are not provided, but rather a % differential command \cn{diffl} taking one argument. If you need to % use \cn{diffl} frequently in a document with particular variables, % then you would add \cn{newcommand} statements in the document % preamble to define abbreviations for and only for the ones you % need: % \begin{verbatim} % \newcommand{\dx}{\diffl{x}} % \newcommand{\dt}{\diffl{t}} % \end{verbatim} % Naturally, the syntax of \cn{sum}, \cn{prod}, and other commands % would follow the general lines of the proposed \cn{int} syntax. % \begin{tab1} % \ch{Old markup}& \ch{Printed result}& \ch{Proposed markup}\\ % \hline % "\sum a_i"& \sum a_i& "\sum{a_i}"\\ % "\sum_{a_i=\theta_i r_i} f(a)"& % \sum_{a_i=\theta_i r_i} f(a)& % "\sum[i,a_i=\theta_i r_i] {f(a)}"\\ % "\bigcup_{00$ that often occur? Or you might % give the variable of summation but for printing purposes just % ignore it: |\sum[i,i=1,\infty]{a_i}|, that is, always give the % limits in full. Or you might just leave out that slot and make the % first optional argument the lower limit of summation. % % \item On a similar note, for the purpose of accurately describing a % given integral it would be better to retain the variable of % integration in the argument list even when it is not printed in the % normal place. That is, instead of writing % \begin{verbatim} % \int[,0,1] {\frac{\diffl{x}}{f(x)} % \end{verbatim} % when the $dx$ goes into the numerator of a fraction, we would like % some other syntax that retains the `logical' argument list % |[x,0,1]| but somehow indicates that the $dx$ should be printed in % a different spot. Perhaps a different command name \cn{fracint} % instead of \cn{int} that has two arguments instead of one for the % body (numerator, denominator) and places the $dx$ at the end of the % numerator? % % \item What is the natural order for the arguments in a multiple % integral such as % \begin{verbatim} % \ints[3,z,y,x] {f(x,y,z)} % \end{verbatim} % That is, should it be |z,y,x| or |x,y,z|? % % \item What should be provided in the way of a generalized integral % or sum command that can handle more problematic variations? For % example, one might want to have something like % \begin{verbatim} % \gint{variable}{lower limit}{upper limit}{body}{differential} % \end{verbatim} % where the first argument is ignored (just included for % informational purposes), any of the arguments is allowed to be % empty, and nothing is added to any of them except the obvious % sub\slash superscripting operations and horizontal spacing. % % \end{itemize} % % \subsection{Note} % The current implementation [1994/10/28] redefines \cn{int} and % \cn{sum}, defines \cn{diffl}, \cn{pdiffl} for differential % notation, and defines \cn{deriv}, \cn{pderiv} for the most common % kinds of derivative fractions. Remaining to be done: \cn{ints}; % \cn{prod}, \cn{bigcup}, and the other large operator symbols that % should behave like \cn{sum}; the * option of \cn{int} and \cn{sum}; % etc. % % \StopEventually{} % % \section{Implementation} % % Standard package info. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{amsintsm}[1994/10/12 v1.2beta] % \end{macrocode} % % Need \cs{new@ifnextchar}, \cs{@ifnotempty} from the \pkg{amsgen} % package. % \begin{macrocode} \RequirePackage{amsgen} % \end{macrocode} % % The \pkg{amstex} package defines \cs{DOTSB}, \cs{slimits@}, % \cs{ilimits@}. % \begin{macrocode} \@ifundefined{DOTSB}{% \let\DOTSB\relax \let\slimits@\displaylimits \let\ilimits@\nolimits % \end{macrocode} % Revert the meaning of \cn{sum} in preparation for saving it as % \cn{sumsymbol}. % If the \pkg{amstex} package is loaded, \cn{sum} is no longer a % simple mathchardef, we need to get \cs{sum@} instead. % \begin{macrocode} \let\sum=\sum@ }{}% % \end{macrocode} % % Save the previous definitions for the sum and integral symbols. % Assumption: \cn{sum} and \cn{intop} are suitable mathchardefs for % the math fonts currently in use. % \begin{macrocode} \def\intsymbol{\intop\ilimits@} \let\sumsymbol=\sum % \end{macrocode} % % \begin{macrocode} \DeclareRobustCommand{\int}{\DOTSB \new@ifnextchar[{\@integral}{\@integral[]}} % \end{macrocode} % % \begin{macrocode} \def\@integral[#1]{\@integrala#1,,,\@nil} \def\@integrala#1,#2,#3,#4\@nil#5{% \intop\ilimits@ \@ifnotempty{#2}{_{#2}}% \@ifnotempty{#3}{^{#3}}% #5\@ifnotempty{#1}{\diffl{#1}}% } % \end{macrocode} % % Differential d should be roman according to some conventions, % instead of italic. If the \cn{diffl} function is used the output % can be changed according to the prevailing convention. I guess this % should be made into a package option. For the moment you get the % default which is italic. % \begin{macrocode} \DeclareRobustCommand{\diffl}[1]{\mathinner{d#1}} \DeclareRobustCommand{\pdiffl}[1]{\mathinner{\partial#1}} % \end{macrocode} % % A couple of things for derivatives: % \begin{macrocode} \DeclareRobustCommand{\deriv}[2]{\frac{\diffl{#1}}{\diffl{#2}}} \DeclareRobustCommand{\pderiv}[2]{\frac{\pdiffl{#1}}{\pdiffl{#2}}} % \end{macrocode} % % \begin{macrocode} \DeclareRobustCommand{\sum}{\DOTSB \new@ifnextchar[{\@summation}{\@summation[]}} \def\@summation[#1]{\@summationa#1,,\@nil} \def\@summationa#1,#2,#3\@nil{\sumsymbol\slimits@ \@ifnotempty{#1}{_{#1}}\@ifnotempty{#2}{^{#2}}\mathinner{}} % \end{macrocode} % % The usual \cs{endinput} to ensure that random garbage at the end of % the file doesn't get copied by \fn{docstrip}. % \begin{macrocode} \endinput % \end{macrocode} % % \CheckSum{78} % \Finale