diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/lmacs |
Initial commit
Diffstat (limited to 'macros/latex/contrib/lmacs')
-rw-r--r-- | macros/latex/contrib/lmacs/README | 16 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/docs/lmacs.pdf | bin | 0 -> 40104 bytes | |||
-rw-r--r-- | macros/latex/contrib/lmacs/examples/lmacs_aeb.def | 45 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/examples/lmacs_aeb.js | 8 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/examples/lmacs_aeb.tex | 181 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/examples/lmacs_tst.def | 5 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/examples/lmacs_tst.tex | 22 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/lmacs.dtx | 138 | ||||
-rw-r--r-- | macros/latex/contrib/lmacs/lmacs.sty | 28 |
9 files changed, 443 insertions, 0 deletions
diff --git a/macros/latex/contrib/lmacs/README b/macros/latex/contrib/lmacs/README new file mode 100644 index 0000000000..1f8ffdfb10 --- /dev/null +++ b/macros/latex/contrib/lmacs/README @@ -0,0 +1,16 @@ +lmacs Package--2012/05/30 v1.1 + +This is a simple package designed to clean up command definitions made in +the preamble. You can cut the commands in your preamble and paste them +into a file named myDefs.def, for example. Then insert the following line +to replace what you just removed: + +\usepackage[def=myDefs,!js=myJS]{lmacs} + +The package supports auxiliary files with extensions of .def, .js, and +.cfg. More can easily be added, if needed. Use of an exclamation mark +as shown above cancels the inclusion of that file. + +Now, back to my retirement. + +D. P. Story diff --git a/macros/latex/contrib/lmacs/docs/lmacs.pdf b/macros/latex/contrib/lmacs/docs/lmacs.pdf Binary files differnew file mode 100644 index 0000000000..b6745bd4b7 --- /dev/null +++ b/macros/latex/contrib/lmacs/docs/lmacs.pdf diff --git a/macros/latex/contrib/lmacs/examples/lmacs_aeb.def b/macros/latex/contrib/lmacs/examples/lmacs_aeb.def new file mode 100644 index 0000000000..1ae975fcd8 --- /dev/null +++ b/macros/latex/contrib/lmacs/examples/lmacs_aeb.def @@ -0,0 +1,45 @@ +% +% This is the preamble content that originally appear in the source file. +% +\title{\texorpdfstring{Acro\!\TeX}{AcroTeX} eDucation Bundle + \texorpdfstring{\\[1ex]}{:}The \textsf{lmacs} Package} +\author{D. P. Story} +\subject{File to demo the lmacs package} +\keywords{LaTeX, hyperref, PDF, exercises, quizzes} +\university{% + Acro\negthinspace\TeX.Net\\ + NORTHWEST FLORIDA STATE COLLEGE\\ + Department of Mathematics} +\email{dpstory@acrotex.net} +\version{1.0} +\copyrightyears{2012} +%\nocopyright +\revisionLabel{} + +\noHeadersOnSectionPage + +\newcounter{probno}[section] +\renewcommand{\theprobno}{\thesection.\arabic{probno}} +% +% Define a problem environment with its own counter. +\newenvironment{problem}{% +\renewcommand\exlabel{Problem}% +\renewcommand\exlabelformat{\textbf{\exlabel\ \theprobno.}}% +\renewcommand\exsllabelformat + {\noexpand\textbf{\exlabel\ \theprobno.}}% +\renewcommand\exrtnlabelformat{$\blacktriangleleft$}% +\renewcommand\exsecrunhead{Solutions to Problems}% +\begin{exercise}[probno]} +{\end{exercise}} + + +% Define a example environment with no counter +\newenvironment{example}{% +\renewcommand\exlabel{Example}% +\renewcommand\exlabelformat{\textbf{\exlabel.}}% +\renewcommand\exrtnlabelformat{$\square$}% +\SolutionsAfter +\begin{exercise}[0]}% +{\end{exercise}} + +\endinput diff --git a/macros/latex/contrib/lmacs/examples/lmacs_aeb.js b/macros/latex/contrib/lmacs/examples/lmacs_aeb.js new file mode 100644 index 0000000000..39b2b4f540 --- /dev/null +++ b/macros/latex/contrib/lmacs/examples/lmacs_aeb.js @@ -0,0 +1,8 @@ +% +% Document JavaScript +% +\begin{insDLJS}[makeAlert]{myjs}{Demo Alert Function} +function makeAlert(msg) { + app.alert(msg); +} +\end{insDLJS} diff --git a/macros/latex/contrib/lmacs/examples/lmacs_aeb.tex b/macros/latex/contrib/lmacs/examples/lmacs_aeb.tex new file mode 100644 index 0000000000..87d6bfec94 --- /dev/null +++ b/macros/latex/contrib/lmacs/examples/lmacs_aeb.tex @@ -0,0 +1,181 @@ +% +% This is the file webeqtst.tex that is distributed with the AeB Bundle +% +\documentclass{article} +\usepackage{amsmath} +\usepackage{graphicx} +\usepackage[tight,designi]{web} % dvipsone, dvips, pdftex, dvipdfm +\usepackage{exerquiz} + +\usepackage[def=lmacs_aeb,js=lmacs_aeb]{lmacs} + +\begin{document} + +\maketitle + +\tableofcontents + + +\section{Introduction} + +The \textsf{lmacs} is designed to clean up the preamble of a source file. +For this file, we have +\begin{verbatim} + \usepackage[def=lmacs_aeb,js=lmacs_aeb]{lmacs} +\end{verbatim} +The preamble definitions are in the file \texttt{lmacs\_aeb.def} and a +document JavaScript is imported with the file \texttt{lmacs\_aeb.js}. + +\medskip\noindent We'll test the JavaScript first, press this button: +\pushButton[\CA{Press Me}\A{\JS{% + makeAlert("Hooray for the lmacs package!") +}}]{alertBtn}{}{11bp} + +\medskip\noindent The next section is taken from the file +\texttt{webeqtst.tex}. The problem environment is defined in the file +\texttt{lmacs\_aeb.def}, other definitions and customizations can be found +in that file. + +\medskip\noindent Though I am using the \textsf{web} and \textsf{exerquiz} package, lmacs +does not require them; \textsf{lmacs} is a general purpose package for inputting +local definitions. + +\section{Online Exercises} + +A well-designed sequences of exercises can be of aid to the +student. The \texttt{exercise} environment makes it easy to +produce electronic exercises. By using the \texttt{forpaper} +option, you can also make a paper version of your exercises. + +\begin{exercise} +Evaluate the integral \(\displaystyle\int x^2 e^{2x}\,dx\). +\begin{solution} +We evaluate by \texttt{integration by parts}:\normalsize +\begin{alignat*}{2} + \int x^2 e^{2x}\,dx & + = \tfrac12 x^2 e^{2x} - \int x e^{2x}\,dx &&\quad + \text{$u=x^2$, $dv=e^{2x}\,dx$}\\& + = \tfrac12 x^2 e^{2x} - + \Bigl[\tfrac12 x e^{2x}-\int \tfrac12 e^{2x}\,dx\Bigr] &&\quad + \text{integration by parts}\\& + = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac12\int e^{2x}\,dx &&\quad + \text{$u=x^2$, $dv=e^{2x}\,dx$}\\& + = \tfrac12 x^2 e^{2x} - \tfrac12 x e^{2x} + \tfrac14 e^{2x} &&\quad + \text{integration by parts}\\& + = \tfrac14(2x^2-2x+1)e^{2x} &&\quad + \text{simplify!} +\end{alignat*} +\end{solution} +\end{exercise} + +In the preamble of this document, we defined a \texttt{problem} +environment with its own counter. Here is an example of it. + +\begin{problem} +Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$? Explain +your reasoning. +\begin{solution} +The answer is yes. The definition states that $F$ is an +antiderivative of $f$ if $F'(x)=f(x)$. Note that +$$ + F(t)=\sin(t) \implies F'(t) = \cos(t) +$$ +hence, $F(x) = \cos(x) = f(x)$. +\end{solution} +\end{problem} + +\begin{problem} +Is $F(t)=\sin(t)$ an antiderivative of $f(x)=\cos(x)$? Explain +your reasoning. +\begin{solution} +The answer is yes. The definition states that $F$ is an +antiderivative of $f$ if $F'(x)=f(x)$. Note that +$$ + F(t)=\sin(t) \implies F'(t) = \cos(t) +$$ +hence, $F(x) = \cos(x) = f(x)$. +\end{solution} +\end{problem} + +\noindent By modifying the \texttt{exercise} environment, you can +also create an \texttt{example} environment. The one defined in +the preamble of this document has no associated counter. + +\begin{example} +Give an example of a set that is \textit{clopen}. +\begin{solution} +The real number line is both closed and open in the usual topology of the +real line.% +\end{solution} +\end{example} + +There is a \texttt*-option with the \texttt{exercise} environment, +using it signals the presence of a multiple part exercise +question. The following exercise illustrates this option. + +\begin{exercise}*\label{ex:parts} +Suppose a particle is moving along the $s$-axis, and that its position +at any time $t$ is given by $s=t^2 - 5t + 1$. +\begin{parts} +\item[h]\label{item:part} Find the velocity, $v$, of the particle at any time +$t$. +\begin{solution} +Velocity is the rate of change of position with respect to time. In +symbols: +$$ + v = \frac{ds}{dt} +$$ +For our problem, we have +$$ + v = \frac{ds}{dt} =\frac d{dt}(t^2 - 5t + 1) = 2t-5. +$$ +The velocity at time $t$ is given by $\boxed{v=2t-5}$. +\end{solution} + +\item Find the acceleration, $a$, of the particle at any time $t$. +\begin{solution} +Acceleration is the rate of change of velocity with respect to time. +Thus, +$$ + a = \frac{dv}{dt} +$$ +For our problem, we have +$$ + a = \frac{dv}{dt} =\frac d{dt}(2t-5)=2. +$$ +The acceleration at time $t$ is constant: $\boxed{a=2}$. +\end{solution} +\end{parts} +\end{exercise} + +References can be made to a particular part of an exercise; for example, +``see \hyperref[item:part]{Exercise~\ref*{ex:parts}(\ref*{item:part})}.'' +Part (a) is in \textcolor{webblue}{blue}; the solutions for that part is +``hidden''. This is a new option for the \texttt{exercise} environment. + +There is now an option for listing multipart question in tabular form. +This problem style does not obey the \texttt{solutions\-after} option. + +\begin{exercise}* +Simplify each of the following expressions in the complex number +system. \textit{Note}: $\bar z$ is the conjugate of $z$; +$\operatorname{Re} z$ is the real part of $z$ and +$\operatorname{Im} z$ is the imaginary part of $z$. +\begin{parts}[2] +\item $i^2$ +\begin{solution} $i^2 = -1$ \end{solution} +& +\item $i^3$ \begin{solution} $i^3 = i i^2 = -i$\end{solution} +\\ +\item $z+\bar z$ +\begin{solution} $z+\bar z=\operatorname{Re} z$\end{solution} +& +\item[h] $1/z$ +\begin{solution} +$\displaystyle\frac 1z=\frac 1z\frac{\bar z}{\bar z}=\frac z{z\bar z}=\frac z{|z|^2}$ +\end{solution} +\end{parts} +\end{exercise} + + +\end{document} diff --git a/macros/latex/contrib/lmacs/examples/lmacs_tst.def b/macros/latex/contrib/lmacs/examples/lmacs_tst.def new file mode 100644 index 0000000000..83eb8e7235 --- /dev/null +++ b/macros/latex/contrib/lmacs/examples/lmacs_tst.def @@ -0,0 +1,5 @@ +% +% preamble definitions for lmacs_tst.tex +% +\newcommand{\myCoolPkg}{\textsf{lmacs} Package} +\endinput diff --git a/macros/latex/contrib/lmacs/examples/lmacs_tst.tex b/macros/latex/contrib/lmacs/examples/lmacs_tst.tex new file mode 100644 index 0000000000..cc2acce19e --- /dev/null +++ b/macros/latex/contrib/lmacs/examples/lmacs_tst.tex @@ -0,0 +1,22 @@ +\documentclass{article} + +\usepackage[def=lmacs_tst]{lmacs} + + +\begin{document} + +\section{Introduction} + +The {\myCoolPkg} is designed to clean up the preamble of a source file. +For this file, we have +\begin{verbatim} + \usepackage[def=lmacs_tst]{lmacs} +\end{verbatim} +The preamble definitions are in the file \texttt{lmacs\_tst.def}. For this +demo file, the only definition in \texttt{lmacs\_tst.def} in that of +\texttt{\string\myCoolPkg}. The \texttt{@} character has the catcode of +a letter, since the file is input via \texttt{\string\usepackage}. + + + +\end{document} diff --git a/macros/latex/contrib/lmacs/lmacs.dtx b/macros/latex/contrib/lmacs/lmacs.dtx new file mode 100644 index 0000000000..23c3d08adb --- /dev/null +++ b/macros/latex/contrib/lmacs/lmacs.dtx @@ -0,0 +1,138 @@ +% \iffalse meta-comment +% http://www.texdev.net/2009/10/06/a-model-dtx-file/ +% !TEX program = pdfLaTeX +%<*internal> +\iffalse +%</internal> +%<*internal> +\fi +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +%</internal> +%<*install> +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +\endpreamble +\ifx\fmtname\nameofplainTeX +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} +\fi +%</install> +%<install>\endbatchfile +%<*internal> +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile\else + \expandafter\endgroup\fi +%</internal> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{lmacs} +%<package> [2012/05/30 v1.1 Imports local macro files] +%<*driver> +\documentclass{ltxdoc} +%\usepackage{\jobname} +%\usepackage[numbered]{hypdoc} +%\EnableCrossrefs +%\CodelineIndex +%\RecordChanges +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +%\GetFileInfo{\jobname.sty} +% +%\title{The \textsf{\jobname} Package} +%\author{D. P. Story} +%\date{Released \today} +% +%\maketitle +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \paragraph*{Description.} This package is used to clean up the +% preamble of {\LaTeX} files. Some preambles have a (large) number of definitions +% in them. To clean up the preamble, move the definitions in the preamble into a separate file, and +% use this package in import them into your preamble. Normally, +% \textsf{lmacs} would have a position that follows all packages for the +% document. +% +% \textsf{lmacs} stands for \underbar{l}ocal \underbar{mac}ro\underbar{s}. Normally, the files referenced are in the same folder +% as the main source file; they should not (but can) be in the search path of {\LaTeX}. +% +% \paragraph*{Demo files:} \texttt{lmacs\_tst.tex} (a simple latex source) +% and \texttt{lmacs\_aeb.tex} (a file that uses the \textsf{web} and \textsf{exerquiz} packages). +% These are found in the \texttt{examples} folder. +% +% \paragraph*{Documentation and Code.} +% We begin by requiring \texttt{kvoptions}, this package does not test for the presence +% of a class file, so we can use it. It allows us to define key-values as options of the +% package. +% \begin{macrocode} +\RequirePackage{kvoptions}[2009/07/21] +% \end{macrocode} +% \begin{macrocode} +% \end{macrocode} +% \begin{macro}{cfg} +% \begin{macro}{def} +% \begin{macro}{js} +% With these keys, you can specify the file with the specified extension be imported. +% For example, the following line +%\begin{verbatim} +% \usepackage[cfg=myconf,def=mydef,js=myjs]{lmacs} +%\end{verbatim} +% will import (using \cs{InputIfFileExists}) the files \texttt{myconf.cfg}, +% \texttt{mydef.def}, and \texttt{myjs.js}. Multiple specifications of the same +% extension is permitted, for example, +%\begin{verbatim} +% \usepackage[def=mydef1,def=mydef2]{lmacs} +%\end{verbatim} +% \begin{macrocode} +\let\LM@inputlist\@empty +% \end{macrocode} +% \cmd{\LM@input} inputs \texttt{\#1.\#2}, while \cmd{\LM@warning} issues +% a package warning if \texttt{\#1.\#2} is not found. +% \begin{macrocode} +\newcommand{\LM@input}[2]{\InputIfFileExists{#1.#2}{}% + {\LM@warning{#1}{#2}}} +\newcommand{\LM@warning}[2]{\PackageWarning{lmacs} + {The file #1.#2 cannot be found}} +% \end{macrocode} +% \DescribeMacro{!cfg}\DescribeMacro{!def}\DescribeMacro{!js}For each of these options, we add the specified file to +% \cs{LM@inputlist}, this will be executed at the end of the package. The three options +% \texttt{!cfg}, \texttt{!def}, \texttt{!js} do nothing, making it easy to include, or +% not include a file. +% \begin{macrocode} +\define@key{lmacs}{cfg}{\g@addto@macro\LM@inputlist{\LM@input{#1}{cfg}}} +\define@key{lmacs}{!cfg}{} +\define@key{lmacs}{def}{\g@addto@macro\LM@inputlist{\LM@input{#1}{def}}} +\define@key{lmacs}{!def}{} +\define@key{lmacs}{js}{\g@addto@macro\LM@inputlist{\LM@input{#1}{js}}} +\define@key{lmacs}{!js}{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \begin{macrocode} +\ProcessKeyvalOptions{lmacs} +% \end{macrocode} +% Once the options have been process, we execute the command +% \cs{LM@inputlist} which contains a list of the files to be input. +% \begin{macrocode} +\LM@inputlist +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +%\Finale diff --git a/macros/latex/contrib/lmacs/lmacs.sty b/macros/latex/contrib/lmacs/lmacs.sty new file mode 100644 index 0000000000..0d49bf268e --- /dev/null +++ b/macros/latex/contrib/lmacs/lmacs.sty @@ -0,0 +1,28 @@ +%% +%% This is file `lmacs.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% lmacs.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{lmacs} + [2012/05/21 v1.1 Imports local macro files] +\RequirePackage{kvoptions}[2009/07/21] +\let\LM@inputlist\@empty +\newcommand{\LM@input}[2]{\InputIfFileExists{#1.#2}{}% + {\LM@warning{#1}{#2}}} +\newcommand{\LM@warning}[2]{\PackageWarning{lmacs} + {The file #1.#2 cannot be found}} +\define@key{lmacs}{cfg}{\g@addto@macro\LM@inputlist{\LM@input{#1}{cfg}}} +\define@key{lmacs}{!cfg}{} +\define@key{lmacs}{def}{\g@addto@macro\LM@inputlist{\LM@input{#1}{def}}} +\define@key{lmacs}{!def}{} +\define@key{lmacs}{js}{\g@addto@macro\LM@inputlist{\LM@input{#1}{js}}} +\define@key{lmacs}{!js}{} +\ProcessKeyvalOptions{lmacs} +\LM@inputlist +\endinput +%% +%% End of file `lmacs.sty'. |