MATH 640-499 Class 16:
Tuesday, March 23, 1999
More about LaTeX packages

Today's tips

Spacing in LaTeX

To produce a blank line in LaTeX, you can first end the line you are on by the command \\, which is an abbreviation for \newline, and then give the command \vspace{amount}, where amount is the amount of vertical white space desired, measured in one of several available systems of units, for example, \vspace{.25in} for measurement of a quarter inch. The amount of white space can be specified also in centimeters(cm), points(pt) or picas (pc). You can also produce vertical whitespace by inserting a line that contains a blank horizontal box

To start a new page you can use the command \newpage or the command \clearpage, which has the same effect unless there are floating figures waiting to be inserted into the document. The command \clearpage forces the immediate insertion of floating figures that are waiting.

Set-theoretic symbols in LaTeX

If you want to write about set theory, there are some useful symbols in LaTeX that you might want to know about. If you want to say that set A is a subset of set B, you can use the LaTeX code $A \subset B$. Since some people interpret that symbolism as meaning that A is a proper subset of B, you might prefer to use the LaTeX code $A \subseteq B$, which will produce the inclusion symbol with a line under it to indicate that you are leaving open the possibility that your two sets are actually equal.

You may also want to use other set-theoretic symbols such as the membership symbol (a modified Greek letter epsilon) which is produced in math mode by the command \in. The negation of membership (symbolized by a slash through the membership symbol) is produced by the command \notin. Intersection of two sets, A and B, is symbolized by $A \cap B$ and union by $A \cup B$. All of these commands are to be used in math mode.

Using the history list in UNIX

In the tcsh shell, as we pointed out recently, there is a history list, which keeps track of the commands that you have used recently. You should be able to view the history list. To see your last 10 commands, use:
    clam% history 10
We have seen how to use the history list to recall commands by using the up arrow key to step through the list, or using, say, !la to recall the last command that started with la.

I had mentioned that there is some danger with using the ! command completion because you might want to run latex firstfile and instead run latex secondfile. To get around that difficulty, you can look before you leap by typing at the clam% prompt:

   !la:p
Then the command will be displayed for you, and you can use the up arrow key or type !! to run the displayed command.

The syntax for the history reference is:

    !event:words:modifiers
In the example, the event was "la", there was no "words" argument, and the modifier was "p", which "prints" the command without executing ( by "prints", here, one means "displays on the terminal"). Thus, the effect of running the command was to search the history list for the most recent command line that started with the string "la" and simply display that command. What do the terms mean?
event
Here "event" means "command"
words
(Optional)If given, select words from the command, else use all words
modifiers
(Optional)If given, modifies selected words or event
You can run several commands in a row with the same argument. For example, if you review a file, decide to edit it and then want to mail it, you can use the following:
   more some-file-with-a-long-name 
   emacs !$ &
   mail friend < !$
In this example, !$ gives the last argument of the previous command. You could be more specific by using !mo:$ to recall the last argument of the most recent command that started with "mo".

Goals to accomplish during class

  1. Practice searching for information
  2. Practice searching for software
  3. Learn to install and use some LaTeX packages

In-class Activities

Search the Web

Another contest. Find information on each of the following topics as quickly as you can.
  1. Artificial Life
  2. Cryptography
  3. Symbolic Computation

Packages in LaTeX

We have looked briefly at a few LaTeX packages. Today I would like you to spend some more time exploring exercises on use of LaTeX packages.

Exercise 1: Typeset a test file for Philip Hirschhorn's exam package

The goal is to typeset a reasonable facsimile of Dr. Recursive's Calculus Quiz for Math 123.

The Draftcopy Package

The LaTeX online catalogue has a very useful alphabetical index (and a hierarchical index) to help you locate TeX files. You should be able to find information about the draftcopy package there.
NOTE:The file draftcopy.doc has been mistakenly given a MIME type indicating that it is a Microsoft Word document on the server that we accessed. With Netscape on the scivis computers, this caused a problem with the download, because Netscape loads SoftWindows and MS Word when it runs into a Microsoft Word mime type. The easiest way around the problem is just to use FTP for getting the LaTeX packages that we want.

