| 1 |
% \iffalse meta-comment |
| 2 |
% !TEX program = pdfLaTeX |
| 3 |
%<*internal> |
| 4 |
\iffalse |
| 5 |
%</internal> |
| 6 |
%<*readme> |
| 7 |
---------------------------------------------------------------- |
| 8 |
odesandpdes --- A package for the streamlining of the use of |
| 9 |
odes and pdes in mathematical texts typset by LaTeX |
| 10 |
|
| 11 |
E-mail: [email protected] |
| 12 |
Released under the LaTeX Project Public License v1.3c or later |
| 13 |
See http://www.latex-project.org/lppl.txt |
| 14 |
---------------------------------------------------------------- |
| 15 |
|
| 16 |
This package is the solution no one asked for, to a problem |
| 17 |
nobody had. Have you ever thought to yourself "wow, I sure do |
| 18 |
dislike having to remember multiple macros for my odes and pdes" |
| 19 |
and the author of this package has to agree, wholeheartedly. |
| 20 |
In the modern world of "tik-toking" and "family guy surfing", |
| 21 |
our brains have rotted beyond salvage for even basic levels of |
| 22 |
cognitive recall. This package aims to fix this, through two |
| 23 |
macros that have been set to each have an identical form and |
| 24 |
function. with an emphasis on intuitive use. Through setting |
| 25 |
options, the multiple common notational style are easily |
| 26 |
swapped between, all by a single option. |
| 27 |
You're Welcome. |
| 28 |
|
| 29 |
---------------------------------------------------------------- |
| 30 |
%</readme> |
| 31 |
%<*internal> |
| 32 |
\fi |
| 33 |
\def\nameofplainTeX{plain} |
| 34 |
\ifx\fmtname\nameofplainTeX\else |
| 35 |
\expandafter\begingroup |
| 36 |
\fi |
| 37 |
%</internal> |
| 38 |
%<*install> |
| 39 |
\input docstrip.tex |
| 40 |
\keepsilent |
| 41 |
\askforoverwritefalse |
| 42 |
\preamble |
| 43 |
---------------------------------------------------------------- |
| 44 |
odesandpdes --- A package for the streamlining of the use of |
| 45 |
odes and pdes in mathematical texts typset by LaTeX |
| 46 |
|
| 47 |
E-mail: [email protected] |
| 48 |
Released under the LaTeX Project Public License v1.3c or later |
| 49 |
See http://www.latex-project.org/lppl.txt |
| 50 |
---------------------------------------------------------------- |
| 51 |
\endpreamble |
| 52 |
\postamble |
| 53 |
File: odesandpdes.dtx |
| 54 |
|
| 55 |
Copyright (C) 2024 by Anakin [email protected] |
| 56 |
----------------------------------------------------------- |
| 57 |
|
| 58 |
This work may be distributed and/or modified under the |
| 59 |
conditions of the LaTeX Project Public License (LPPL), either |
| 60 |
version 1.3c of this license or (at your option) any later |
| 61 |
version. The latest version of this license is in the file: |
| 62 |
|
| 63 |
http://www.latex-project.org/lppl.txt |
| 64 |
|
| 65 |
This work is "maintained" (as per LPPL maintenance status) by |
| 66 |
Anakin. |
| 67 |
|
| 68 |
This work consists of the file odesandpdes.dtx |
| 69 |
and the derived files odesandpdes.ins, |
| 70 |
odesandpdes.pdf and |
| 71 |
odesandpdes.sty. |
| 72 |
|
| 73 |
\endpostamble |
| 74 |
\usedir{tex/latex/odesandpdes} |
| 75 |
\generate{ |
| 76 |
\file{\jobname.sty}{\from{\jobname.dtx}{package}} |
| 77 |
} |
| 78 |
%</install> |
| 79 |
%<install>\endbatchfile |
| 80 |
%<*internal> |
| 81 |
\usedir{source/latex/odesandpdes} |
| 82 |
\generate{ |
| 83 |
\file{\jobname.ins}{\from{\jobname.dtx}{install}} |
| 84 |
} |
| 85 |
\nopreamble\nopostamble |
| 86 |
\usedir{doc/latex/odesandpdes} |
| 87 |
\generate{ |
| 88 |
\file{README.txt}{\from{\jobname.dtx}{readme}} |
| 89 |
} |
| 90 |
\ifx\fmtname\nameofplainTeX |
| 91 |
\expandafter\endbatchfile |
| 92 |
\else |
| 93 |
\expandafter\endgroup |
| 94 |
\fi |
| 95 |
%</internal> |
| 96 |
%<*package> |
| 97 |
\NeedsTeXFormat{LaTeX2e} |
| 98 |
\ProvidesPackage{odesandpdes}[2024/01/17 v1.0.0 For streamlining ODE and PDE usage] |
| 99 |
% |
| 100 |
%</package> |
| 101 |
%<*driver> |
| 102 |
\PassOptionsToPackage{hidelinks, breaklinks= true, |
| 103 |
linkcolor = [rgb]{0,0,0}, urlcolor = [rgb]{0,0,0}, citecolor = [rgb]{0,0,0}, |
| 104 |
pdfdisplaydoctitle = true, |
| 105 |
pdfkeywords={LaTeX, dtx, source, odesandpdes, ODE, PDE, differentials}, |
| 106 |
pdfsubject={Optimizing useage of ODE and PDE commands for LaTeX}, |
| 107 |
pdfauthor={Anakin}, pdftitle={The odesandpdes package}}{hyperref} |
| 108 |
\documentclass[11pt,a4paper]{ltxdoc} |
| 109 |
\usepackage[T1]{fontenc} |
| 110 |
\usepackage{indentfirst} |
| 111 |
\usepackage[centering, vscale = 0.80, hscale = 0.65]{geometry} |
| 112 |
\usepackage{mathptmx,amsmath,fdsymbol} |
| 113 |
\usepackage{\jobname} |
| 114 |
\usepackage{tikz} |
| 115 |
\usetikzlibrary{graphs,quotes} |
| 116 |
\makeatletter |
| 117 |
\setlength{\parskip}{5\p@ plus2\p@ minus2\p@} |
| 118 |
\setlength{\jot}{7\p@} |
| 119 |
\makeatother |
| 120 |
\EnableCrossrefs |
| 121 |
\CodelineIndex |
| 122 |
\RecordChanges |
| 123 |
\begin{document} |
| 124 |
\DocInput{\jobname.dtx} |
| 125 |
\end{document} |
| 126 |
%</driver> |
| 127 |
% \fi |
| 128 |
% |
| 129 |
% \CheckSum{618} |
| 130 |
% |
| 131 |
% \DoNotIndex{\def,\gdef,\global,\edef,\xdef,\long,\let,\futurelet} |
| 132 |
% \DoNotIndex{\ifnum,\ifdim,\iftrue,\iffalse,\ifx,\ifcase,\else,\or,\fi} |
| 133 |
% \DoNotIndex{\kern,\mkern,\setbox,\box} |
| 134 |
% \DoNotIndex{\bgroup,\egroup,\begingroup,\endgroup,\begin,\end} |
| 135 |
% \DoNotIndex{\relax,\endinput} |
| 136 |
% \DoNotIndex{\csname,\endcsname,\string,\the,\noexpand,\expandafter} |
| 137 |
% \DoNotIndex{\hbox,\raise,\lower,\vbox,\vtop,\vcenter,\left,\right} |
| 138 |
% \DoNotIndex{\newcount,\newbox,\newtoks,\countdef} |
| 139 |
% \DoNotIndex{\above,\atop,\over} |
| 140 |
% \DoNotIndex{\cdot,\cdots,\dot,\dots,\prime} |
| 141 |
% \DoNotIndex{\displaystyle,\scriptstyle,\scriptscriptstyle} |
| 142 |
% \DoNotIndex{\advance,\count,\dimen} |
| 143 |
% \DoNotIndex{\baselineskip,\lineskip} |
| 144 |
% \DoNotIndex{\loop,\repeat} |
| 145 |
% \DoNotIndex{\DeclareOptionX,\ExecuteOptionsX,\ProcessOptionsX} |
| 146 |
% \DoNotIndex{\m@ne,\z@,\@ne,\tw@,\p@,\@@tmp} |
| 147 |
% |
| 148 |
% \CharacterTable |
| 149 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 150 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 151 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 152 |
% Exclamation \! Double quote \" Hash (number) \# |
| 153 |
% Dollar \$ Percent \% Ampersand \& |
| 154 |
% Acute accent \' Left paren \( Right paren \) |
| 155 |
% Asterisk \* Plus \+ Comma \, |
| 156 |
% Minus \- Point \. Solidus \/ |
| 157 |
% Colon \: Semicolon \; Less than \< |
| 158 |
% Equals \= Greater than \> Question mark \? |
| 159 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 160 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 161 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 162 |
% Right brace \} Tilde \~} |
| 163 |
% |
| 164 |
% |
| 165 |
% \iffalse |
| 166 |
%<*documentation> |
| 167 |
% \fi |
| 168 |
% |
| 169 |
% |
| 170 |
% \GetFileInfo{\jobname.sty} |
| 171 |
% |
| 172 |
% \author{Anakin\\ \texttt{[email protected]}} |
| 173 |
% \title{The \textsf{odesandpdes} package\thanks{This document |
| 174 |
% corresponds to \textsf{odesandpdes}~\fileversion, dated \filedate.}} |
| 175 |
% \date{Released \filedate} |
| 176 |
% |
| 177 |
% \maketitle |
| 178 |
% |
| 179 |
% |
| 180 |
% \changes{v1.0}{2024/01/17}{Initial version} |
| 181 |
% |
| 182 |
% \begin{abstract} |
| 183 |
% This package is the solution no one asked for, to a problem |
| 184 |
% nobody had. Have you ever thought to yourself "wow, I sure do |
| 185 |
% dislike having to remember \emph{multiple} macros for my odes and pdes" |
| 186 |
% and the author of this package has to agree, wholeheartedly. |
| 187 |
% In the modern world of "tik-toking" and "family guy surfing", |
| 188 |
% our brains have rotted beyond salvage for even basic levels of |
| 189 |
% cognitive recall. This package aims to fix this, through two |
| 190 |
% macros that have been set to each have an identical form and |
| 191 |
% function, with an emphasis on intuitive use. |
| 192 |
% Through setting options, the multiple |
| 193 |
% common notational style are easily |
| 194 |
% swapped between, all by a single option. |
| 195 |
% \emph{You're welcome}. |
| 196 |
% \end{abstract} |
| 197 |
% |
| 198 |
% |
| 199 |
% |
| 200 |
% |
| 201 |
% {\setlength{\parskip}{0.25ex}\small |
| 202 |
% \tableofcontents} |
| 203 |
% |
| 204 |
% |
| 205 |
% |
| 206 |
% \newpage |
| 207 |
% \section*{My funny little ODE/PDE package} |
| 208 |
% \hspace{1em} Start by first having \verb|odesandpdes.sty| downloaded in an |
| 209 |
% accessible directory, or in the same directory as your |
| 210 |
% overleaf main.tex, using it by inserting; |
| 211 |
% \begin{center} |
| 212 |
% \cs{usepackage\oarg{options}\{odesandpdes\}} |
| 213 |
% \end{center} |
| 214 |
% into the preamble, Ideally after any font changing packages you use. |
| 215 |
% |
| 216 |
% \section{Usage} |
| 217 |
% |
| 218 |
% If the reader does not wish to be gradually introduced to the package |
| 219 |
% and its features, feel free to skip directly to section \ref{sec:examples}. |
| 220 |
% |
| 221 |
% \subsection{Options} |
| 222 |
% |
| 223 |
% \DescribeMacro{notation} |
| 224 |
% \DescribeMacro{maxprimes} |
| 225 |
% The options included are based off of the three most |
| 226 |
% common notations |
| 227 |
% (according to Wikipedia), Lagrange, Leibniz, and Newton. |
| 228 |
% They can be accessed through the \oarg{options} when importing the package; |
| 229 |
% \par\hbox to \textwidth{\hss |
| 230 |
% \cs{usepackage[notation=\meta{option}]\{odesandpdes\}} \hss} |
| 231 |
% |
| 232 |
% In the case of Lagrange or Newton notation, there is the |maxprimes| option |
| 233 |
% for determination of how many physical markings are allowed to be |
| 234 |
% made before the notation switches to a symbolic version; |
| 235 |
% \par\hbox to \textwidth{\hss |
| 236 |
% \cs{usepackage[maxprimes=\meta{integer}]\{odesandpdes\}}\hss} |
| 237 |
% \vspace{1ex} |
| 238 |
% |
| 239 |
% |
| 240 |
% \DescribeMacro{\setDE} |
| 241 |
% However, if one might wish to change it on a section to section basis, |
| 242 |
% the command \cs{setDE}\marg{options} is able |
| 243 |
% to take any package option as an argument and will |
| 244 |
% apply the new option going forward. |
| 245 |
% |
| 246 |
% |
| 247 |
% \par\hbox to \textwidth{\hss |
| 248 |
% \begin{tabular}{lcl}\hline |
| 249 |
% Option list & Default Value & Valid Arguments \\ \hline |
| 250 |
% notation & Leibniz & {default, Lagrange, Leibniz, Newton} \\ |
| 251 |
% maxprimes & 3 & $\text{maxprimes} = n, n \in \mathbb N_+$ \\ \hline |
| 252 |
% \end{tabular}\hss} |
| 253 |
% |
| 254 |
% |
| 255 |
% |
| 256 |
% \subsection{The Meat and Potatoes} |
| 257 |
% |
| 258 |
% \hspace{1em} The command(s) are approached with the philosophy |
| 259 |
% of of an intuitive and modular usage. |
| 260 |
% The full extent of its usage can look like; |
| 261 |
% \begin{equation*} |\ode*[x]^2 X(x) =\ode T_{\eta} at 0; -\alpha| |
| 262 |
% \Rightarrow |
| 263 |
% \ode*[x]^2 X(x)=\ode T_{\eta} at 0; -\alpha |
| 264 |
% \end{equation*} |
| 265 |
% very quickly, and very easily building complex interactions |
| 266 |
% of differentials. |
| 267 |
% The quick functional break down of each element that comprises the macro; |
| 268 |
% \newline |
| 269 |
% \centerline{ \cs{ode}\meta{star}\oarg{variable}\string^\meta{degree} |
| 270 |
% \marg{function}at\textvisiblespace\meta{position};}\vspace{1ex} |
| 271 |
% \par\hbox to \textwidth{\hss |
| 272 |
% \begin{tabular}{cl}\hline |
| 273 |
% Argument & Usage \\ \hline |
| 274 |
% \oarg{variable} & The variable being derived \\ |
| 275 |
% \meta{degree} & The order/degree of the derivative \\ |
| 276 |
% \marg{function} & The function being derived \\ |
| 277 |
% \textvisiblespace at\textvisiblespace\meta{point}; |
| 278 |
% & Where the function is being derived \\ \hline |
| 279 |
% \end{tabular}\hss}\vspace{1ex} |
| 280 |
% All arguments are conditionally optional, only the function is |
| 281 |
% mandatory, but the command can forgo needing a function if a star is placed. |
| 282 |
% |
| 283 |
% \subsubsection*{Notation Style} |
| 284 |
% |
| 285 |
% \DescribeMacro{\LagrODE} |
| 286 |
% \DescribeMacro{\LeibODE} |
| 287 |
% \DescribeMacro{\NewtODE} |
| 288 |
% \DescribeMacro{\LagrPDE} |
| 289 |
% \DescribeMacro{\LeibPDE} |
| 290 |
% \DescribeMacro{\NewtPDE} |
| 291 |
% There are 3 distinct notational styles |
| 292 |
% one can choose between. This choice can be made as a package option |
| 293 |
% in the preamble, in the text with \cs{setDE}\marg{options}, or if |
| 294 |
% one only needs to use a notation style once, through its respective |
| 295 |
% macro. |
| 296 |
% |
| 297 |
% In essense, all the \cs{ode} or \cs{pde} commands do are call the |
| 298 |
% respective notational varient aligned with the currently set option. |
| 299 |
% This makes it simple enough to just use one of the notational varients, |
| 300 |
% should one wish to do so: |
| 301 |
% \begin{equation*} |\LagrODE[x] c = \LeibODE[x] c = \NewtODE[x] c |\quad |
| 302 |
% \Rightarrow\quad \LagrODE[x] c = \LeibODE[x] c = \NewtODE[x] c |
| 303 |
% \end{equation*} |
| 304 |
% This also means that all these functions are identical in what arguments |
| 305 |
% they take. |
| 306 |
% |
| 307 |
% |
| 308 |
% \subsubsection*{Variable and Function Arguments} |
| 309 |
% \DescribeMacro{\ode} |
| 310 |
% \DescribeMacro{\ode*} |
| 311 |
% The most barebone form can be understood as:\par\noindent |
| 312 |
% \hbox to \textwidth{\hss\vbox{ |
| 313 |
% \hbox{\cs{ode}\oarg{variable}\marg{ function}} |
| 314 |
% \hbox{\cs{ode*}\oarg{variable}}}\hss} |
| 315 |
% |
| 316 |
% \DescribeMacro{\pde} |
| 317 |
% \DescribeMacro{\pde*} |
| 318 |
% and for the sake of parity, the PDE usage is identical:\par\noindent |
| 319 |
% \hbox to \textwidth{\hss\vbox{ |
| 320 |
% \hbox{\cs{pde}\oarg{variable}\marg{ function}} |
| 321 |
% \hbox{\cs{pde*}\oarg{variable}}}\hss}\par |
| 322 |
% Any value you give to the \emph{optional} \oarg{variable} argument |
| 323 |
% will be represented as the variable being derived. |
| 324 |
% While the \emph{mandatory} \marg{function} argument will be the function you |
| 325 |
% are deriving. |
| 326 |
% Say you wish to indicate you are deriving $X(t)$, simple as writing |
| 327 |
% |\ode[t]{X}|, however, its worth noting that $t$ is the default variable |
| 328 |
% so writing |\ode{X}| will produce identical results. |
| 329 |
% Hence |\ode[t]{X} = \ode{X}| will produce; |
| 330 |
% \begin{equation*} |\ode[t]{X} =\ode{X}| \implies \ode[t]{X} = \ode{X} |
| 331 |
% \end{equation*} |
| 332 |
% |
| 333 |
% |
| 334 |
% While the \marg{function} argument is mandatory using the |
| 335 |
% non-starred command, using the starred varient |
| 336 |
% omits the need for the \marg{function} argument. |
| 337 |
% Therefor, writing the exact same equation, just starred |
| 338 |
% |\ode*[t]{X} = \ode*{X}| will instead produce; |
| 339 |
% \begin{equation*} |\ode*[t]{X} =\ode*{X}| \implies \ode*[t]{X} = \ode*{X} |
| 340 |
% \end{equation*} |
| 341 |
% Effectively one can rewrite the `bare-bones' display as:\par\vspace{1ex} |
| 342 |
% \par\hbox to \textwidth{\hss |
| 343 |
% \cs{ode}\meta{star}\oarg{variable}\marg{ function} |
| 344 |
% \hss} |
| 345 |
% |
| 346 |
% \subsubsection*{Degree of Derivative} |
| 347 |
% The previously shown stated section is something the reader has |
| 348 |
% likely encountered before, made themselves. This is where |
| 349 |
% this package begins to differentiate\footnote{Calculus Pun!} itself. |
| 350 |
% Consider: |
| 351 |
% \par\hbox to \textwidth{\hss |
| 352 |
% \cs{ode}\meta{star}\oarg{variable}$\uparrow$\meta{degree}\marg{function} |
| 353 |
% \hss} |
| 354 |
% |
| 355 |
% A feature of this family of commands, is that it can `\emph{easily}' |
| 356 |
% recognize a following exponent should one be placed. |
| 357 |
% There was rational in choosing to check for the exponent immediately |
| 358 |
% after the macro command opposed to checking for the exponent at |
| 359 |
% the end after the function. |
| 360 |
% As, often you would want add a higher degree very |
| 361 |
% quickly as opposed to \emph{after} defining the function. |
| 362 |
% |
| 363 |
% \hbox to \textwidth{\hss |
| 364 |
% \cs{ode}|^2{f(x)}| as opposed to \cs{ode\{f(x)\}}|^2| \hss} |
| 365 |
% |
| 366 |
% |
| 367 |
% This was one of the main motivations of creating a package to begin with |
| 368 |
% as instead of needing, maybe, two personalized commands, |
| 369 |
% such as ``|\ddt{f}| and |\ddxx{f}|'', or ``|\dd{x}{f}| and |\dd[2]{x}{f}|''. |
| 370 |
% One simply needs to treat the \cs{ode} macro itself as being raised |
| 371 |
% to a higher degree. |
| 372 |
% \begin{equation*} |\ode* \left(\ode{f} \right)=\ode^2{f} | |
| 373 |
% \Rightarrow \ode* \left(\ode{f} \right)=\ode^2{f} |
| 374 |
% \end{equation*} |
| 375 |
% |
| 376 |
% |
| 377 |
% \subsubsection*{Defining Where the Derivative is} |
| 378 |
% |
| 379 |
% Imagine you, as the reader, are trying to quickly and easily |
| 380 |
% write up the boundry conditions of your problem. |
| 381 |
% One could always make another macro, in what is no doubt an impressive |
| 382 |
% display of differential shortcuts. |
| 383 |
% \emph{Or}: \vspace{1ex} |
| 384 |
% \par\hbox to \textwidth{\hss |
| 385 |
% \cs{ode}\meta{star}\oarg{variable}$\uparrow$\meta{degree}\marg{ |
| 386 |
% function}\textvisiblespace{}at\textvisiblespace{}\meta{postion}; |
| 387 |
% \hss} |
| 388 |
% |
| 389 |
% See, \TeX\ does something very interesting when it uses `\emph{glue}', |
| 390 |
% which is partially replicated by packages such as |TikZ|, where it will |
| 391 |
% happily take `soft' modifiers written directly in plain english. |
| 392 |
% If one wishes to strictly define paragraph spacing in \TeX, they would use |
| 393 |
% `\cs{parskip}|=1ex|'. If one would rather give it a range of tolerance |
| 394 |
% the following construct `\cs{parskip}|=1ex plus 0.5ex minus 0.5ex|' |
| 395 |
% then allows a spacing of $1\pm 0.5$ |ex|. |
| 396 |
% |
| 397 |
% Glue is of course something special, but that does not mean |
| 398 |
% that the author can not gain inspiration. Say one wishes |
| 399 |
% to define Neumann boundries; |
| 400 |
% \begin{equation*} |\ode[x]{c} at 0;=0\land\ode[x]{c} at L;=1| |
| 401 |
% \Rightarrow \ode[x]{c} at 0;=0\land\ode[x]{c} at L;=1 |
| 402 |
% \end{equation*} |
| 403 |
% \begin{equation*} |\ode[x]{c} at 0 = L;=1| |
| 404 |
% \Rightarrow \ode[x]{c} at 0 = L;=1 |
| 405 |
% \end{equation*} |
| 406 |
% Literally could not be easier.\footnote{My source is that I made it up} |
| 407 |
% |
| 408 |
% |
| 409 |
% Those reading til this point may have recalled that the first example |
| 410 |
% did not contain many braces. |
| 411 |
% This is because with the ``proper'' spacing, there is little |
| 412 |
% need for the use of the braces, so as to help promote a more fluid, |
| 413 |
% (and readable), |
| 414 |
% workflow without always needing to worry about the f|***|ing brace. |
| 415 |
% Not that one can not use the brace for personal taste. |
| 416 |
% In the following section, many examples of use will be illustrated |
| 417 |
% to show the range and versitility of the functions. |
| 418 |
% |
| 419 |
% \noindent |
| 420 |
% \fbox{\parbox{\textwidth}{The most important thing to always remember. |
| 421 |
% \emph{Just because} the author |
| 422 |
% of this package has done as much as they can to `\emph{\rlap{idiot}\hbox{------} |
| 423 |
% user proof}' its functions |
| 424 |
% does not mean the user does not still need to be cautious. This is |
| 425 |
% \LaTeX\ we are talking about. There are likely many |
| 426 |
% scenarios that the author did not think of, nor accidentally came across.}} |
| 427 |
% |
| 428 |
% \newpage |
| 429 |
% \section{Examples of use}\label{sec:examples} |
| 430 |
% |
| 431 |
% \stepcounter{subsection} |
| 432 |
% |
| 433 |
% \addcontentsline{toc}{subsection}{\thesubsection\quad Common Use Examples} |
| 434 |
% |
| 435 |
% To show the generality of use. The following examples all take identical form |
| 436 |
% in the \TeX/\LaTeX\ itself. |
| 437 |
% Additionally, in order to illustrate the functional boundries of the command with |
| 438 |
% respect to each of the notational styles. |
| 439 |
% There is a variety of spacing and bracketing to help highlight these features, |
| 440 |
% and will be shown in the following |verbatim| enviroment; |
| 441 |
% |
| 442 |
% |
| 443 |
% \begin{minipage}{0.98\textwidth} |
| 444 |
% \begin{verbatim} |
| 445 |
%\begin{align*} |
| 446 |
%\ode A(x) && \ode[x]{B(x)} && \ode^1 C(x) && \ode[x]^5 {D(x)} \\ |
| 447 |
%\ode* {E(x)} && \ode*[x] F(x) && \ode*^2 {G(x)} && \ode*[x]^6H(x) \\ |
| 448 |
%\pde[t] I(x) && \pde[x] {J(x)}&& \pde[t]^3K(x) && \pde[x]^7 {L(x)} \\ |
| 449 |
%\pde*[t] {M(x)}&& \pde*[x]N(x) && \pde*[t]^4 O(x) && \pde*[x]^8 P(x) |
| 450 |
%\end{align*} |
| 451 |
% \end{verbatim} |
| 452 |
% \end{minipage} |
| 453 |
% |
| 454 |
% \vbox{\centering |
| 455 |
% \hbox{\verb|\setDE{notation=Lagrange}| \emph{and/or} \verb|\usepackage[notation=Lagrange]{odesandpdes}|} |
| 456 |
% \fbox{\parbox{0.65\textwidth}{ |
| 457 |
% \setDE{notation=Lagrange} |
| 458 |
% \begin{align*} |
| 459 |
% \ode A(x) && \ode[x]{B(x)} && \ode^1 C(x) && \ode[x]^5 {D(x)} \\ |
| 460 |
% \ode* {E(x)} && \ode*[x] F(x) && \ode*^2 {G(x)} && \ode*[x]^6H(x) \\ |
| 461 |
% \pde[t] I(x) && \pde[x] {J(x)}&& \pde[t]^3K(x) && \pde[x]^7 {L(x)} \\ |
| 462 |
% \pde*[t] {M(x)}&& \pde*[x]N(x) && \pde*[t]^4 O(x) && \pde*[x]^8 P(x) |
| 463 |
% \end{align*} |
| 464 |
% }}}\vspace{1.25em} |
| 465 |
% |
| 466 |
% \vbox{\centering |
| 467 |
% \hbox{\verb|\setDE{notation=Leibniz}| \emph{and/or} \verb|\usepackage[notation=Leibniz]{odesandpdes}|} |
| 468 |
% \fbox{\parbox{0.65\textwidth}{ |
| 469 |
% \setDE{notation=Leibniz} |
| 470 |
% \begin{align*} |
| 471 |
% \ode A(x) && \ode[x]{B(x)} && \ode^1 C(x) && \ode[x]^5 {D(x)} \\ |
| 472 |
% \ode* {E(x)} && \ode*[x] F(x) && \ode*^2 {G(x)} && \ode*[x]^6H(x) \\ |
| 473 |
% \pde[t] I(x) && \pde[x] {J(x)}&& \pde[t]^3K(x) && \pde[x]^7 {L(x)} \\ |
| 474 |
% \pde*[t] {M(x)}&& \pde*[x]N(x) && \pde*[t]^4 O(x) && \pde*[x]^8 P(x) |
| 475 |
% \end{align*} |
| 476 |
% }}}\vspace{1.25em} |
| 477 |
% |
| 478 |
% \vbox{\centering |
| 479 |
% \hbox{\verb|\setDE{notation=Newton}| \emph{and/or} \verb|\usepackage[notation=Newton]{odesandpdes}|} |
| 480 |
% \fbox{\parbox{0.65\textwidth}{ |
| 481 |
% \setDE{notation=Newton} |
| 482 |
% \begin{align*} |
| 483 |
% \ode A(x) && \ode[x]{B(x)} && \ode^1 C(x) && \ode[x]^5 {D(x)} \\ |
| 484 |
% \ode* {E(x)} && \ode*[x] F(x) && \ode*^2 {G(x)} && \ode*[x]^6H(x) \\ |
| 485 |
% \pde[t] I(x) && \pde[x] {J(x)}&& \pde[t]^3K(x) && \pde[x]^7 {L(x)} \\ |
| 486 |
% \pde*[t] {M(x)}&& \pde*[x]N(x) && \pde*[t]^4 O(x) && \pde*[x]^8 P(x) |
| 487 |
% \end{align*} |
| 488 |
% }}} |
| 489 |
% |
| 490 |
% \vbox{\centering |
| 491 |
% \hbox{\verb|\setDE{maxprimes=7}| \emph{and/or} \verb|\usepackage[maxprimes=7]{odesandpdes}|} |
| 492 |
% \fbox{\parbox{0.65\textwidth}{ |
| 493 |
% \setDE{notation=Lagrange,maxprimes=7} |
| 494 |
% \begin{align*} |
| 495 |
% \ode^1 f &&\ode^2 f &&\ode^3 f &&\ode^4 f && |
| 496 |
% \ode^5 f &&\ode^6 f &&\ode^7 f &&\ode^8 f &&\ode^9 f |
| 497 |
% \end{align*} |
| 498 |
% \setDE{notation=Newton} |
| 499 |
% \vspace{-1.5em} |
| 500 |
% \begin{align*} |
| 501 |
% \ode^1 f &&\ode^2 f &&\ode^3 f &&\ode^4 f && |
| 502 |
% \ode^5 f &&\ode^6 f &&\ode^7 f &&\ode^8 f &&\ode^9 f |
| 503 |
% \end{align*} |
| 504 |
% }}} |
| 505 |
% |
| 506 |
% |
| 507 |
% |
| 508 |
% \subsection{"at x;" Usage Examples} |
| 509 |
% |
| 510 |
% |
| 511 |
% |
| 512 |
% \hspace{1em} Now, because the author is not an insane person, and went through the |
| 513 |
% effort of learning how TEX deconstructs text into constitute |
| 514 |
% registries and boxes, the way any sane person might. When using |
| 515 |
% a non-starred version of a command, after the function is defined, you can |
| 516 |
% place an `|at|\textvisiblespace\meta{point}|;|', and the representation will |
| 517 |
% shown according to notational convention. |
| 518 |
% |
| 519 |
% |
| 520 |
% \vbox{ |
| 521 |
% \begin{center} |
| 522 |
% \begin{minipage}[c]{0.45\textwidth} |
| 523 |
% \begin{verbatim} |
| 524 |
%\begin{align*} |
| 525 |
% \ode[x] c at 23\pi; &= 1 \\ |
| 526 |
% \ode[x]^3 c at 69; &= 2 \\ |
| 527 |
% \ode[x]^{69} c at L;+t &= 3 \\ |
| 528 |
% \ode[x]^9 c af 420; &= 4 \\ |
| 529 |
% \ode[x]^6 c a t 13; &= 5 |
| 530 |
%\end{align*} |
| 531 |
% \end{verbatim} |
| 532 |
% \end{minipage} |
| 533 |
% \end{center} |
| 534 |
% \noindent |
| 535 |
% \hbox{\begin{minipage}[t]{0.35\textwidth} |
| 536 |
% \setDE{notation=Lagrange} |
| 537 |
% \noindent\setlength{\jot}{2em} |
| 538 |
% \begin{verbatim} |
| 539 |
%\setDE{notation=Lagrange} |
| 540 |
% \end{verbatim} |
| 541 |
% \vspace{-1em} |
| 542 |
%\begin{align*} |
| 543 |
% \ode[x] c at 23\pi; &= 1 \\ |
| 544 |
% \ode[x]^3 c at 69; &= 2 \\ |
| 545 |
% \ode[x]^{69} c at L;+t &= 3 \\ |
| 546 |
% \ode[x]^9 c af 420; &= 4 \\ |
| 547 |
% \ode[x]^6 c a t 13; &= 5 |
| 548 |
%\end{align*} |
| 549 |
% \end{minipage}}\vline~ |
| 550 |
% \hbox{\begin{minipage}[t]{0.34\textwidth} |
| 551 |
% \setDE{notation=Leibniz} |
| 552 |
% \noindent\setlength{\jot}{0.70em} |
| 553 |
% \begin{verbatim} |
| 554 |
%\setDE{notation=Leibniz} |
| 555 |
% \end{verbatim} |
| 556 |
% \vspace{-1em} |
| 557 |
%\begin{align*} |
| 558 |
% \ode[x] c at 23\pi; &= 1 \\ |
| 559 |
% \ode[x]^3 c at 69; &= 2 \\ |
| 560 |
% \ode[x]^{69} c at L;+t &= 3 \\ |
| 561 |
% \ode[x]^9 c af 420; &= 4 \\ |
| 562 |
% \ode[x]^6 c a t 13; &= 5 |
| 563 |
%\end{align*} |
| 564 |
% \vphantom{l} |
| 565 |
% \end{minipage}}\vline~ |
| 566 |
% \hbox{\begin{minipage}[t]{0.32\textwidth} |
| 567 |
% \setDE{notation=Newton} |
| 568 |
% \noindent\setlength{\jot}{1.75em} |
| 569 |
% \begin{verbatim} |
| 570 |
%\setDE{notation=Newton} |
| 571 |
% \end{verbatim} |
| 572 |
% \vspace{-1em} |
| 573 |
%\begin{align*} |
| 574 |
% \ode[x] c at 23\pi; &= 1 \\ |
| 575 |
% \ode[x]^3 c at 69; &= 2 \\ |
| 576 |
% \ode[x]^{69} c at L;+t &= 3 \\ |
| 577 |
% \ode[x]^9 c af 420; &= 4 \\ |
| 578 |
% \ode[x]^6 c a t 13; &= 5 |
| 579 |
%\end{align*} |
| 580 |
% \end{minipage}}} |
| 581 |
% |
| 582 |
% \hspace{1em} As can be seen in the examples, this `\emph{modifier}' is robust |
| 583 |
% enough that one can write effectively any combination of characters |
| 584 |
% after the function, excluding, \emph{verbatim}, `|at|\textvisiblespace' |
| 585 |
% and it will work as intended. |
| 586 |
% |
| 587 |
% \vbox{ |
| 588 |
% \hspace{1em} \emph{Important to note}, due to a slight difference in how the |
| 589 |
% notational styles are defined, |
| 590 |
% only the Leibniz notation can take arguments for the |
| 591 |
% function that involve subscripts and superscripts without delimiters. |
| 592 |
% Mostly easily illustrated in this following |
| 593 |
% example using the \cs{pde} command; |
| 594 |
% \begin{center} |
| 595 |
% \begin{minipage}[c]{0.45\textwidth} |
| 596 |
% \begin{verbatim} |
| 597 |
%\begin{align*} |
| 598 |
% \pde[y] f_1 &= 1 \\ |
| 599 |
% \pde[y] f_1 at L; &= 2 \\ |
| 600 |
% \pde[y] f at L; &= 3 \\ |
| 601 |
% \pde[y] {(f_1)} &= 4 \\ |
| 602 |
% \pde[y] {(f_1)} at L; &= 5 |
| 603 |
%\end{align*} |
| 604 |
% \end{verbatim} |
| 605 |
% \end{minipage} |
| 606 |
% \end{center} |
| 607 |
% \noindent |
| 608 |
% \hbox{\begin{minipage}[t]{0.35\textwidth} |
| 609 |
% \setDE{notation=Lagrange} |
| 610 |
% \noindent\setlength{\jot}{2.20em} |
| 611 |
% \begin{verbatim} |
| 612 |
%\setDE{notation=Lagrange} |
| 613 |
% \end{verbatim} |
| 614 |
% \vspace{-1em} |
| 615 |
%\begin{align*} |
| 616 |
% \pde[y] f_1 &= 1 \\ |
| 617 |
% \pde[y] f_1 at L; &= 2 \\ |
| 618 |
% \pde[y] f at L; &= 3 \\ |
| 619 |
% \pde[y] {(f_1)} &= 4 \\ |
| 620 |
% \pde[y] {(f_1)} at L; &= 5 |
| 621 |
%\end{align*} |
| 622 |
% \end{minipage}}\vline~ |
| 623 |
% \hbox{\begin{minipage}[t]{0.34\textwidth} |
| 624 |
% \setDE{notation=Leibniz} |
| 625 |
% \noindent\setlength{\jot}{0.70em} |
| 626 |
% \begin{verbatim} |
| 627 |
%\setDE{notation=Leibniz} |
| 628 |
% \end{verbatim} |
| 629 |
% \vspace{-1em} |
| 630 |
%\begin{align*} |
| 631 |
% \pde[y] f_1 &= 1 \\ |
| 632 |
% \pde[y] f_1 at L; &= 2 \\ |
| 633 |
% \pde[y] f at L; &= 3 \\ |
| 634 |
% \pde[y] {(f_1)} &= 4 \\ |
| 635 |
% \pde[y] {(f_1)} at L; &= 5 |
| 636 |
%\end{align*} |
| 637 |
% \vphantom{l} |
| 638 |
% \end{minipage}}\vline~ |
| 639 |
% \hbox{\begin{minipage}[t]{0.32\textwidth} |
| 640 |
% \setDE{notation=Newton} |
| 641 |
% \noindent\setlength{\jot}{2.20em} |
| 642 |
% \begin{verbatim} |
| 643 |
%\setDE{notation=Newton} |
| 644 |
% \end{verbatim} |
| 645 |
% \vspace{-1em} |
| 646 |
%\begin{align*} |
| 647 |
% \pde[y] f_1 &= 1 \\ |
| 648 |
% \pde[y] f_1 at L; &= 2 \\ |
| 649 |
% \pde[y] f at L; &= 3 \\ |
| 650 |
% \pde[y] {(f_1)} &= 4 \\ |
| 651 |
% \pde[y] {(f_1)} at L; &= 5 |
| 652 |
%\end{align*} |
| 653 |
% \end{minipage}} |
| 654 |
% } |
| 655 |
% |
| 656 |
% \subsection{Prime Count Limits} |
| 657 |
% \hspace{1em} Because the Newton and Lagrange notation is procedural; |
| 658 |
% the only limit is your imagination, and also the fact that |
| 659 |
% \TeX\ can only have something like 127 unplaced tokens at a time.\par |
| 660 |
% \hbox to \textwidth{\hss\cs{setDE\{maxprimes=69\}}\hss} |
| 661 |
% \fbox{\parbox{\textwidth}{ |
| 662 |
% \setDE{maxprimes=69} |
| 663 |
% \begin{minipage}{0.45\textwidth} |
| 664 |
% \setDE{notation=Lagrange} |
| 665 |
% \begin{equation*} |
| 666 |
% \begin{split} |
| 667 |
% \ode^{5} f \\ |
| 668 |
% \ode^{16} f \\ |
| 669 |
% \ode^{32} f \\ |
| 670 |
% \ode^{54} f \\ |
| 671 |
% \ode^{69} f \\ |
| 672 |
% \ode^{70} f \\ |
| 673 |
% \end{split} |
| 674 |
% \end{equation*} |
| 675 |
% \end{minipage}~ |
| 676 |
% \begin{minipage}{0.05\textwidth} |
| 677 |
% \setDE{notation=Lagrange} |
| 678 |
% \begin{equation*} |
| 679 |
% \begin{split} |
| 680 |
% \boxed{5} \\ |
| 681 |
% \boxed{16} \\ |
| 682 |
% \boxed{32} \\ |
| 683 |
% \boxed{54} \\ |
| 684 |
% \boxed{69} \\ |
| 685 |
% \boxed{70} \\ |
| 686 |
% \end{split} |
| 687 |
% \end{equation*} |
| 688 |
% \end{minipage}~ |
| 689 |
% \begin{minipage}{0.35\textwidth} |
| 690 |
% \setDE{notation=Newton} |
| 691 |
% \begin{equation*} |
| 692 |
% \ode^{5} f \quad |
| 693 |
% \ode^{16} f \quad |
| 694 |
% \ode^{32} f \quad |
| 695 |
% \ode^{54} f \quad |
| 696 |
% \ode^{69} f \quad |
| 697 |
% \ode^{70} f \quad |
| 698 |
% \end{equation*} |
| 699 |
% \begin{equation*} |
| 700 |
% \mkern-15mu\boxed{5} |
| 701 |
% \boxed{16} |
| 702 |
% \boxed{32} |
| 703 |
% \boxed{54} |
| 704 |
% \boxed{69} |
| 705 |
% \boxed{70} |
| 706 |
% \end{equation*} |
| 707 |
% \end{minipage}}} |
| 708 |
% |
| 709 |
% |
| 710 |
% ^^A Truly beautiful.\par\vspace{1em} |
| 711 |
% |
| 712 |
% ^^A In the next semester I expect to try seeing if its possible to, given that you put multiple variable in the options, to procedurally generate partials that address separate variables sequatentially. |
| 713 |
% ^^A \begin{equation*} |
| 714 |
% ^^A \frac{\partial^2}{\partial x \partial y} |
| 715 |
% ^^A \end{equation*} |
| 716 |
% |
| 717 |
% |
| 718 |
% |
| 719 |
%\StopEventually{^^A |
| 720 |
% \PrintChanges |
| 721 |
% } |
| 722 |
% |
| 723 |
% |
| 724 |
% \iffalse |
| 725 |
%</documentation> |
| 726 |
% \fi |
| 727 |
% |
| 728 |
% ^^A************************************************ [odesandpdes.sty] |
| 729 |
% \newpage |
| 730 |
% \iffalse |
| 731 |
%<*package> |
| 732 |
% \fi |
| 733 |
% \section{Package Implementation} |
| 734 |
% |
| 735 |
% As a fair warning for anyone interested in the implementation |
| 736 |
% of this package, it is documented in what might be considered, \emph{absurd} |
| 737 |
% levels of detail. This comes from the creation of this package being a great |
| 738 |
% learning experience for the author, and the in-depth documentation of |
| 739 |
% that understanding is only beneficial. |
| 740 |
% Futhermore, a lot of the techniques used in this package are not obvious. |
| 741 |
% Some of which, to paraphrase |
| 742 |
% the creator of \TeX, his divine emmisary |
| 743 |
% \emph{Donald E. Knuth} himself in the ever holy \TeX book, |
| 744 |
% were prefaced with |
| 745 |
% ``\emph{Worthy of being known to, at least a few, wizards able to traverse |
| 746 |
% the nether world of \TeX arcana}''. |
| 747 |
% |
| 748 |
% |
| 749 |
% |
| 750 |
% |
| 751 |
% \subsection{Set-up} |
| 752 |
% \iffalse |
| 753 |
%<package>%% ---------------------------------------------------------------- |
| 754 |
%<package>%% Package initialize |
| 755 |
%<package>%% ---------------------------------------------------------------- |
| 756 |
% \fi |
| 757 |
% |
| 758 |
% |
| 759 |
% Package options are difficult to deal with, so using the |xkeyval| package |
| 760 |
% alleviates much of the \emph{pain} associated with it, |
| 761 |
% \begin{macrocode} |
| 762 |
\RequirePackage{xkeyval} |
| 763 |
% \end{macrocode} |
| 764 |
% |
| 765 |
% \begin{macro}{\m@xm@rk}\begin{macro}{\exp@c@unt}\begin{macro}{\@detempv@l} |
| 766 |
% \hspace{1em} Being that there are a lot of minor calculations within the package |
| 767 |
% reserving registries for integer counts feels like a good idea |
| 768 |
% \begin{macrocode} |
| 769 |
\newcount\m@xm@rk% |
| 770 |
\newcount\exp@c@unt% |
| 771 |
\countdef\@detempv@l=255% |
| 772 |
% \end{macrocode} |
| 773 |
% \end{macro}\end{macro}\end{macro} |
| 774 |
% |
| 775 |
% \begin{macro}{\v@rr@t@ks}\begin{macro}{\func@t@ks}\begin{macro}{\@tpost@ks} |
| 776 |
% As well reserving token registries for tossing arguments around |
| 777 |
% the groups and macros, |
| 778 |
% \begin{macrocode} |
| 779 |
\newtoks\v@rr@t@ks% |
| 780 |
\newtoks\func@t@ks% |
| 781 |
\newtoks\@tpost@ks% |
| 782 |
% \end{macrocode} |
| 783 |
% \end{macro}\end{macro}\end{macro} |
| 784 |
% |
| 785 |
% \begin{macro}{\@dev@rb@x}\begin{macro}{\@defunb@x}\begin{macro}{\@deresb@x} |
| 786 |
% Reserving box registries for the purpose of collecting the components |
| 787 |
% together in \newline a coherent manner, |
| 788 |
% \begin{macrocode} |
| 789 |
\newbox\@dev@rb@x% |
| 790 |
\newbox\@defunb@x% |
| 791 |
\newbox\@deresb@x% |
| 792 |
% \end{macrocode} |
| 793 |
% \end{macro}\end{macro}\end{macro} |
| 794 |
% |
| 795 |
% |
| 796 |
% \subsubsection{Package Options} |
| 797 |
% \iffalse |
| 798 |
%<package>%% ---------------------------------------------------------------- |
| 799 |
%<package>%% Package Options |
| 800 |
%<package>%% ---------------------------------------------------------------- |
| 801 |
% \fi |
| 802 |
% |
| 803 |
% |
| 804 |
% \begin{macro}{\@de@option} |
| 805 |
% \hspace{1em} Defining the package options for notational styles |
| 806 |
% using the \LaTeX\ \cs{providecommand} to reloading times. |
| 807 |
% Important to note that defining the command is not the same |
| 808 |
% as using the command, which is useful in conjunction with \cs{csname} |
| 809 |
% and \cs{endcsname} for macro defintions. |
| 810 |
% \begin{macrocode} |
| 811 |
\providecommand\@de@option{Leib} |
| 812 |
% \end{macrocode} |
| 813 |
% |
| 814 |
% Now using the |keyval| package, it becomes possible to define |
| 815 |
% a family of package options associated with inputing some |notation=#1|. |
| 816 |
% This allows for easily defining the notation for the entire document. |
| 817 |
% The possible options will be defined afterwards, |
| 818 |
% \begin{macrocode} |
| 819 |
\DeclareOptionX{notation}[default]% |
| 820 |
{\def\@de@option{\csname @de@not@#1\endcsname}} |
| 821 |
% \end{macrocode} |
| 822 |
% \end{macro} |
| 823 |
% |
| 824 |
% \begin{macro}{\@de@not@Lagrange} |
| 825 |
% \begin{macro}{\@de@not@Leibniz} |
| 826 |
% \begin{macro}{\@de@not@Newton} |
| 827 |
% |
| 828 |
% \hspace{1em} Once the package option has been declared, |
| 829 |
% now the options can be defined. The options take identical form |
| 830 |
% with the exception of the last part of definition. |
| 831 |
% This is because the \cs{@de@option} is not the macro used for |
| 832 |
% the notation definitions. Rather, \cs{@de@option} is an intermediate |
| 833 |
% that expands into one of the defined options, which subsequently |
| 834 |
% expands into one of the four character strings, |
| 835 |
% ``|Lagr|'', ``|Leib|'', or ``|Newt|'' |
| 836 |
% \begin{center}\vspace{-0.75em} |
| 837 |
% \makeatletter |
| 838 |
% \tikz[every node/.style={minimum size=1.5em},line width=0.9pt] |
| 839 |
% \graph[no placement,y=0] |
| 840 |
% {\string\@de@option[x=0] ->[bend right,"expands to"'] |
| 841 |
% \string\@de@not@``option''[x=3.5] ->[bend left,"expands to"] |
| 842 |
% ``string''[x=6.5]}; |
| 843 |
% \makeatother |
| 844 |
% \end{center} |
| 845 |
% |
| 846 |
% \begin{macrocode} |
| 847 |
\def\@de@not@Lagrange{Lagr} |
| 848 |
\def\@de@not@Leibniz{Leib} |
| 849 |
\def\@de@not@Newton{Newt} |
| 850 |
% \end{macrocode} |
| 851 |
% \begin{macro}{\@de@not@default} |
| 852 |
% \hspace{1em} The default option for the notation is defined by |
| 853 |
% pointing to the definition of the |Leibniz| notation option, |
| 854 |
% \begin{macrocode} |
| 855 |
\let\@de@not@default\@de@not@Leibniz |
| 856 |
% \end{macrocode} |
| 857 |
% \end{macro} |
| 858 |
% \end{macro} |
| 859 |
% \end{macro} |
| 860 |
% \end{macro} |
| 861 |
% |
| 862 |
% |
| 863 |
% |
| 864 |
% A second option is defined to allow freedom in deciding the cut-off point |
| 865 |
% for the Lagrange and Newton notations where it no longer makes more |
| 866 |
% physical marks and uses the symbolic extension instead, with a default |
| 867 |
% of 3 marks before becoming symbolic. |
| 868 |
% \begin{macrocode} |
| 869 |
\DeclareOptionX{maxprimes}[3]{\m@xm@rk=#1\advance\m@xm@rk\@ne} |
| 870 |
% \end{macrocode} |
| 871 |
% |
| 872 |
% |
| 873 |
% To ensure that all other options given to the package will be ignored |
| 874 |
% the star is used to indicate that all undefined options will be directed |
| 875 |
% towrds this declared option, |
| 876 |
% \begin{macrocode} |
| 877 |
\DeclareOptionX*{\PackageWarning{odesandpdes}{`\CurrentOption' ignored}} |
| 878 |
% \end{macrocode} |
| 879 |
% Finally the declared options are executed as to allow the default |
| 880 |
% options to initialize and be processed, |
| 881 |
% \begin{macrocode} |
| 882 |
\ExecuteOptionsX{notation,maxprimes} |
| 883 |
\ProcessOptionsX\relax |
| 884 |
% \end{macrocode} |
| 885 |
% |
| 886 |
% \subsection{Package Configuration}\label{sec:options} |
| 887 |
% |
| 888 |
% |
| 889 |
%\iffalse |
| 890 |
%<package>\define@key[package]{@de}{notation} |
| 891 |
%<package> {\def\@de@option{\csname @de@not@#1\endcsname}} |
| 892 |
%<package>\define@key[package]{@de}{maxprimes} |
| 893 |
%<package> {\m@xm@rk=#1\advance\m@xm@rk\@ne} |
| 894 |
%\fi |
| 895 |
% |
| 896 |
% \begin{macro}{\setDE} |
| 897 |
% \hspace{1em} In addition to being able to use options directly in the |
| 898 |
% \cs{usepackage} package command, one also gets access to the command |
| 899 |
% \cs{setDE}. |
| 900 |
% Which can be used at any point in the document to change the style |
| 901 |
% of notation or max prime count. Functionally done in identical manner |
| 902 |
% to how \cs{DeclareOptionX} is used. |
| 903 |
% |
| 904 |
% \begin{macrocode} |
| 905 |
\newcommand\setDE[1]{\setkeys[package]{@de}{#1}} |
| 906 |
% \end{macrocode} |
| 907 |
% \end{macro} |
| 908 |
% |
| 909 |
% \subsubsection{To not conflict with amsmath} |
| 910 |
% |
| 911 |
% \begin{macro}{\@de@ver} |
| 912 |
% \begin{macro}{\@de@top} |
| 913 |
% \begin{macro}{\@de@bove} |
| 914 |
% |
| 915 |
% \hspace{1em} Purely because amsmath is a bitch and doesn't want |
| 916 |
% anyone enjoying their time in \TeX\ it becomes required to make |
| 917 |
% compatibility checks and work within their abstracted definitions, |
| 918 |
% \begin{macrocode} |
| 919 |
\@ifpackageloaded{amsmath}{ |
| 920 |
\let\@de@ver=\@@over% |
| 921 |
\let\@de@top=\@@atop% |
| 922 |
\let\@de@bove=\@@above}% |
| 923 |
% \end{macrocode} |
| 924 |
% Otherwise it just uses the \TeX\ primitive commands for fractions |
| 925 |
% because of increase ease of function and speed of processing, |
| 926 |
% \begin{macrocode} |
| 927 |
{\let\@de@ver=\over% |
| 928 |
\let\@de@top=\atop% |
| 929 |
\let\@de@bove=\above} |
| 930 |
% \end{macrocode} |
| 931 |
% \end{macro} |
| 932 |
% \end{macro} |
| 933 |
% \end{macro} |
| 934 |
% |
| 935 |
% |
| 936 |
% \subsection{Foundational macros} |
| 937 |
% \iffalse |
| 938 |
%<package>%% ---------------------------------------------------------------- |
| 939 |
%<package>%% Package Macros |
| 940 |
%<package>%% ---------------------------------------------------------------- |
| 941 |
% \fi |
| 942 |
% |
| 943 |
% \begin{macro}{\d@@}\begin{macro}{\d@l} |
| 944 |
% \hspace{1em} Creating protected macro definitions for increase in |
| 945 |
% speed of processes, |
| 946 |
% \begin{macrocode} |
| 947 |
\def\d@@{\mathrm d} |
| 948 |
\let\d@l=\partial |
| 949 |
% \end{macrocode} |
| 950 |
% \begin{macro}{\@dest@red}\begin{macro}{\@den@st@r} |
| 951 |
% \hspace{1em} In the same vein, strings are defined for the starred and |
| 952 |
% unstarred versions of macro commands, |
| 953 |
% \begin{macrocode} |
| 954 |
\def\@dest@red{st@r@d} |
| 955 |
\def\@den@st@r{n@st@r} |
| 956 |
% \end{macrocode} |
| 957 |
% \end{macro}\end{macro} |
| 958 |
% \end{macro}\end{macro} |
| 959 |
% |
| 960 |
% |
| 961 |
% \begin{macro}{\ode}\begin{macro}{\pde} |
| 962 |
% \hspace{1em} The macro definitions of the ODE and PDE commands |
| 963 |
% \begin{macrocode} |
| 964 |
\def\ode{\csname \@de@option ODE\endcsname} |
| 965 |
\def\pde{\csname \@de@option PDE\endcsname} |
| 966 |
% \end{macrocode} |
| 967 |
% In essence these two are the same command. |
| 968 |
% This is done for the sake of consistancy in use and effect. |
| 969 |
% As well, in an attempt to not make the alternative notations |
| 970 |
% \emph{inaccesible}, the main macros are themselves stepping stones |
| 971 |
% to the package declared option. As perhaps multiple notational styles |
| 972 |
% might be useful in a single equation, who knows? |
| 973 |
% \end{macro}\end{macro} |
| 974 |
% |
| 975 |
% |
| 976 |
% |
| 977 |
% |
| 978 |
% \begin{macro}{\LagrODE}\begin{macro}{\LeibODE}\begin{macro}{\NewtODE} |
| 979 |
% \hspace{1em} There is unfortunately no way to avoid the process |
| 980 |
% of making an individual macro for each ODE version; |
| 981 |
% \begin{macrocode} |
| 982 |
\def\LagrODE{\let\@de@perat@r\d@@% sets the d |
| 983 |
\let\@dec@mm@nd\@de@not@Lagrange |
| 984 |
\@de@ifst@r} |
| 985 |
\def\LeibODE{\let\@de@perat@r\d@@% |
| 986 |
\let\@dec@mm@nd\@de@not@Leibniz |
| 987 |
\@de@ifst@r} |
| 988 |
\def\NewtODE{\let\@de@perat@r\d@@% |
| 989 |
\let\@dec@mm@nd\@de@not@Newton |
| 990 |
\@de@ifst@r} |
| 991 |
% \end{macrocode} |
| 992 |
% \end{macro}\end{macro}\end{macro} |
| 993 |
% \begin{macro}{\LagrPDE}\begin{macro}{\LeibPDE}\begin{macro}{\NewtPDE} |
| 994 |
% As well as making a macro for each PDE version; |
| 995 |
% \begin{macrocode} |
| 996 |
\def\LagrPDE{\let\@de@perat@r\d@l% sets the del |
| 997 |
\let\@dec@mm@nd\@de@not@Lagrange |
| 998 |
\@de@ifst@r} |
| 999 |
\def\LeibPDE{\let\@de@perat@r\d@l% |
| 1000 |
\let\@dec@mm@nd\@de@not@Leibniz |
| 1001 |
\@de@ifst@r} |
| 1002 |
\def\NewtPDE{\let\@de@perat@r\d@l% |
| 1003 |
\let\@dec@mm@nd\@de@not@Newton |
| 1004 |
\@de@ifst@r} |
| 1005 |
% \end{macrocode} |
| 1006 |
% |
| 1007 |
% In terms of usage, these are all the same command, the main |
| 1008 |
% differences come from what the operator is defined as, |
| 1009 |
% \cs{d@@} or \cs{d@l}, and which notational form that |
| 1010 |
% \cs{@dec@mm@nd} points at for further processes down the stream. |
| 1011 |
% They are however, given all caps for the \emph{ode} and \emph{pde} |
| 1012 |
% in order to enhance visual clarity should one use them. |
| 1013 |
% |
| 1014 |
% \end{macro}\end{macro}\end{macro} |
| 1015 |
% |
| 1016 |
% |
| 1017 |
% \subsubsection{The `Yoinkers'} |
| 1018 |
% \begin{macro}{\@dest@r@rg} |
| 1019 |
% \begin{macro}{\@de@ption@l@rg}\begin{macro}{\@de@exponent@rg} |
| 1020 |
% \hspace{1em} Now a group of functions are needed for the processing |
| 1021 |
% each of the major elements, the star (|*|), for whether to have a function |
| 1022 |
% parameter. The option (|[|), for determining the variable |
| 1023 |
% being differentiated. And exponent (|^|), for deteriming what order |
| 1024 |
% the differential should be. Whether these functions should be used |
| 1025 |
% or not, comes from the use of a macro described in section |
| 1026 |
% \ref{sec:checkpoints}. |
| 1027 |
% |
| 1028 |
% Importantly each of these elements, should they appear, |
| 1029 |
% require the relevant token to be `yoinked' by the macro in question. |
| 1030 |
% Should a star appear, \cs{@dest@r@rg} `gobbles' said star and propmts |
| 1031 |
% the next element, an optional argument, to be checked for. |
| 1032 |
% \begin{macrocode} |
| 1033 |
\def\@dest@r@rg*{\expandafter\@de@ifbr@ck} |
| 1034 |
% \end{macrocode} |
| 1035 |
% |
| 1036 |
% For an optional argument, \cs{@de@option@l@rg} will yoink the argument, |
| 1037 |
% as well as the surrounding brackets, |
| 1038 |
% \begin{macrocode} |
| 1039 |
\def\@de@ption@l@rg[#1]{\expandafter\v@rr@t@ks{#1}\relax \@de@ifexp@n}% |
| 1040 |
% \end{macrocode} |
| 1041 |
% |
| 1042 |
% If an exponent should appear, \cs{@de@exponent@rg} will yoink the |^|, |
| 1043 |
% and the integer following it, |
| 1044 |
% \begin{macrocode} |
| 1045 |
\def\@de@exponent@rg^#1{\exp@c@unt#1\relax \@deifst@rred} |
| 1046 |
% \end{macrocode} |
| 1047 |
% |
| 1048 |
% |
| 1049 |
% |
| 1050 |
% \begin{macro}{\@dest@r@dy@ink}\begin{macro}{\@den@st@ry@ink} |
| 1051 |
% |
| 1052 |
% \hspace{1em} Depending on if one is using the starred |
| 1053 |
% version of the command, |
| 1054 |
% there is a command that yoinks the following function variable |
| 1055 |
% and one that ends the compiling here. |
| 1056 |
% \begin{macrocode} |
| 1057 |
\def\@dest@r@dy@ink{\expandafter\@dec@mpf@rm} |
| 1058 |
\def\@den@st@ry@ink{\expandafter\@dey@inkf@rm} |
| 1059 |
% \end{macrocode} |
| 1060 |
% \end{macro}\end{macro}\end{macro} |
| 1061 |
% \end{macro}\end{macro} |
| 1062 |
% |
| 1063 |
% \begin{macro}{\@de@func@ther}\begin{macro}{\@de@func@Leib} |
| 1064 |
% \begin{macro}{\@de@func@Lagr}\begin{macro}{\@de@func@Newt} |
| 1065 |
% |
| 1066 |
% \hspace{1em} As a consequence of the inherent differences in how |
| 1067 |
% the notational styles treat functions, |
| 1068 |
% the \cs{@de@func@Leib} macro has to be treated differently. |
| 1069 |
% Whereas both |
| 1070 |
% the Lagrange and Newton notations will just accept the first token |
| 1071 |
% following the call of the function yoinker. The Leibniz varient will |
| 1072 |
% attempt to absorb all the tokens untill the first space token is found. |
| 1073 |
% This is not done in the traditional way of denoting an explicit space |
| 1074 |
% token at the end of the control sequence, but rather through a special |
| 1075 |
% macro defined in section \ref{sec:nextchar}. |
| 1076 |
% This had to be done as a consequence |
| 1077 |
% of getting the `|at|\textvisiblespace |x;|' function to work properly. |
| 1078 |
% \begin{macrocode} |
| 1079 |
\def\@de@func@ther#1{\expandafter\func@t@ks{#1}\relax |
| 1080 |
\expandafter\@de@if@tpos} |
| 1081 |
\def\@de@func@Leib{\expandafter\func@t@ks{}\relax |
| 1082 |
\expandafter\@de@ifbrace} |
| 1083 |
\let\@de@func@Lagr\@de@func@ther |
| 1084 |
\let\@de@func@Newt\@de@func@ther |
| 1085 |
% \end{macrocode} |
| 1086 |
% \end{macro}\end{macro} |
| 1087 |
% \end{macro}\end{macro} |
| 1088 |
% |
| 1089 |
% |
| 1090 |
% \begin{macro}{\@de@tpos@rg} |
| 1091 |
% \hspace{1em} Finally, the last element that can be used, is designed to |
| 1092 |
% eat all the tokens between its call and the first semi-colon it sees, |
| 1093 |
% to ensure a function can be derived anywhere. |
| 1094 |
% \begin{macrocode} |
| 1095 |
\def\@de@tpos@rg#1;{\expandafter\@tpost@ks{#1}\relax \@de@tf@rm} |
| 1096 |
% \end{macrocode} |
| 1097 |
% \end{macro} |
| 1098 |
% |
| 1099 |
% |
| 1100 |
% |
| 1101 |
% \subsubsection{Macro `Checkpoints'}\label{sec:checkpoints} |
| 1102 |
% \begin{macro}{\@de@ifst@r} |
| 1103 |
% \begin{macro}{\@de@ifbr@ck} |
| 1104 |
% \begin{macro}{\@de@ifexp@n} |
| 1105 |
% \hspace{1em} As can be seen in the definitions of the \cs{ode} and \cs{pde}, |
| 1106 |
% there are no explicitely defined \cs{ode*} or \cs{pde*} macros. |
| 1107 |
% A workaround is implemented by making the first step of the macro |
| 1108 |
% to check if the first token that appears is a star, or \emph{asterisk}, |
| 1109 |
% if one would prefer the technical language. These macros make use of an |
| 1110 |
% ancilliariy function \cs{@deifch@r}, |
| 1111 |
% which is defined in the section \ref{sec:nextchar}. |
| 1112 |
% |
| 1113 |
% \begin{macrocode} |
| 1114 |
\def\@de@ifst@r{\@deifch@r * |
| 1115 |
{\@dest@rgument\@dest@red\@dest@r@rg} |
| 1116 |
{\@dest@rgument\@den@st@r\@dest@r@rg*}} |
| 1117 |
\def\@de@ifbr@ck{\@deifch@r [ |
| 1118 |
\@de@ption@l@rg |
| 1119 |
{\@de@ption@l@rg[t]}} |
| 1120 |
\def\@de@ifexp@n{\@deifch@r ^ |
| 1121 |
\@de@exponent@rg |
| 1122 |
{\@de@exponent@rg^\@ne}} |
| 1123 |
% \end{macrocode} |
| 1124 |
% \begin{macro}{\@de@ifbrace} |
| 1125 |
% \hspace{1em} \cs{@de@ifbrace} is a bit more special than the other \cs{@deif} |
| 1126 |
% conditionals, as it is not a general use conditional. Only the |
| 1127 |
% Leibniz notational style function yoinker makes use of it. |
| 1128 |
% This is likely not a good long-term solution, but |
| 1129 |
% that just means it's going to be this way for at least a few years. |
| 1130 |
% \begin{macrocode} |
| 1131 |
\def\@de@ifbrace{\@deifch@r \bgroup |
| 1132 |
\@de@func@ther |
| 1133 |
\@de@tilsp@ce} |
| 1134 |
% \end{macrocode} |
| 1135 |
% \end{macro}\end{macro}\end{macro}\end{macro} |
| 1136 |
% |
| 1137 |
% |
| 1138 |
% \begin{macro}{\@de@if@tpos}\begin{macro}{\@de@tDoubleCheck} |
| 1139 |
% \hspace{1em} In the same way, there also exist a macro to check |
| 1140 |
% for the `|at|\textvisiblespace'. The main difference however, |
| 1141 |
% is the follow up command that helps |
| 1142 |
% \emph{robustify} \cs{@de@if@tpos}. This is done through absorbing all the |
| 1143 |
% tokens after the `|a|' until the next space token, if only |
| 1144 |
% a single token is absorbed, and that token is a `|t|', then success! Otherwise |
| 1145 |
% nothing happens.\footnotemark |
| 1146 |
% \begin{macrocode} |
| 1147 |
\def\@de@if@tpos{\@deifch@r a \@de@tDoubleCheck \@dec@mpf@rm} |
| 1148 |
\def\@de@tDoubleCheck a#1 {\ifx t#1\expandafter\@de@tpos@rg\else |
| 1149 |
\@dec@mpf@rm a#1\fi}% |
| 1150 |
% \end{macrocode} |
| 1151 |
% |
| 1152 |
% \footnotetext{There is a way to make this function in a far more generalized way using |
| 1153 |
% \cs{csname} and \cs{endcsname}. However, as this package makes use of |
| 1154 |
% this feature exactly \emph{once}, there is no benefit to |
| 1155 |
% generalizing the functionality.} |
| 1156 |
% \end{macro}\end{macro} |
| 1157 |
% |
| 1158 |
% |
| 1159 |
% |
| 1160 |
% |
| 1161 |
% \subsection{Ancilliary Functions} |
| 1162 |
% There are a lot of macros or command sequences that need to be used |
| 1163 |
% in addendum to the main commands that one would download this package for. |
| 1164 |
% As a consequence, there are a plethora of ancilliary functions to pull from |
| 1165 |
% defined in this section. |
| 1166 |
% |
| 1167 |
% |
| 1168 |
% \iffalse |
| 1169 |
%<package>%% ---------------------------------------------------------------- |
| 1170 |
%<package>%% Ancilliary Package Functions |
| 1171 |
%<package>%% ---------------------------------------------------------------- |
| 1172 |
% \fi |
| 1173 |
% \subsubsection{Variable Macronames} |
| 1174 |
% |
| 1175 |
% \begin{macro}{\@dest@rgument} |
| 1176 |
% \begin{macro}{\@deifst@rred} |
| 1177 |
% \begin{macro}{\@dec@mpf@rm} |
| 1178 |
% |
| 1179 |
% \hspace{1em}It becomes useful to be able to freely define which macro |
| 1180 |
% to be used when going through the option tree. |
| 1181 |
% Subsequently, three macros are defined |
| 1182 |
% to fufill that purpose. \cs{@dest@rgument} takes an argument and defines |
| 1183 |
% two macros \cs{@deifst@rred} which defines |
| 1184 |
% whether the function `yoinker' exists or not, and \cs{@dec@mpf@rm} |
| 1185 |
% which works with \cs{@de@option},defined in subsection \ref{sec:options}, |
| 1186 |
% to define the final ODE or PDE form. |
| 1187 |
% \begin{macrocode} |
| 1188 |
\def\@dest@rgument#1{% |
| 1189 |
\def\@deifst@rred{\csname @de#1y@ink\endcsname}% |
| 1190 |
\def\@dec@mpf@rm{\csname#1@\@dec@mm@nd\endcsname}} |
| 1191 |
% \end{macrocode} |
| 1192 |
% \end{macro}\end{macro}\end{macro} |
| 1193 |
% |
| 1194 |
% |
| 1195 |
% |
| 1196 |
% |
| 1197 |
% |
| 1198 |
% \begin{macro}{\@de@tf@rm}\begin{macro}{\@dey@inkf@rm} |
| 1199 |
% \hspace{1em} Additional macros are also defined for determining |
| 1200 |
% intermediate forms during the construction |
| 1201 |
% process of the resulting ODEs and PDEs |
| 1202 |
% \begin{macrocode} |
| 1203 |
\def\@de@tf@rm{\csname @de@t@\@dec@mm@nd\endcsname}% |
| 1204 |
\def\@dey@inkf@rm{\csname @de@func@\@dec@mm@nd\endcsname}% |
| 1205 |
% \end{macrocode} |
| 1206 |
% \end{macro}\end{macro} |
| 1207 |
% |
| 1208 |
% |
| 1209 |
% |
| 1210 |
% \subsubsection{Determing the next token}\label{sec:nextchar} |
| 1211 |
% An integral part of the `\emph{mastication}' process |
| 1212 |
% is the identification of the proceeding token in the oncoming token stream. |
| 1213 |
% Therefore, a macro is defined to streamline this process instead of needing |
| 1214 |
% to create a unique \cs{futurelet} sequence for each token type.\par |
| 1215 |
% The use of \cs{futurelet} is a strange and arcane process |
| 1216 |
% that better described by occult terminology than the proper scientific |
| 1217 |
% terms one would use in daily life. |
| 1218 |
% However, it is important to understand at least a little bit for the |
| 1219 |
% implementation of the \cs{@deifch@r} macro. |
| 1220 |
% |
| 1221 |
% \begin{macro}{\@deifch@r}\begin{macro}{\@detesttoken} |
| 1222 |
% |
| 1223 |
% \begin{macro}{\@de@tmpA}\begin{macro}{\@de@tmpB} |
| 1224 |
% |
| 1225 |
% \hspace{1em} \cs{@deifch@r} takes in three tokens as arguments, |
| 1226 |
% the first argument will assign \cs{@detesttoken} and be |
| 1227 |
% what the macro looks out for, |
| 1228 |
% while the other two arguments are for storage to be executed later. |
| 1229 |
% Building off this, there are two main elements that compose the macro, |
| 1230 |
% the namesake \cs{@deifch@r}, and its supplement macro |
| 1231 |
% \cs{@denext@rg}. This is because \cs{futurelet} is a primitive that will |
| 1232 |
% act as the \cs{let} primitive, just one token removed. |
| 1233 |
% |
| 1234 |
% \begin{minipage}[b]{0.45\textwidth} |
| 1235 |
% \tikz \graph[grow right = 1.5cm]{ |
| 1236 |
% \string\let -!- token1 <- token2 -!- token3 }; |
| 1237 |
% \end{minipage}~ |
| 1238 |
% \begin{minipage}[b]{0.45\textwidth} |
| 1239 |
% \tikz \graph[grow right = 1.5cm]{ |
| 1240 |
% \string\futurelet -!- token1 -!- token2 -!- token3, |
| 1241 |
% token1 <-[bend left, "\string\let\ token1 token3"] token3 }; |
| 1242 |
% \end{minipage} |
| 1243 |
% |
| 1244 |
% |
| 1245 |
% The most important consequence is that, |
| 1246 |
% should \cs{futurelet} be enacted upon a stream of three |
| 1247 |
% tokens, ``\cs{futurelet}| token1 token2 token3|''; |token1| will be \cs{let} |
| 1248 |
% to point at |token3| \emph{before} |
| 1249 |
% |token2| is expanded. What this means, is one is able to have |token3| |
| 1250 |
% \emph{act upon the unexpanded} |
| 1251 |
% |token2|.\footnote{If this means something to you, it's too late. |
| 1252 |
% You've lost your chance of escaping \TeX.} |
| 1253 |
% \begin{macrocode} |
| 1254 |
\def\@deifch@r#1#2#3{% |
| 1255 |
\let\@dew@tcht@k=#1\relax |
| 1256 |
\def\@de@tmpA{#2} \def\@de@tmpB{#3} |
| 1257 |
\futurelet\@detesttoken\@denext@rg} |
| 1258 |
% \end{macrocode} |
| 1259 |
% \hspace{1em} Using this \emph{enlightenment}, |
| 1260 |
% define the token representing an |
| 1261 |
% `|if-then-else|' control sequence \cs{@denext@rg}. In |
| 1262 |
% \cs{@deifch@r}, \cs{@dew@tcht@k} becomes a macro for |
| 1263 |
% the token we want to check against. Using this to our advantage, |
| 1264 |
% before \TeX\ expands \cs{@denext@rg}, it will assign \cs{@detesttoken} |
| 1265 |
% to point to a third, currently, unknown token after \cs{@denext@rg}. |
| 1266 |
% This is where the magic happens; because \cs{@denext@rg} only expands |
| 1267 |
% \emph{after} the assignment of \cs{@detesttoken}, meaning it becomes |
| 1268 |
% possible to compare \cs{@detesttoken} and \cs{@dew@tcht@k} against |
| 1269 |
% eachother to determine which outcome should be executed.\par |
| 1270 |
% \end{macro}\end{macro} |
| 1271 |
% |
| 1272 |
% \end{macro}\end{macro} |
| 1273 |
% |
| 1274 |
% |
| 1275 |
% |
| 1276 |
% \begin{macro}{\@denext@rg}\begin{macro}{\@de@nextact} |
| 1277 |
% |
| 1278 |
% \hspace{1em} The first half of \cs{@denext@rg} ensures that a |
| 1279 |
% space tokens does not get in the way of assignment, |
| 1280 |
% as unfortunate as it is, the \cs{futurelet} primitive \emph{does} |
| 1281 |
% consider a space token to be a valid token to point to. |
| 1282 |
% |
| 1283 |
% \begin{macrocode} |
| 1284 |
\def\@denext@rg{% |
| 1285 |
\ifx\@detesttoken\@sptoken\relax |
| 1286 |
\let\@de@nextact\@desp@cegobbler\else |
| 1287 |
% \end{macrocode} |
| 1288 |
% \hspace{1em} The second half of \cs{@denext@rg} is what does |
| 1289 |
% the actual comparison. Should the comparison be positive, |
| 1290 |
% \cs{@detesttoken} = \cs{@dew@tcht@k}, then the code stored |
| 1291 |
% in \cs{@de@tmpA} will be executed, otherwise, \cs{@de@tmpB} |
| 1292 |
% will be executed |
| 1293 |
% \begin{macrocode} |
| 1294 |
\ifx\@detesttoken\@dew@tcht@k\relax % if |
| 1295 |
\let\@de@nextact\@de@tmpA\else % ifn't |
| 1296 |
\let\@de@nextact\@de@tmpB\fi\fi |
| 1297 |
\@de@nextact} |
| 1298 |
% \end{macrocode} |
| 1299 |
% |
| 1300 |
% \begin{macro}{\@desp@cegobbler} |
| 1301 |
% \iffalse |
| 1302 |
%<package>\let\@desavedef\< |
| 1303 |
% \fi |
| 1304 |
% |
| 1305 |
% \hspace{1em} Ensuring that the space(s), explicit or implicit, trailing after |
| 1306 |
% \cs{@deifch@r} requires some \TeX\ \emph{tomfoolary}. |
| 1307 |
% By defining the function with a non-character token, the trailing space |
| 1308 |
% will matter for the macro definition, thereby, creating a macro that gobbles |
| 1309 |
% one space token on use. |
| 1310 |
% \begin{macrocode} |
| 1311 |
\def\<{\@desp@cegobbler} |
| 1312 |
\expandafter\def\< {\futurelet\@detesttoken\@denext@rg} |
| 1313 |
% \end{macrocode} |
| 1314 |
% These three macros work together as a three point cycle discarding spaces |
| 1315 |
% until the first non-space token is found, in which case the \cs{if}-\cs{else} |
| 1316 |
% will be executed. |
| 1317 |
% \end{macro} |
| 1318 |
% \end{macro} |
| 1319 |
% \end{macro} |
| 1320 |
% |
| 1321 |
% \begin{macro}{\@de@tilsp@ce} |
| 1322 |
% |
| 1323 |
% \hspace{1em} While the previous macro gobbles space tokens until it finds |
| 1324 |
% a non-space token \cs{@de@tilsp@ce} gobbles non-space |
| 1325 |
% tokens until it finds a space token. |
| 1326 |
% There is a difference however, in that \cs{@de@tilsp@ce} stores the |
| 1327 |
% gobbled tokens until it finds that space token, subsequently |
| 1328 |
% \rlap{ {ejaculating} }\hbox{---------------} |
| 1329 |
% \emph{returning} the the tokens as a registry list. |
| 1330 |
% \begin{macrocode} |
| 1331 |
\def\@de@tilsp@ce#1 {% |
| 1332 |
\beginnext% |
| 1333 |
\toks0={#1} |
| 1334 |
\edef\next{\func@t@ks=\expandafter{\the\toks0}} |
| 1335 |
\endnext \@de@if@tpos} |
| 1336 |
% \end{macrocode} |
| 1337 |
% \end{macro} |
| 1338 |
% |
| 1339 |
% |
| 1340 |
% |
| 1341 |
% \begin{macro}{\beginnext} |
| 1342 |
% \begin{macro}{\endnext} |
| 1343 |
% |
| 1344 |
% \hspace{1em} The \cs{beginnext}, \cs{endnext} construct |
| 1345 |
% is a relatively common construct one finds when working with |
| 1346 |
% variable macros and subsequently working with \cs{edef} commands. |
| 1347 |
% Using the explicit \cs{begingroup} and \cs{endgroup} group denotions |
| 1348 |
% means that one can play all sorts of registry based games, |
| 1349 |
% that can not be broken by implicit groupings. |
| 1350 |
% By \cs{edef}'ing \cs{next} inside this construct, whatever finalized |
| 1351 |
% product you have assigned to \cs{next}, will be a fully expanded |
| 1352 |
% assortment of values from those registries. |
| 1353 |
% \begin{macrocode} |
| 1354 |
\def\beginnext{\begingroup |
| 1355 |
\let\next\undefined} |
| 1356 |
\def\endnext{\expandafter\endgroup\next} |
| 1357 |
% \end{macrocode} |
| 1358 |
% \end{macro} |
| 1359 |
% \end{macro} |
| 1360 |
% |
| 1361 |
% |
| 1362 |
% |
| 1363 |
% |
| 1364 |
% \subsection{Notational Morphology} |
| 1365 |
% \iffalse |
| 1366 |
%<package>%% ---------------------------------------------------------------- |
| 1367 |
%<package>%% Package Notations |
| 1368 |
%<package>%% ---------------------------------------------------------------- |
| 1369 |
% \fi |
| 1370 |
% |
| 1371 |
% There is nothing particularly interesting about the methodology |
| 1372 |
% behind preparing the output forms, just using the classical |
| 1373 |
% \TeX\ methods of exponents and fractions. So while these macro definitions |
| 1374 |
% will be left in, there won't be much commenting on them directly. |
| 1375 |
% The follow-up section will be illustrating the macros used |
| 1376 |
% \emph{within} the ode replacement text, those will be explained. |
| 1377 |
% |
| 1378 |
% One thing of note, is that these macros make \emph{heavy} use of the |
| 1379 |
% `\cs{the}\cs{registry}' commands to expand registries previously |
| 1380 |
% used for storing tokens, and integers. Another hugely important |
| 1381 |
% element in these macros are the \cs{box} commands for arranging and |
| 1382 |
% subsequently storing said arrangement into a \emph{box} which can |
| 1383 |
% then float to the top of the groupings like a message in a bottle. |
| 1384 |
% |
| 1385 |
% \subsubsection*{Starred Forms} |
| 1386 |
% \begin{macro}{\st@r@d@Lagr} |
| 1387 |
% Macro for Lagr+star |
| 1388 |
% \begin{macrocode} |
| 1389 |
\def\st@r@d@Lagr{% |
| 1390 |
\setbox\@deresb@x\hbox{$ |
| 1391 |
{f^{\mkern1mu\@dedr@wm@rk\lagr@prime\lagr@prime\br@ced@xpon} |
| 1392 |
_{\m@kep@rtLagr}}\mkern-\tw@ mu\left(\the\v@rr@t@ks\right) |
| 1393 |
$}% |
| 1394 |
\@derele@se}% |
| 1395 |
% \end{macrocode} |
| 1396 |
% \end{macro} |
| 1397 |
% |
| 1398 |
% |
| 1399 |
% \begin{macro}{\st@r@d@Leib} |
| 1400 |
% Macro for Leib+star |
| 1401 |
% \begin{macrocode} |
| 1402 |
\def\st@r@d@Leib{% |
| 1403 |
\setbox\@defunb@x\hbox{$\@de@perat@r^{\@deem@rex}$}% |
| 1404 |
\b@se@Leib}% |
| 1405 |
% \end{macrocode} |
| 1406 |
% \end{macro} |
| 1407 |
% |
| 1408 |
% |
| 1409 |
% \begin{macro}{\st@r@d@Newt} |
| 1410 |
% Macro for Newt+star |
| 1411 |
% \begin{macrocode} |
| 1412 |
\def\st@r@d@Newt{% |
| 1413 |
\setbox\@dev@rb@x\hbox{$\the\v@rr@t@ks$} \b@se@Newt}% |
| 1414 |
% \end{macrocode} |
| 1415 |
% \end{macro} |
| 1416 |
% |
| 1417 |
% |
| 1418 |
% |
| 1419 |
% |
| 1420 |
% \subsubsection*{Unstarred Forms} |
| 1421 |
% \begin{macro}{\n@st@r@Lagr} |
| 1422 |
% Macro for Lagr |
| 1423 |
% \begin{macrocode} |
| 1424 |
\def\n@st@r@Lagr{% |
| 1425 |
\setbox\@deresb@x\hbox{$ |
| 1426 |
{\the\func@t@ks |
| 1427 |
^{\mkern\@ne mu\@dedr@wm@rk\lagr@prime\lagr@prime\br@ced@xpon} |
| 1428 |
_{\m@kep@rtLagr}}\mkern\m@ne mu$}% |
| 1429 |
\@derele@se}% |
| 1430 |
% \end{macrocode} |
| 1431 |
% \end{macro} |
| 1432 |
% |
| 1433 |
% |
| 1434 |
% \begin{macro}{\n@st@r@Leib} |
| 1435 |
% Macro for Leib |
| 1436 |
% \begin{macrocode} |
| 1437 |
\def\n@st@r@Leib{% |
| 1438 |
\setbox\@defunb@x\hbox{$ |
| 1439 |
\@de@perat@r^{\@deem@rex}\mkern0.40mu\the\func@t@ks$} |
| 1440 |
\b@se@Leib} |
| 1441 |
% \end{macrocode} |
| 1442 |
% \end{macro} |
| 1443 |
% |
| 1444 |
% |
| 1445 |
% \begin{macro}{\n@st@r@Newt} |
| 1446 |
% Macro for Newt |
| 1447 |
% \begin{macrocode} |
| 1448 |
\def\n@st@r@Newt{% |
| 1449 |
\setbox\@dev@rb@x\hbox{$\the\func@t@ks$} \b@se@Newt}% |
| 1450 |
% \end{macrocode} |
| 1451 |
% \end{macro} |
| 1452 |
% |
| 1453 |
% \subsubsection*{``At Position'' Forms} |
| 1454 |
% \begin{macro}{\@de@t@Lagr} |
| 1455 |
% Macro for Lagr at point |
| 1456 |
% \begin{macrocode} |
| 1457 |
\def\@de@t@Lagr{% |
| 1458 |
\noexpand\hbox{$ |
| 1459 |
\n@st@r@Lagr\mkern-\thr@@ mu\left(\the\@tpost@ks\right) |
| 1460 |
$}}% |
| 1461 |
% \end{macrocode} |
| 1462 |
% \end{macro} |
| 1463 |
% |
| 1464 |
% |
| 1465 |
% \begin{macro}{\@de@t@Leib} |
| 1466 |
% Macro for Leib at point |
| 1467 |
% \begin{macrocode} |
| 1468 |
\def\@de@t@Leib{% |
| 1469 |
\noexpand\hbox{$ |
| 1470 |
\left.\n@st@r@Leib\mkern\@ne mu\right| |
| 1471 |
_{\mkern1mu\displaystyle\the\v@rr@t@ks\mkern2mu |
| 1472 |
\rlap{$\scriptstyle=\mkern\thinmuskip\the\@tpost@ks$}} |
| 1473 |
$}% |
| 1474 |
}% |
| 1475 |
% \end{macrocode} |
| 1476 |
% \end{macro} |
| 1477 |
% |
| 1478 |
% |
| 1479 |
% \begin{macro}{\@de@t@Newt} |
| 1480 |
% Macro for Newton at point |
| 1481 |
% \begin{macrocode} |
| 1482 |
\def\@de@t@Newt{% |
| 1483 |
\noexpand\hbox{$ |
| 1484 |
\n@st@r@Newt\mkern-\tw@ mu\left(\the\@tpost@ks\right) |
| 1485 |
$}}% |
| 1486 |
% \end{macrocode} |
| 1487 |
% \end{macro} |
| 1488 |
% |
| 1489 |
% |
| 1490 |
% |
| 1491 |
% |
| 1492 |
% |
| 1493 |
% |
| 1494 |
% \subsubsection*{Foundational forms} |
| 1495 |
% |
| 1496 |
% |
| 1497 |
% \begin{macro}{\m@kep@rtLagr} |
| 1498 |
% Macro for Lagr partial notations |
| 1499 |
% \begin{macrocode} |
| 1500 |
\def\m@kep@rtLagr{\ifx\@de@perat@r\d@l\the\v@rr@t@ks\else\empty\fi} |
| 1501 |
% \end{macrocode} |
| 1502 |
% \end{macro} |
| 1503 |
% |
| 1504 |
% |
| 1505 |
% \begin{macro}{\b@se@Leib} |
| 1506 |
% Macro for the base Leibniz form |
| 1507 |
% \begin{macrocode} |
| 1508 |
\def\b@se@Leib{% |
| 1509 |
\setbox\@dev@rb@x\hbox{$ |
| 1510 |
\@de@perat@r\mkern0.40mu\the\v@rr@t@ks^{\@deem@rex}$}% |
| 1511 |
\setbox\@deresb@x\hbox{\kern0.5\p@% |
| 1512 |
$\raise2\p@\box\@defunb@x\@de@ver\lower5\p@\box\@dev@rb@x$% |
| 1513 |
\kern0.5\p@}% |
| 1514 |
\@derele@se}% |
| 1515 |
% \end{macrocode} |
| 1516 |
% \end{macro} |
| 1517 |
% |
| 1518 |
% |
| 1519 |
% \begin{macro}{\b@se@Newt} |
| 1520 |
% Macro for the base Newton form |
| 1521 |
% \begin{macrocode} |
| 1522 |
\def\b@se@Newt{% |
| 1523 |
\setbox\@defunb@x\hbox{\vbox{\baselineskip=\z@\lineskip=\m@ne\p@% |
| 1524 |
\@dedr@wm@rk\@de@ned@ts\@detw@d@ts\@denewt@nd@t}}% |
| 1525 |
\setbox\@deresb@x\hbox{\vbox{\baselineskip=\z@\lineskip=-0.5\p@% |
| 1526 |
\hbox to\wd\@dev@rb@x{\hss\raise\z@\box\@defunb@x\hss}% |
| 1527 |
\hbox{\raise\z@\box\@dev@rb@x}}}% |
| 1528 |
\@derele@se} |
| 1529 |
% \end{macrocode} |
| 1530 |
% \end{macro} |
| 1531 |
% |
| 1532 |
% \begin{macro}{\m@kep@rtNewt} |
| 1533 |
% Macro for Newt partial notations |
| 1534 |
% \begin{macrocode} |
| 1535 |
\def\m@kep@rtNewt{\ifx\@de@perat@r\d@l\empty\fi} |
| 1536 |
% \end{macrocode} |
| 1537 |
% \end{macro} |
| 1538 |
% |
| 1539 |
% |
| 1540 |
% |
| 1541 |
% |
| 1542 |
% |
| 1543 |
% \subsection{Notational Shaping Tools} |
| 1544 |
% |
| 1545 |
% Here's where some spice comes back into play. |
| 1546 |
% One of the major challenges\footnote{Aside from my mental challenges.} |
| 1547 |
% was ensuring that the appropriate number of primes or dots were |
| 1548 |
% placed when changing the |maxprimes| option. |
| 1549 |
% |
| 1550 |
% Did the author realistically need to make it so one could have |
| 1551 |
% a procedural number of primes/dots? Nope. Would there ever be a realistic |
| 1552 |
% use-case for a derivative of order 3 or higher in |
| 1553 |
% which one would use markings? Of course not. Did the author do it anyways? |
| 1554 |
% Absolutely. |
| 1555 |
% |
| 1556 |
% |
| 1557 |
% \begin{macro}{\lagr@prime} |
| 1558 |
% \begin{macro}{\br@ced@xpon} |
| 1559 |
% \hspace{1em} The macro for the Lagrangian prime is very straightforward |
| 1560 |
% each time \cs{lagr@prime} is used, a prime mark will be placed, |
| 1561 |
% and the exponent count will reduce by one. The function does this |
| 1562 |
% repeatedly until the exponent count is reduced to 1. |
| 1563 |
% \begin{macrocode} |
| 1564 |
\def\lagr@prime{\mkern0.35mu\prime\global\advance\exp@c@unt\m@ne} |
| 1565 |
% \end{macrocode} |
| 1566 |
% |
| 1567 |
% Should the exponent count be greater than the maximum allowed prime |
| 1568 |
% markings, \cs{br@ced@xpon} will be used instead, which will display |
| 1569 |
% the general form of an integer enclosed by parenthesis. |
| 1570 |
% \begin{macrocode} |
| 1571 |
\def\br@ced@xpon{\left(\the\exp@c@unt\right)} |
| 1572 |
% \end{macrocode} |
| 1573 |
% |
| 1574 |
% |
| 1575 |
% \end{macro} |
| 1576 |
% \end{macro} |
| 1577 |
% |
| 1578 |
% |
| 1579 |
% |
| 1580 |
% \begin{macro}{\@detw@d@ts} |
| 1581 |
% \begin{macro}{\@de@ned@ts} |
| 1582 |
% \hspace{1em} The dots for the Newtonian notation are more complicated than |
| 1583 |
% just incrementing a counter by one for each placed mark. |
| 1584 |
% Because Newtonian notation is built with a point at the top, it |
| 1585 |
% requires the initial dot to be place prior the rest of the dots as |
| 1586 |
% the \cs{vbox} primitive builds top down |
| 1587 |
% |
| 1588 |
% In order to deal with that, this set of macros, \cs{@detw@d@ts} |
| 1589 |
% and \cs{@de@ned@ts} |
| 1590 |
% will take the exponent count, and determine if the number is $\equiv|mod2|$ |
| 1591 |
% if it is congruent. There is no initial dot created, if it is not congruent |
| 1592 |
% \emph{and} a greater value than the set maxprimes, an initial dot is |
| 1593 |
% placed into the token stream to become the star on top. |
| 1594 |
% |
| 1595 |
% The reason for these macros to be so complicated, is that \TeX\ only has |
| 1596 |
% addition, and multiplication with integer registries. There is no divsion |
| 1597 |
% or float value functionality. |
| 1598 |
% \begin{macrocode} |
| 1599 |
\def\@detw@d@ts{\ifnum\exp@c@unt>\@ne% |
| 1600 |
\advance\exp@c@unt-\tw@\hbox to 5\p@{\hss$\cdot\cdot$\hss}\fi}% |
| 1601 |
\def\@de@ned@ts{\@detempv@l=\the\exp@c@unt% |
| 1602 |
\loop\ifnum\@detempv@l>\tw@% |
| 1603 |
\advance\@detempv@l-\tw@\repeat% |
| 1604 |
\ifnum\@detempv@l<\tw@% |
| 1605 |
\advance\exp@c@unt\m@ne\hbox to 5\p@{\hss$\cdot$\hss}\fi}% |
| 1606 |
% \end{macrocode} |
| 1607 |
% \end{macro} |
| 1608 |
% \end{macro} |
| 1609 |
% |
| 1610 |
% \begin{macro}{\@denewt@nd@t} |
| 1611 |
% \hspace{1em} The generalized form of the the Newtonian derivative notation is |
| 1612 |
% is just a glorified fraction, with a dot as the denominator, and a number |
| 1613 |
% as the numerator. |
| 1614 |
% \begin{macrocode} |
| 1615 |
\def\@denewt@nd@t{\hbox{\vbox{% |
| 1616 |
\hbox to 5\p@{\hss\raise\thr@@\p@\hbox{$\scriptstyle\@deem@rex$}\hss}% |
| 1617 |
\hbox to 5\p@{\hss\hbox{$\displaystyle\cdot$}\hss}}}}% |
| 1618 |
% \end{macrocode} |
| 1619 |
% \end{macro} |
| 1620 |
% |
| 1621 |
% \begin{macro}{\@deem@rex} |
| 1622 |
% For the Leibniz notation, there is no reason to display the exponent |
| 1623 |
% should it be an integer value less than 2, therefor, any |
| 1624 |
% exponent count less than two will be replaced with \cs{empty}. |
| 1625 |
% \begin{macrocode} |
| 1626 |
\def\@deem@rex{\ifnum\tw@>\exp@c@unt\empty\else\the\exp@c@unt\fi} |
| 1627 |
% \end{macrocode} |
| 1628 |
% |
| 1629 |
% \begin{macro}{\@dedr@wm@rk} |
| 1630 |
% \hspace{1em} Because both the Lagrangian and Newtonian notational styles involve |
| 1631 |
% a physical marking being repeated, common macro was made that |
| 1632 |
% takes 3 arguments, the first will be for the initial placement, |
| 1633 |
% the second argument is fed into a follow-up macro \cs{@derepe@tdr@w}, |
| 1634 |
% and the third argument is what |
| 1635 |
% will be placed should the exponent count be higher than the max allowed. |
| 1636 |
% |
| 1637 |
% Effectively \cs{@dedr@wm@rk} is what checks whether it should be a marking |
| 1638 |
% or the more symbolic generalized form. |
| 1639 |
% \begin{macrocode} |
| 1640 |
\def\@dedr@wm@rk#1#2#3{ |
| 1641 |
\ifnum\exp@c@unt<\m@xm@rk |
| 1642 |
#1\@derepe@tdr@w#2\else |
| 1643 |
#3\fi} |
| 1644 |
% \end{macrocode} |
| 1645 |
% \begin{macro}{\@derepe@tdr@w} |
| 1646 |
% While \cs{@derepe@tdr@w} is what provides the |
| 1647 |
% conditional looping enviroment to ensure the markings are placed; |
| 1648 |
% \begin{macrocode} |
| 1649 |
\def\@derepe@tdr@w#1{\loop\ifnum\exp@c@unt>\z@#1\repeat} |
| 1650 |
% \end{macrocode} |
| 1651 |
% \end{macro} |
| 1652 |
% \end{macro} |
| 1653 |
% \end{macro} |
| 1654 |
% |
| 1655 |
% \begin{macro}{\@derele@se} |
| 1656 |
% Shorthand for allowing the final formed ode or pde to rise to the surface |
| 1657 |
% \begin{macrocode} |
| 1658 |
\def\@derele@se{\noexpand{\box\@deresb@x}} |
| 1659 |
% \end{macrocode} |
| 1660 |
% \end{macro} |
| 1661 |
% |
| 1662 |
% \iffalse |
| 1663 |
%</package> |
| 1664 |
% \fi |
| 1665 |
% |
| 1666 |
% |
| 1667 |
% \iffalse |
| 1668 |
%<package>\let\<\@desavedef |
| 1669 |
%<package>\endinput |
| 1670 |
% \fi |
| 1671 |
% |
| 1672 |
% |
| 1673 |
% |
| 1674 |
% |
| 1675 |
% \Finale |