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/examples |
Initial commit
Diffstat (limited to 'macros/latex/contrib/lmacs/examples')
-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 |
5 files changed, 261 insertions, 0 deletions
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} |