From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/bropd/README | 30 +++ macros/latex/contrib/bropd/bropd.dtx | 361 +++++++++++++++++++++++++++++++++++ macros/latex/contrib/bropd/bropd.pdf | Bin 0 -> 63235 bytes 3 files changed, 391 insertions(+) create mode 100644 macros/latex/contrib/bropd/README create mode 100644 macros/latex/contrib/bropd/bropd.dtx create mode 100644 macros/latex/contrib/bropd/bropd.pdf (limited to 'macros/latex/contrib/bropd') diff --git a/macros/latex/contrib/bropd/README b/macros/latex/contrib/bropd/README new file mode 100644 index 0000000000..361c6804d3 --- /dev/null +++ b/macros/latex/contrib/bropd/README @@ -0,0 +1,30 @@ +bropd package + +Version: 1.2 2014/10/14 + +by Benjamin Tatlock + +The bropd package simplifies the process of writing differential operators and +brackets in LaTeX. The commands facilitate the easy manipulation of equations +involving brackets and allow partial differentials to be expressed in +alternate forms. + + +The "bropd" package is copyright 2012 by Benjamin Tatlock + +It comprises this README file, as well as files +bropd.dtx +bropd.pdf +bropd.sty + +Run LaTeX on the documented source file bropd.dtx to install the package and +generate the accompanying documentation. + +"bropd" may be distributed and/or modified under the conditions of the LaTeX +Project Public License, either version 1.3 of this license or (at your option) +any later version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +This work has the LPPL maintenance status "author-maintained". diff --git a/macros/latex/contrib/bropd/bropd.dtx b/macros/latex/contrib/bropd/bropd.dtx new file mode 100644 index 0000000000..d2d2282bb8 --- /dev/null +++ b/macros/latex/contrib/bropd/bropd.dtx @@ -0,0 +1,361 @@ +% \iffalse The license starting on line four applies to this file +%<*batchfile> +{\obeylines\obeyspaces \gdef\thepreamble{ + +Copyright 2014 by Benjamin Tatlock + +This work may be distributed and/or modified under the conditions of the +LaTeX Project Public License, either version 1.3 of this license or (at your +option) any later version. The latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. + +This work has the LPPL maintenance status `maintained'. + +The Current Maintainer of this work is Benjamin Tatlock. + +This work consists of the file bropd.dtx and the derived files bropd.sty and +bropd.pdf. +}} +\begingroup +\input docstrip +\keepsilent +\expandafter\preamble\thepreamble\endpreamble +\askforoverwritefalse +\generate{\file{bropd.sty}{\from{bropd.dtx}{}}} +\endgroup +\documentclass{ltxdoc} +\usepackage{bropd,color,ifpdf} +\DoNotIndex{\def} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\GetFileInfo{bropd.sty} +\title{The \textsf{bropd} package\thanks{This documentation corresponds to +\textsf{bropd}~v\fileversion, dated \filedate.}} +\def\auth{Benjamin Tatlock} +\author{\auth\thanks{\texttt{\kern2.5em\textcolor{white} +{\char101\char109\char97\char105\char108}\kern-5em\auth\kern-4em\char46\kern +3.5em\char64\textcolor{white}{bropd}\kern-1em\char108\kern-1em\char105\ +\kern-2em\char109\char97\kern1em\char46\textcolor{white} +{\char111\char114\char103}\kern-2em\ com}}} +\begin{document} +\maketitle +\begin{abstract} +The \textsf{bropd} package simplifies the process of writing differential +operators and brackets in \LaTeX. The commands facilitate the easy manipulation +of equations involving brackets and allow partial differentials to be expressed +in alternate forms. +\end{abstract} +\section{Introduction} +The \textsf{bropd} package introduces a bracket command that automatically +selects parentheses, square brackets or braces as appropriate based on the +number of brackets. As such, brackets can be freely added and removed without +alterations to the rest of an equation. Commands for typing ordinary and partial +differentials are also created, with two optional concise forms for partial +derivatives. Equations can therefore be written in a standard form and their +style altered globally at a later date. +\section{Usage} +This section outlines the use of the three commands provided by the +\textsf{bropd} package. +\subsection{Brackets} +The bracket command replaces \verb|\left(| and \verb|\right)| with the single +command, \verb|\br| to produce brackets in a math environment. The input +\verb|\br{x}| produces\[\br{x}.\]When nested, the type of bracket is determined +automatically, for example, \verb|r=\br{\br{x-a}^2+\br{y-b}^2}^{\frac{1}{2}}| +results in\[r=\br{\br{x-a}^2+\br{y-b}^2}^{\frac{1}{2}}.\] +\subsection{Differential operators} +\subsubsection{Ordinary differential} +The \verb|\od| command produces ordinary differentials, such as \verb|\od{y}{x}| +which is displayed as\[\od{y}{x}.\]The order of the differential can be +specified as an optional argument, illustrated here with the command +\verb|\od[2]{u}{x}=-\omega^2u| which results in\[\od[2]{u}{x}=-\omega^2u.\]When +using \verb|\od| with a sans-serif font, the package should be loaded with the +optional argument \verb|sans|. +\subsubsection{Partial differential}The command \verb|\pd| follows the same form +as \verb|\od|, but instead produces partial differentials. By default, +\verb|\pd{u}{t}=6u\pd{u}{x}-\pd[3]{u}{x}| +produces\[\pd{u}{t}=6u\pd{u}{x}-\pd[3]{u}{x}.\]Loading the package with the +option \verb|pdshort| results in an alternative format for partial +differentials:\[u_t=6uu_x-u_{xxx}\]If the optional argument is not a positive +integer, the default form is reverted to, as with \verb|\pd[n]xy|:\[\pd[n]xy\]A +second alternative form is produced when the option \verb|pdalt| is +specified:\[\partial_tu=6u\partial_xu-\partial_{xxx}u\]The syntax for partial +differentials is extended to allow higher order terms such +as\[\pd{u}{x,x,t}\]to be easily typeset with \verb|\pd{u}{x,x,t}|. When applying +a partial derivative to a longer term, the first argument can be left blank and +the longer string written as an additional argument, as demonstrated by +\verb|\pd{}{z}{x+y}| which results in\[\pd{}{z}{x+y}.\]To prevent brackets from +being placed after a partial differential with an empty numerator, use +\verb|!| for the first argument, for example, \verb|\pd{!}{x}|:\[\pd{!}{x}\] +\subsection{Further examples} +Combining the commands provided by this package allows more complex terms to be +written concisely. The \verb|\br| allows equations with multiple brackets to be +constructed and manipulated quickly and easily. An example of this is +\verb|\br{x-y}\br{Q-\frac12\br{P+\br{x-1}\br{\br{a+b}\br{u+c}-\od st}}}|, which +results in\[\br{x-y}\br{Q-\frac12\br{P+\br{x-1}\br{\br{A+B}\br{u+c}-\od st}}}.\] +The form of the partial differentials written with the \verb|\pd| command can +be changed at any time. \verb|\pd Et+\sum_{i=1}^3\pd{}{x_i}{\br{E+p}u_i}| +produces\[\pd Et+\sum_{i=1}^3\pd{}{x_i}{\br{E+p}u_i}\]by default. With +\verb|pdshort|, the same input instead +creates\[E_t+\sum_{i=1}^3\br{\br{E+p}u_i}_{x_i},\]while with \verb|pdalt| the +output is\[\partial_tE+\sum_{i=1}^3\partial_{x_i}\br{\br{E+p}u_i}.\] +\StopEventually{\typeout{**************************************************} +\typeout{*} +\typeout{* To finish the installation, you have to move the} +\typeout{* following file into a directory searched by TeX:} +\typeout{*} +\typeout{* \space\space bropd.sty} +\typeout{*} +\typeout{* Documentation is in bropd.\ifpdf pdf\else dvi\fi.} +\typeout{*} +\typeout{**************************************************}\end{document}} +\clearpage +\DocInput{bropd.dtx} +\clearpage +\PrintChanges +\Finale +% +% \fi +% \section{Implementation} +% Announce the name, package version and \LaTeXe\ requirement +% \changes{v1.0}{2012/11/04}{Initial version} +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bropd} +[2014/10/14 1.2 automated typing of brackets and differential operators] +% \end{macrocode} +% Initiate conditionals and counters +% \begin{macrocode} +\newif\if@bropd@a\newif\if@bropd@b\newif\if@bropd@s\newif\if@bropd@u +\newcounter{@bropd@c}\newcounter{@bropd@d} +\newcounter{@bropd@e}\newcounter{@bropd@f} +% \end{macrocode} +% Provide optional arguments for alternative form partial differential and +% sans-serif fonts +% \begin{macrocode} +\DeclareOption{pdshort}{\@bropd@atrue\@bropd@ufalse} +\DeclareOption{pdalt}{\@bropd@atrue\@bropd@utrue} +\DeclareOption{sans}{\@bropd@strue}\ProcessOptions +% \end{macrocode} +% Define character for \verb|\pd| with empty numerator and no brackets following +% \begin{macrocode} +\def\@bropd@t{!} +% \end{macrocode} +% \begin{macro}{\@bropd@g} +% Internal command for default partial differential form +% \begin{macrocode} +\def\@bropd@g#1#2#3#4{\def\@bropd@h{#1} +% \end{macrocode} +% Create numerator +% \begin{macrocode} +\ifx\@bropd@o\@bropd@t\let\@bropd@o\empty\fi +% \end{macrocode} +% Reset counters +% \begin{macrocode} +\ifx\@bropd@h\empty +\setcounter{@bropd@c}0\setcounter{@bropd@d}1 +\let\@bropd@h\empty +% \end{macrocode} +% Determine order of partial derivative and display as power of partial if +% greater than one +% \begin{macrocode} +\@for\@bropd@i:=#3\do{\stepcounter{@bropd@c}} +\frac{#4\ifnum\value{@bropd@c}>1 +^{\arabic{@bropd@c}}\fi\@bropd@o} +% \end{macrocode} +% Cycle through each term for the denominator. If a term is the same as the +% previous, add to counter, otherwise print along with counter value +% \begin{macrocode} +{\@for\@bropd@i:=#3\do{ +\ifx\@bropd@i\@bropd@h +\stepcounter{@bropd@d} +\else +\@bropd@h +\ifnum\value{@bropd@d}>1 +^{\arabic{@bropd@d}} +\fi +#4\setcounter{@bropd@d}1 +\fi +\let\@bropd@h\@bropd@i} +\@bropd@h +\ifnum\value{@bropd@d}>1 +^{\arabic{@bropd@d}}\fi} +\else +% \end{macrocode} +% If optional argument provided, display partial differential to stated order +% \changes{v1.1}{2012/11/08}{Fixed higher order differentials with denominators +% containing commands} +% \begin{macrocode} +\frac{#4^{#1}\@bropd@o}{#4\noexpand#3^{#1}} +\fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@bropd@j} +% Internal command for brackets. Evaluate terms within brackets to determine the +% highest bracket level +% \changes{v\fileversion}\filedate{Changed \cs{bgroup} to \cs{begingroup} and +% \cs{egroup} to \cs{endgroup} to remove erroneous introduction of space before +% and after brackets} +% \begin{macrocode} +\def\@bropd@j#1{\setcounter{@bropd@f}0 +\begingroup\renewcommand{\br}[1]{\stepcounter{@bropd@e}##1 +\ifnum\value{@bropd@e}>\value{@bropd@f} +\setcounter{@bropd@f}{\value{@bropd@e}} +\fi +\addtocounter{@bropd@e}{-1}}\sbox0{$#1$}\endgroup +\loop +\ifnum\value{@bropd@f}>2 +\addtocounter{@bropd@f}{-3} +\repeat +% \end{macrocode} +% Detemine bracket type for current level +% \begin{macrocode} +\ifnum\value{@bropd@f}>0 +\ifnum\value{@bropd@f}>1 +\def\@bropd@k{\left\lbrace#1\right\rbrace} +\else +\def\@bropd@k{\left[#1\right]} +\fi +\else +\def\@bropd@k{\left(#1\right)} +\fi} +\if@bropd@a +\let\@bropd@l\empty +% \end{macrocode} +% \end{macro} +% \begin{macro}{\br} +% External command for brackets +% \begin{macrocode} +\newcommand\br[1]{\let\@bropd@m\@bropd@l +\@bropd@j{\let\@bropd@l\empty#1\let\@bropd@l\@bropd@m} +\ifx\@bropd@l\empty +\def\@bropd@n{\@bropd@k} +\else +\let\@bropd@m\@bropd@l +\def\@bropd@n{\@bropd@k_{\@bropd@m}} +\fi +\let\@bropd@l\empty +\@bropd@n} +\if@bropd@u +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@bropd@q} +% Internal command for first alternative partial differential command +% \changes{v1.1}{2012/11/08}{Added second alternative form for partial +% differentials} +% \begin{macrocode} +\def\@bropd@q#1#2#3{\def\@bropd@h{#1} +\ifx\@bropd@h\empty +\@bropd@bfalse +\else +% \end{macrocode} +% Default partial differential if character provided as optional argument +% \changes{v1.1}{2012/11/08}{Allowed partial differential with empty numerator +% without need for bracket command after} +% \begin{macrocode} +\if!\ifnum9<1#1!\else_\fi +\@bropd@bfalse +\else +\@bropd@btrue +\fi +\fi +\ifx\@bropd@o\@bropd@t +\@bropd@btrue\let\@bropd@o\empty +\fi +\if@bropd@b\@bropd@g{#1}\@bropd@o{\noexpand#3}\partial +\else +% \end{macrocode} +% Construct alternate form partial differential +% \begin{macrocode} +\partial_{\ifx\@bropd@h\empty +\@for\@bropd@i:=#3\do\@bropd@i\else\setcounter{@bropd@c}0 +\loop +\ifnum\value{@bropd@c}<#1 +#3\stepcounter{@bropd@c} +\repeat +\fi} +\@bropd@o +\fi} +\else +% \end{macrocode} +% Internal command for second alternative partial differential command +% \begin{macrocode} +\def\@bropd@q#1#2#3{\def\@bropd@h{#1} +\ifx\@bropd@h\empty +\@bropd@bfalse +\else +% \end{macrocode} +% Default partial differential if character provided as optional argument +% \begin{macrocode} +\if!\ifnum9<1#1!\else_\fi +\@bropd@bfalse +\else +\@bropd@btrue +\fi +\fi +\ifx\@bropd@o\@bropd@t +\@bropd@btrue\let\@bropd@o\empty +\fi +\if@bropd@b\@bropd@g{#1}\@bropd@o{\noexpand#3}\partial +\else +% \end{macrocode} +% Construct alternate form partial differential +% \begin{macrocode} +\def\@bropd@p{\ifx\@bropd@h\empty +\@for\@bropd@i:=#3\do\@bropd@i\else\setcounter{@bropd@c}0 +\loop +\ifnum\value{@bropd@c}<#1 +#3\stepcounter{@bropd@c} +\repeat +\fi} +\ifx\@bropd@o\empty +\let\@bropd@l\@bropd@p\else{\@bropd@o}{_{\@bropd@p}}\fi\fi} +\fi +\else +% \end{macrocode} +% Internal command for default partial differentials +% \begin{macrocode} +\def\@bropd@q#1#2#3{\@bropd@g{#1}{#2}{\noexpand#3}\partial} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\br} +% External command for brackets +% \begin{macrocode} +\newcommand\br[1]{\@bropd@j{#1}\@bropd@k} +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\pd} +% \changes{v1.1}{2012/11/08}{Brackets automatically added after empty numerator} +% \begin{macrocode} +\newcommand\pd[3][]{\def\@bropd@o{#2} +\ifx\@bropd@o\empty +\let\@bropd@v\br +\else +\let\@bropd@v\empty +\fi +\@bropd@q{#1}{#2}{#3}\@bropd@v} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@bropd@r} +% Format ordinary differential based on font type +% \begin{macrocode} +\if@bropd@s +\def\@bropd@r{\mathsf d} +\else +\def\@bropd@r{\mathrm d} +\fi +% \end{macrocode} +% \end{macro} +% \begin{macro}{\od} +% External command for ordinary differentials +% \begin{macrocode} +\newcommand\od[3][]{\def\@bropd@h{#1} +\frac{\@bropd@r\ifx\@bropd@h\empty\else^{#1}\fi#2} +{\@bropd@r#3\ifx\@bropd@h\empty\else^{#1}\fi}} +\endinput +% \end{macrocode} +% \end{macro} +% \endinput diff --git a/macros/latex/contrib/bropd/bropd.pdf b/macros/latex/contrib/bropd/bropd.pdf new file mode 100644 index 0000000000..9feba4acee Binary files /dev/null and b/macros/latex/contrib/bropd/bropd.pdf differ -- cgit v1.2.3