If you're typesetting mathematics and you're using anything other than \(\LaTeX\) then you're probably doing it wrong; it's (arguably) the best and most widely used option available. I use this space to house some useful templates and samples.

Tug 2014 Talk

The TUG 2014 conference took place from July 28 to July 30. On Wednesday, July 30 I gave a talk entitled \(\LaTeX\) in the Classroom which was (loosely) based on my talk from January. The documents involved in that presentation can be found here:

  • I used a beamer presentation as the basis for the talk. The presentation itself and the source code are both available. A recording of the entire presentation is also available for download but it is very large (200mb in .mov format) and that link will not be permanent.
  • We looked at two examples during the talk. The source code for both the sample homework and the sample exam are available but, as discussed, they will not work without a copy of sample_preamble.tex in the same directory as both files.
  • Reference was made to a packet that contains this information; this is the same packet that I used in January's Undergraduate Teaching Seminar talk. You can download the packet and the source code. The source code calls a file called cat.jpg; however, great care was taken to ensure that the file will compile even without that image.
  • Reference was also made to my "precalculus" textbook. You may be able to find a copy somewhere else on this site, but if you would like access to that document then please email me.

Undergraduate Teaching Seminar Talk

On Tuesday, January 28, 2014, I gave a talk in the Undergraduate Teaching Seminar about the use of \(\LaTeX\) as a math teacher. I gave a handout and presented several examples. Those documents are presented here:

  • I used a handout that you can download in .pdf form. The source code of the handout is also available to download in .tex form. The source code also references an image which you can download in .jpg form (it is important that the file be named "cat.jpg"), however the source code has been carefully constructed so that it will compile without the image. Be sure to read the beginning of the source code for instructions on how to compile it.
  • The first example that we examined was a sample quiz. Here is the source code and the rendered document.
  • The second example that we examined contained several images created by tikz. Here is the source code and the rendered document.

Useful Links

Installing and using \(\LaTeX\) should be easy. Here are some links to help.

Useful Templates

I have gotten several requests for the source files of various documents that I have made in the past. I will usually post those things here. Note: None of these documents require shawn.sty.

  1. Homework Template: preview or download

    My homework template makes very long documents but they are clear and it is easy to locate things within them. When you open the .tex file it will contain detailed instructions on how to structure the document for your needs.

    My template is patched together using a lot of code that I have shamelessly stolen from other templates and examples. If you are the writer of one of those things and this upsets you, feel free to send me an angry email and I will cite you.
  2. Sample Analysis Homework: preview or download

    This document has the same structure as the homework template above but it is a working example of one of my actual homework assignments rather than a template with filler text; some people have requested this in the past.
  3. Sample Exams: preview (test1, test2, test3) or download (test1, test2, test3)

    These are sample exams from a Business Calculus class that I taught in 2011.
  4. Beamer Example: preview or download

    Beamer is the extension of \(\LaTeX\) which creates slide show presentations. Beamer is extremely easy to use and creates excellent presentations in .pdf format. The example I provided is the slide show I used for my thesis defense at the University of Akron.

Shawn.sty

I have several .tex files available for download and except for the templates below, they all contain the following line:

... \usepackage{shawn} ...

The file shawn.sty is a package where I keep all of the shortcuts that I use throughout my documents, as well as some other helpful things. Obviously shawn.sty won't be on any other user's computer but if you comment out the line that imports it then there will be all sorts of unrecognized commands.

The solution is to download shawn.sty. If you put the package in the same folder as a .tex file then you should be able to use the above \usepackage command in that .tex file like normal. The second option is to install shawn.sty on your machine as explained below.

In my package I define several things that are simply shortcuts. For example, I get tired of typing $\textrm{GL}_n\!\left(q\right)$ over and over so I have a \glg command defined so that $\glg{n}{q}$ produces \(\textrm{GL}_n\!\left(q\right)\). I also have several things which produce useful symbols or typesetting which do not have pre-defined commands. For example, \[\sum_{i=1}^n \displaystyle \frac{\displaystyle \int_a^b f_i\!\left(x\right) \, dx}{\displaystyle \int_a^b g_i\!\left(x\right) \, dx}\] looks a little silly so I have a \BIG command which allows the summation symbol to get larger. My package also contains several useful theorem environments which I think look better than the standard theorem environments.

How to Use a Custom Package

The first step in using a custom package is actually obtaining a custom package. There are useful packages available for download but it is also often useful to create your own package. If you've got a long list of custom commands that you copy and paste into your preamble every time you make a new document then it might be time to make a custom package took keep all those commands in one place.

I'm going to go through how to make a package called MyPackage. Start by creating a new file entitled MyPackage.sty; the .sty file extension is important. Then use your standard \(\LaTeX\) editor to open the file. You can put any commands you'd like in your package but the very first line in the file must be the following:

\ProvidesPackage{MyPackage}

While not strictly required, it is important that the name of the package be the same as the name of the file (without the extension) so that error reports regarding the package will be intelligible. Many of the things that can be done in a preamble can be done in a custom package, but some cannot. For example, you can import other packages, define commands, and make custom theorem environments, but you shouldn't redefine margins and things. If you're going to change counters, change headings, change dimensions, or otherwise alter the structure of the document then you should either do that in the preamble or you should learn about making custom class files which are distinctly different than custom packages.

At this point, the simplest way to use the package is to put MyPackage.sty in the same directory as the .tex file in which you'd like to use it. You can then import the package by putting the line

\usepackage{MyPackage}