Since it will be convenient to use FTP for getting LaTeX packages, we record once more some of the basic information here for users in the U.S. From a prompt, give the command line

   ftp tug.ctan.org
Give your username as ftp and, for a password, give your email address. The commands dir, cd, pwd work as you would expect from your experience with UNIX systems.

The command for searching for files that contain a given string looks like this:

   quote site index string
where the word "string" is to be replaced by the particular string you want to find, of course. You should get a listing of different paths leading to the first 20 files whose names contain the string you submitted. One thing to watch: the paths don't start from the root directory "/" but from the directory "/tex-archive/", so you first have to change directories to "/tex-archive/" to get to the path. Once you are in the directory "/tex-archive/", you should be able to see the directory that starts the path, and you change to the directory that contains the file you want.

Whatever CTAN site you choose, follow the instructions to download the draftcopy package and get it working. Start by making a directory called "draftcopy", or some such name. You'll need the files draftcopy.ins and draftcopy.doc. Run

    latex draftcopy.ins


Exercise 2: Typeset a test file for the draftcopy package

The file draftcopy-test1.tex should be created by your installation of the package. Run LaTeX on it and hand in the typeset copy with your name on it.

The PicIns package: text flow around boxes

Download the GIF image of a rabbit checking his watch (you can just click the thumbnail picture of the rabbit and use the file menu to save the full size picture), from the Millenium Fulcrum edition of Alice in Wonderland as well as the first few paragraphs of the text, which I have downloaded from Project Gutenberg. Then you should be able to produce a LaTeX document that has a 2 inch by 3 inch version of the rabbit picture embedded in the right margin so that the text flows around the left side of the picture. For that you use the package "PicIns" and the command \parpic. Watch out though for the extraneous character CTRL Z at the end of the file picins.sty (UNIX systems). It must be removed. The documentation file picins.doc is written in German, but there is a short summary of the main features of the package written in English, available as picins.txt.

Exercise 3: Typeset a test file for the PicIns package

PicIns is designed to work with the "graphics" package. That means that you should give the commands
\usepackage[dvips]{graphics}
\usepackage{picins}
in your preamble. The optional argument dvips with the command \usepackage[dvips]{graphics} is not needed on the SUN network, as dvips is the default converter from dvi files to PostScript files on the SUN machines here. However, the SGI network is not set up to use dvips as the default, so you need to specify it if you are working from an SGI machine.

The argument to the \parpic command is supposed to be a LaTeX graphics box. It is not, as you might first guess, just the name of a PostScript file. You can create a latex graphics "box" from a PostScript file by using the command \includegraphics from the graphics package. Without using the savebox command, you must have the \includegraphics command as part of the required argument for \parpic, so your command plus its argument is going to be fairly complicated, especially if you want to rescale your PostScript graphic by using \scalebox (see below for information about using \scalebox).

It's a good idea to start out by using the command \includegraphics{rabbit.ps} (or whatever in place of rabbit.ps) by itself to make sure that it works before using it as the argument of the \parpic command.

The only tricky part for this exercise is creating a suitable PostScript file from the GIF image, and making the correct dimension entries for the parameters in the package. On the SUN servers, such as clam you can use the xv picture editor. On the scivis server the corresponding program, imgworks, does {\em not} convert to PostScript, and we don't yet have a working program on the scivis server to do that conversion.

If your PostScript version does not naturally display at the size you want, then you can use the command \scalebox from the graphics package to match the size of the image to the dimensions that you specify in the \parpic command. The \scalebox command can be used in the argument of the \parpic command with the command \includegraphics{somefile.ps} as the second argument of \scalebox, the first argument of the \scalebox command being the scale factor.

Be sure to specify units of length if you do give dimensions.


Finished?

If you have done all the above activities, and there is still time left, here are some other activities you can do.


Homework for after class

You probably will not have time to start these during class.

  1. Continue to explore a mathematical topic, with a view to using what you find as part of project B.
  2. Revise your list of links to mathematical sites that you think are worth revisiting. Include the list of links either on your very basic Web page or as a separate document linked to that Web page.
  3. Send me an email summary of what you are doing to get started on your project B.

/ Home / Contents /


email to:Martin Karel