#acl All:read Default #format inline_latex [[PDFIcon]] || '''Categories''' || CategoryMatlab CategoryLinux CategoryLatex CategoryBeamer || || '''See also''' || InSilico/LinuxOnWindows ["InSilico/LecturingWithBeamerLatex/MainStyle?action=raw"] || ---- [[TableOfContents(2)]] = Introduction = This note explains the tools and work-flow practices I developed for creating lecture presentation slides and associated materials with `LaTeXe-Beamer`. '''NB:''' We assume that the reader has a working `LaTeX-Beamer` system for the lecture notes (i.e. can run `bookit`, `btex` and `ltex` from a linux command line ... if this is not true, see section at the bottom for installation), and purely wants to know what new tools/comands are available to them under the lecture system. = The Lecture Style = The lecture style file (`main.style`) should be loaded in the preamble of a `.tex` doc thus: {{{ \input{path/to/main.style} }}} and provides a number of additional packages (see the file for these, and the specific manuals for their use), plus some short-hand (see below), plus some additional classes that are of use in instructional contexts. To download (see below) == General Comments == 1. '''Place all text to go to the slides within FRAMES''' * Example: {{{ \frame{\frametitle{New idea} \bit % begin itemize \item<1-> First point \item<2-> Second point \item<3-> And so on ... \item<3-> etc. \eit }% eof (end of frame) }}} * the standard setting of the lecture class is to 'ignore non frame text' when making the slides (only) which is a very nice feature since we can then write anything we like ''outside'' of a `frame` environment to go to the Lecture Book format, but not the slides * this is often used to write a short introductory comment about the lecture * note: to make a point of some text that is outside of a frame, it is worth using `\noteit{}{}` (see below) since this is a standardised stylistic mode and can be emphasised just a little more than simple non frame text 2. '''Constantly think 'what class is this text?' ''' * by setting text inside different class declarations (like the ones below), one can obtain attractive, consistent formatting. * moreover, if, at a later date, one wishes to increase (say) the size of the white area for working under the problem in the example class, this can be achieved ''once'' (in `main.style`) and all changes will flow through wherever `\solveit{}{}{}` is used. 3. '''Don't be afraid to tinker with the classes''' * by inspecting `main.style` one will see that many 'classes' are not very complexly defined, and will yield to simple manipulation. * however, if editing, it would be wise to always keep a copy of the ''original'' class definition incase you wish to revert to it (in LaTeX this is simply accomplished by commenting out the unwanted portion) == Lecture Classes == === Variations on the Block class === The following use the standard 'block' class, which has a header area and a text box below. They vary in that they have quite different outcomes whether in the Slides or Lecture Book (article) version. '''Definitions/Theorems''' * ''Purpose'': to set down a standard definition (e.g. theorem, proposition, definition) that students will be prompted to focus on. * ''Code:'' {{{ \defit{}{} }}} * ''Example:'' {{{ \defit{The fundamental theorem of first-year}{% The amount of work $w$ per week completed by a stanard first year student, as a function of the time to go in the session $t$ is related: \[ w \alpha \frac{1}{t} \] }% defit. }}} '''Worked Examples''' * ''Purpose:'' to set problems that exemplify a point in the lecture content. Students gain space to work with in their lecture books. The answer is hidden from the lecture book, but shown (possibly sequentially) on the slides. * ''Code:'' {{{ \solveit{}{}{} }}} * ''Example:'' {{{ \solveit{A summation problem}{% Prove that the sum of 1 + 2 + 3 + ... + 98 + 99 is 4950.}{% \vis<1->{Noticing that 1 + 99 = 100, and that 2 + 98 = 100,} \vis<2->{we know that there are 49 such pairs (up to 49 + 51) and one other number (50)} \vis<3->{which gives us (49 x 100) + 50 = 4950.} }% sol }}} Notice the use of `\vis{}` which is short-hand for `\visible{stuff}` and will make the given text ('stuff') taken into account during processing, but not show it until the Xth click of the mouse. In this case, each line of the proof will appear 1 at a time. The dash in `1-` and so means to keep that material visible from the first click until forever. '''Danger, Will Robinson!''' * ''Purpose:'' to bring attention to often made mistakes, or likely, but wrong, intuition. * ''Code:'' {{{ \alertit{}{} }}} * ''Example:'' {{{ \alertit{Fundamental Theorem Reprise}{% The Fundamental Theorem of first-year is so named since it applies universally, although at differing intensities!!!} }}} '''Extra Notes box''' * ''Purpose:'' to add text and explanation to the Lecture Book which will not appear in the slides, but is not simply introductory material etc. This kind of box can be very useful to place a further reflection on a topic, or a clarification of a caution box that may not be covered in the lecture, and might not be picked up with significance by a student reading the text. * ''Code:'' {{{ \noteit{}{} }}} * ''Example:'' {{{ \noteit{Further notes on Convexity and Concavity}{% Whilst in our course (primariliy due to the language of the text) we do talk about `concave-up` and `concave-down` when implying the 'smiley' and 'frown' faced curve respectively, more generally ... ... (etc.)} }}} '''Keywords''' * ''Purpose:'' to emphasise the first introduction of a key topic or piece of language; the text receives emphasis in both the slide and lecture book versions, and will also have an entry placed in the Index at the back of the lecture book (automatically). * ''Code:'' {{{ \key{} }}} * ''Example:'' {{{ Whereas we have previously been dealing only with \emph{scalar} algebra, in this lecture, we shall introduce the concept of \key{matrix algebra}, otherwise known (for reasons that will become immediately apparent) as \key{linear algebra} ... }}} == Miscellaneous == '''Final Solution Marker''' * useful for indicating the final solution within a \solveit command * simply turns the answer blue {{{ \sol{} }}} * Example: {{{ \[ S = A(1+r)^{n} = \$12,000 (1+0.02)^{25} = \sol{\$19,687.27} \] }}} '''Chapter reference marker''' * to be used often to point students to the text * creates a box in the margin with a 'book' icon and the text ref. {{{ \chap{} }}} '''Student work required''' * used to indicate that an axis has been left blank intentionally, and that the student should fill something in. * adds a 'pencil' icon in the margin * nb: already part of the `\solveit` class {{{ \fillin }}} * Example {{{ \boxmat{1}{3}{% \includegraphics[width=0.5\textwidth]{../05/pics/myplot.eps}}\fillin }% boxmat }}} === Graphics === '''To import a picture with a white background (especially Matlab plots)''' * puts the graphics inside a white box, with a small margin and a border {{{ \boxmat{}{}{} }}} * Example: {{{ \boxmat{2}{5}{% \includegraphics[scale=1]{mypic.eps} }% box mat }}} '''For putting a picture in columns''' * when placing an image in `beamer` in the columns mode it is useful to get the picture to be centred in the notes * this code achieves this {{{ \newcommand{\colput}[1]{% \mode
{% \begin{center} #1 \end{center}} \mode{#1} }% }}} * Example {{{ \bco % shorthand for begin/end column \column % text on the left-hand column \ben \item Here's the first point \item And the second about the picture \item Which is located on the right \een \column % picture on the right-hand column \colput{% \includegraphics{myic.eps} }% colput \eco }}} '''Plotting functions on axis''' * should refer to the `pst-plot` reference manual for the full usage/explanation .. a ''very'' powerful set of tools (see Refs below) * here, this is for standardized plotting axis for all `pst-plot` type axis {{{ % Plotting \psset{gridlabels=7pt,% gridlabelcolor=gridmain,% gridcolor=gridmain,% subgridcolor=gridminor} \newcommand{\axesit}[3]{% \psaxes[linecolor=axes]{-}% (#1)(#2)(#3) % (x-origin,y-origin)(x1,y1)(x2,y2) } }}} * Example: {{{ \begin{pspicture}(-1,-1)(1,1) \axesit{0,0}{-1,-1}{1,1} \psplot{-0.5}{0.5}{x 3 exp x sub} \end{pspicture} }}} ''makes an axis with origin at (0,0), with x-domain (-1,1) and y-domain (-1,1) and plots the function $x^3 - x$ on the domain (-0.5,0.5)'' * notes: `\psplot` uses ''reverse polish'' notation (or ''postfix'') .. see Refs. === Advanced === See the file for advanced options to quickly draw probability trees etc. == Short-hand == '''Faster typing of environments''' {{{ \def\vis{\visible} \def\adj{\text{adj}} \def\ben{\begin{enumerate}} \def\een{\end{enumerate}} \def\bde{\begin{description}} \def\ede{\end{description}} \def\beq{\begin{equation}} \def\eeq{\end{equation}} \def\bea{\begin{eqnarray*}} \def\eea{\end{eqnarray*}} \def\bit{\begin{itemize}} \def\ben{\begin{enumerate}} \def\een{\end{enumerate}} \def\eit{\end{itemize}} \def\lra{\longrightarrow} \def\bce{\begin{center}} \def\ece{\end{center}} \def\bco{\begin{columns}} \def\eco{\end{columns}} \def\bqu{\begin{quote}} \def\equ{\end{quote}} \def\btb{\begin{tabular}} \def\etb{\end{tabular}} \def\bma{\begin{bmatrix}} \def\ema{\end{bmatrix}} \def\bdm{\begin{vmatrix}} \def\edm{\end{vmatrix}} \def\bqu{\begin{quote}} \def\equ{\end{quote}} }}} '''Miscellaneous''' {{{ \def\mbf{\mathbf} \def\thf{\therefore \quad} \def\la{\leftarrow} \def\ra{\rightarrow} \def\lra{\leftrightarrow} \def\imp{\Rightarrow} \def\trans{^{\intercal}} \def\inv{^{-1}} \def\half{\frac{1}{2}} }}} '''Matrices''' {{{ \def\xa{{\color{blue}p_{1} } } \def\xb{{\color{blue}p_{2} } } \def\xc{{\color{blue}p_{3} } } \def\AA{\mathbf{A}} \def\BB{\mathbf{B}} \def\CC{\mathbf{C}} \def\DD{\mathbf{D}} \def\UU{\mathbf{U}} \def\LL{\mathbf{L}} \def\II{\mathbf{I}} \def\OO{\mathbf{0}} \def\XX{\mathbf{X}} \def\AT{\mathbf{A}^{\intercal}} \def\BT{\mathbf{B}^{\intercal}} \def\CT{\mathbf{C}^{\intercal}} \def\xx{\mathbf{x}} \def\yy{\mathbf{y}} \def\aa{\mathbf{a}} }}} '''Calculus''' {{{ \def\Dx{\Delta x} \def\Dy{\Delta y} \def\dx{\,\, \text{dx}} \def\dy{\,\, \text{dy}} \def\dz{\,\, \text{dz}} \def\du{\,\, \text{du}} \def\dt{\,\, \text{dt}} \def\dN{\,\, \text{dN}} \def\over{\bigg ]} \def\d{\delta} }}} = Setting up the Lecture-system Scripts = == To install == Here we assume that the user is working on either 1. A native `Linux` system; or 2. A Windows PC with `cygwin` installed (see InSilico/LinuxOnWindows for info on this). '''In Windows''' 1. Install `cygwin` as per instructions elsewhere, making sure that a `c-shell` is installed. To check this, type {{{ which csh }}} at the Linux prompt. One should receive a reply such as `/bin/csh` if all is OK. 2. Next, within the `My Computer` application, or similar, find out where the Cygwin apparatus has been installed. (start at C:) 3. Within this, navigate to: `/usr/bin/` and move the `latex-beamer-scripts.zip` file there, unpacking it (right-click with the mouse and select `unzip`). 4. Open up a `cygwin` terminal prompt (by using the shortcut on the desktop) and check that you can find the tools. For example: {{{ which btex }}} at the Linux prompt should return something like {{{ /usr/bin/btex }}} '''In Linux''' 1. Simply unpack the scripts into a folder currently on the path. For example, I place such scripts in a new folder called `/usr/local/tools/` so that I know what is mine so I would type: {{{ % mv latex-beamer-scripts.zip /usr/local/tools/ % cd /usr/local/tools/ % unzip latex-beamer-scripts.zip }}} 2. Check that these are on the path, for example: {{{ % cd home % which btex /usr/local/tools/btex # should be returned }}} == To run == In the `/slides` folder of your lecture hierarchy, e.g. {{{ 01/ |-01.tex 02/ |-02.tex 03/ |-03.tex slides/ |-Beamer01.pdf |-Beamer02.pdf ... book/ |-book.ps |-book.pdf ... }}} simply type `btex XX` at the linux prompt where `XX` is the lecture to generate slides for: {{{ % btex 03 }}} '''Modes of operation: Slides''' The standard mode is 'fast' which runs `latex`, `dvips` and `ps2pdf` once in series. This will thus create a .pdf (`Beamer03.pdf` in our example) which will have most things, but not fancy stuff like the navigation structure etc. To obtain these, one would type {{{ % btex f 03 }}} to run it in 'final' mode, this runs `latex` three times to get everything right, before passing it to `dvips` and `ps2pdf`. If things are going badly, then one can run things in 'safe' mode -- which ''doesn't'' use the 'batchmode' latex feature (as the others do) and so spews out all the processing log into the active window, this will help greatly for bug-finding. Example: {{{ % btex s 03 }}} For one-off creation of the lecture-book style, but just as standalone articles, one can use `ltex` in every place where `btex` was used above. Example {{{ % ltex s 03 }}} Finally, there is an 'accessibility' mode, which uses the `extarticle` format for the Lecture book (only, not the slides) and so is good for vision impaired students: {{{ % ltex a 03 }}} '''Modes of operation: Lecture Book''' To create the full-blown lecture book is a little more taxing, since we need to chop off the top and tails of each of the .tex documents, concatenate them all into one contiguous document, and then run `latex` as appropriate over the whole thing. To achieve the first jobs, we actually use the inbuilt `sed` program from Linux. It is standard in either a base `linux` installation, or in `cygwin`. Normally, within the `/book` folder, to generate the Lecture Book style with the first two lectures: {{{ % bookit 01 02 }}} will generate `book.pdf` in the current folder. Again, one can use {{{ % bookit a 01 02 }}} to generate the 'accessibility' mode version of the book (larger fonts). To generate a Lecture Book with all lectures within, one needs to list them all: {{{ % bookit 01 02 03 ... 22 23 24 }}} or, since this is quite tedious, one can use the short-cut: {{{ % bookall }}} which currently will run `bookit` on lectures 01 ... 24. Or alternatively, {{{ % bookall a }}} to do them all in 'accessibility' mode. Should the number of lectures change, then simply open a text editor, and edit the file `/usr/local/tools/bookall` (for an example path). == Special Script: Worked Examples == '''Download:''' [attachment:solveit-files.zip solveit files (.zip)] As opposed to the scripts above, to obtain a listing of worked examples (i.e. extract only the `\solveit{}{}{}` sections of each lecture) and place these in one file, we need to do some more intensive string manipulation. To achieve this, a set of MATLAB functions are provided: 1. `solveit.m` -- main calling function 2. `get_tex.m` -- helper function that does the hard work 3. `int2strL.m` -- helper function to get lecture numbers as '01', '02' etc. (rather than '1', '2'); To use them, we do something slightly different. All functions should be in the same folder, together with (editable) header and footer information: 1. `solveit.head` (or `solveit-a.head` for accessibility mode) 2. `solveit.foot` (or `solveit-a.foot`) 3. `introduction.tex` (introductory script) A README is supplied within the folder. However, one should have a directory system such as: {{{ 01/ |- 01.tex 02/ |- 02.tex styles/ |- main.style solveit/ |- solveit.m |- solveit.head |- solveit.foot |- introduction.tex ... |- README}}} '''To RUN Solveit.m''' 1. (Install and) Open MATLAB; 2. Navigate to `lectures/solveit/` from within MATLAB: {{{>> cd path/to/solveit/}}} 3. At the MATLAB prompt run one of {{{ >> solveit(2:23) % standard >> solveit([2 4 5 7 21]) % a selection is fine >> solveit([2:15 18],1) % turns 'on' accessibility mode (large fonts, single column)}}} 4. This will produce the file `solve.tex` which should have all of the `\solveit{}{}{}` arguments from each lecture file in one place. To produce the .pdf one would then need to run `latex` (probably twice), then get the resultant `.dvi` file to become a `.pdf`. * On Linux this would be: {{{ % latex solve.tex % latex solve.tex % dvips -o solve.ps solve.dvi % ps2pdf solve.ps}}} * Via `WinEDT` this would be to use the 'latex' button (twice), then the 'dvi -> ps' button, then the 'ps -> pdf' button. === Bugs === 1. '''When I run `solveit.m` it says ''Didn't find an instance of \solveit in #15..'' ''' * this just means that there was no `\solveit{}{}{}` used in lecture number 15 2. '''When I run `latex` on `solve.tex` I get an error part-way through ...''' * this is some kind of formatting problem in the ''original'' .tex file .. most of these can be overcome by just typing 'r' at the prompt (if you are from the command line) .. or WinEDT will probably let you just go straight through. * if you want to avoid this, you could use ''batchmode'' .. which steamrolls through any of these 'minor' problems {{{% latex -interaction=batchmode solve.tex}}} 3. '''My file includes instances of `solveit{}{}{}` that I thought I commented out in the original .tex file!''' * This is a bug introduced in the conversion from the (old) Linux based script to the current current MATLAB only version there is no simple way to ''not'' reproduce instances of `\solveit{}{}{}` that are actually commented out in the original lecture .tex file. This is a potential problem if you are updating and keeping 'old' text in comment form .. so be aware of this. = Files = 1. [attachment:main.style-v071213-1.tex main.style (.tex)] * rename to `main.style` 2. [attachment:latex-beamer-scripts.zip Latex Beamer scripts (.zip)] = Refs = 1. [attachment:angus-LaTeX-Beamer-paper.pdf In-depth paper by Angus] on the educational philosophy behind the LaTeX-Beamer system 2. [attachment:pst-plot.pdf Pst-tricks pst-plot manual] 3. [http://en.wikipedia.org/wiki/Reverse_polish Reverse Polish (postfix) notation at Wikipedia] 4. [http://www.online-utility.org/image_converter.jsp Online converter of any pic format to .eps] ---- CategoryInSilico