into the preamble. This, however, is a poor long-term solution. With this method, a copy of MyPackage.sty needs to be in a directory with every file that uses it and if you decide to edit it later those edits will not apply retroactively unless you edit each and every copy of the file.

A better option is to install custom packages locally on your machine. This is not difficult; it is largely a matter of putting the file in the right location on your drive and running texhash. This allows you to reference the package from any file in any location with a \usepackage command. As a note, once you install the package you can still make future edits without re-running texhash as long as you don't change its directory location.

Installing Packages on Windows

The installation depends largely on the way the specifics of the local installation. The method that I'm going to describe applies only to a MiKTeX installation.

The first step is to place MyPackage.sty in the following directory:
C:\Local TeX Files\tex\latex\misc
It is likely that such a directory does not exist, in which case you will need to create it.

After your package is in the proper directory you must run texhash. First open "Command Prompt;" it can be found in under the "Accessories" menu in "All Programs." If you're unfamiliar with the command prompt, when you open it you should see something resembling the following:

Microsoft Windows [Version 6.1.7601] Copyright <c> 2009 Microsoft Corporation. All rights reserved. C:\Users\UserName>

At this point, all you need to do is type texhash and press enter. The next lines depend on your platform, but my machine's output is displayed below and yours should be similar.

C:\Users\UserName>texhash Creating fndb for user root directory <C:\Users\UserName\AppData\Roaming\MiKTeX\2.9>... Creating fndb for user root directory <C:\Users\UserName\AppData\Local\MiKTeX\2.9>... Creating fndb for user root directory <"C:\Local TeX Files">... Skipping common root directory <C:\ProgramData\MiKTeX\2.9>... Skipping common root directory <"C:\ProgramData\MiKTeX\2.9">... C:\Users\UserName>

Congratulations: you've now installed your package.

Installing Packages on OSX

The installation of the package depends largely on the way the specifics of the local installation of \(\LaTeX\). The method that I'm going to describe applies only to a MacTeX installation. Additionally, certain aspects will vary between different releases of OSX. This was all done on a MacBook Pro with Snow Leopard.

The first step is to place MyPackage.sty in the proper directory. Conventional wisdom suggests that you simply need to put the file in
~/texmf/tex/latex/MyPackage
where ~ refers to your home directory. However, for me it was not quite that simple. On my machine such a package would go in a directory called
/usr/local/texlive/2012/texmf/tex/latex/MyPackage.
It is likely that such a directory does not exist, in which case you will need to create it. Creating that directory and adding a file to it will likely require authentication; this is expected so just type in your password and it will cooperate. Note that usr is distinctly different from Users and from any particular user name. Instead, usr is a directory within the root directory on the drive. Unfortunately, this folder is hidden by default in most recent versions of OSX, so you first have to tell the operating system to show hidden files.

To show hidden files you first open Terminal from the Utilities folder in your Applications menu. At this point you should see something like

Last login: <Some-Date-and-Time> on console <Your-Compurter-Name>:~ username$

and a cursor. Obviously /usr/local/texlive/2012/texmf/tex/latex/, <Your-Compurter-Name>, and username will be replaced with things more applicable to you. You then type the following line

defaults write com.apple.Finder AppleShowAllFiles YES

exactly as you see it above (mind your spacing) and press enter. At this point you should see

Last login: <Some-Date-and-Time> on console <Your-Compurter-Name>:~ username$ defaults write com.apple.Finder AppleShowAllFiles YES <Your-Compurter-Name>:~ username$

with another cursor. Now you can close the terminal or minimize it. The final step in showing hidden files is to relaunch Finder. Click on the apple logo in the far top left of your screen (no matter what program you're currently using) and then click on "Force Quit..." Then select "Finder" from the menu and click "Relaunch;" that should do the job. When you are in a Finder window you should now be able to see many more folders than you could before, including /usr. Make sure you are very careful with these hidden folders as they contain protected operating system files that you shouldn't edit unless you know what you're doing.

Once you have MyPackage.sty in the proper directory, all that is left is to run texhash. Bring up the terminal window again, type

sudo texhash

and press enter. You should then see something like

Last login: <Some-Date-and-Time> on console <Your-Compurter-Name>:~ username$ sudo texhash Password:

which simply asks for you to type in your system password. As you type the characters will not print but this is by design; when you've finished typing your password press enter again and after a few minutes you should see something like the following:

Last login: <Some-Date-and-Time> on console <Your-Compurter-Name>:~ username$ sudo texhash Password: texhash: Updating /usr/local/texlive/2012/../texmf-local/ls-R... texhash: Updating /usr/local/texlive/2012/texmf/ls-R... texhash: Updating /usr/local/texlive/2012/texmf-config/ls-R... texhash: Updating /usr/local/texlive/2012/texmf-dist/ls-R... texhash: Updating /usr/local/texlive/2012/texmf-var/ls-R... texhash: Done. <Your-Compurter-Name>:~ username$

Your directories may be different than mine but the process is not complete until you see the line

<Your-Compurter-Name>:~ username$

again. At this point you can exit the terminal and your package should be fully installed and ready for use.

As a final note, you may wish to hide the protected files again after you've finished the package installation. In that case simply go back to the terminal then type the line

defaults write com.apple.Finder AppleShowAllFiles NO

and press enter.

The equation rendering is handled by MathJax. I've had some trouble getting things to render properly on Internet Explorer. If you're having the same problems then I can help; you can download Google Chrome or Mozilla Firefox and use a real browser.