HELP LATEX Richard Dallaway April 1991 The University of Sussex Modified at various times, by Aaron Sloman, Richard Dallaway, Alan Jeffrey & others Last update (by A.S.): 10 Feb 2008 This file is also: /bham/doc/help/latex See also http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/ A guide to resources of interest to logicians, philosophers and others using LaTeX to produce papers or presentations, teaching materials, theses or books, and in particular wanting to include logical matter such as natural deduction proofs. (By Peter Smith Faculty of Philosophy, University of Cambridge.) CONTENTS (In Ved use g to go to entry) -- UPDATES -- FOR BEGINNERS -- Introduction -- Why bother with LaTeX? -- Overview -- Structure of a TeX file -- Environments -- Special characters: $ % # & ^ _ \ ~ -- -- Using \verbatim, \verb and \symbol to print special characters -- -- Problems with ">" and "<" -- -- Other special symbols -- Quotation marks -- -- Converting quotes automatically in VED -- Hyphens and dashes -- Lines too long (\sloppy \fussy) -- Paragraphs, spacing and indentation -- Specifying the title for the document -- Running LaTeX -- -- For Sussex COGS users only: -- -- For Birmingham users only: -- -- For all users -- Printing and previewing -- -- Using dvips to convert a .dvi file to postscript -- -- Saving dvips postscript output in a file -- -- Using xdvi to preview a file -- -- Other previewers: pageview and ghostscript/ghostview -- -- Previewing postscript at Sussex -- -- Previewing postscript at Birmingham -- -- Previewing in an xterm window or on a "dumb" terminal -- Using LaTex and the xdvi previewer from VED -- A short example -- -- Running the example file through Latex -- Getting help -- -- Help via email and usenet -- -- -- At Sussex: -- -- -- (tex-users at Sussex) -- -- -- At Birmingham: -- -- -- Via usenet -- -- How to report errors -- Continuing with LaTeX -- A longer example -- Font change commands -- Changing the size of text -- Section and subsection headings (numbered and unnumbered) -- Changing the current page number -- Commonly used environments (quotation, center, etc) -- -- List-Making Environments -- -- Environments with left and right margins increased equally -- -- Others -- Centred text (the "center" environment) -- Changing left and right margins temporarily -- Verbatim text -- Numbered, "bullet", or labelled lists -- -- Bullet lists -- -- Numbered lists -- -- Labelled lists -- -- The "list" environment -- Footnotes -- Using tabs to align text -- Some more details about typing in your text -- -- More details about quotation marks: -- -- Spaces after punctuation: -- Page breaks -- Controlling the format of paragraphs and lists -- Setting your own defaults -- -- Telling LaTeX where to find your .sty files -- -- -- Using TEXINPUTS -- -- -- At Birmingham -- Cross referencing (figure numbers, section numbers, etc) -- Hints for long documents (e.g. theses) -- More about DVIPS -- -- Printing N pages on each a4 page -- -- -- At SUSSEX: -- -- -- At BIRMINGHAM: -- Writing letters in LaTeX -- -- COGS headed letters -- -- ssxlet (Sussex only) -- -- -- Customizing ssxlet for users -- -- -- Customizing ssxlet for schools -- -- Letterheads at Birmingham -- VED Interface to LaTeX -- The "figure" environment -- PostScript figures -- -- Previewing PostScript files -- -- Ways to produce PostScript -- -- Programs that generate Postscript -- -- BoundingBox -- -- Things PSFIG can do -- -- How to center \psfig figures -- -- Notes on using f2ps -- -- Including xwd output in LaTeX files -- -- Masking xwd output -- -- Other pnm facilities -- -- Including Framemaker output in LaTeX -- -- Notes on using fig2dev -- -- Notes on using xfig -- -- Including SunView screen dumps in a LaTeX file. -- -- Notes on including UNIRAS PostScript files -- -- Notes on including PostScript in "seminar.sty" -- Printing large files -- Example of PostScript in LaTeX -- REFERENCES IN LATEX -- -- BIBTEX -- -- -- bibcard - an X based interface for BiBTeX -- -- TIB -- -- Using VED_BIB -- -- BY HAND -- INDEXES -- TRANSPARENCIES (overheads, slides) -- -- SliTeX -- COMMON PROBLEMS -- * How do I prevent unwanted line breaks -- * How do I force a line break or a blank space? -- * How do I double space my document? -- * How do I include a pound sign? -- * I want a bold \pounds {\bf\pounds} but get a bold dollar sign! -- * When I use \ref in \caption I get error messages. -- * What are "moving arguments" and "fragile commands"? -- * How do I get to use fonts other than the default one? -- * I still get page numbers even when I say \pagestyle{empty} -- * How can I print only a few pages instead of the whole LaTeX file? -- -- Using dviselect -- -- Using dvicopy -- * My PostScript figures are rotated 90 degrees on the page. -- * How can I use [such and such] a maths symbol? -- * I don't want a caption in my figures -- * How can I recover my text from a dvi file? -- * How can I get more figures on a page? -- * How can I make latex put a figure where I ask for it? -- * How do I put two figures side-by-side? -- * Is there an easy way to use _ (underscore)? -- * I want a verbatim-style underscore in math mode -- * How do I change the size of the margins? -- * I need blank headers when the page contains only figures -- * I get "Misplaced \omit" errors in in tabular -- * I want a few lines of text in a table -- * I get an overfull vbox message on every page with fancyheadings.sty -- * "Appendices" is in the wrong place on the contents page -- * Bibtex doesn't work with thesis style -- * I want to centre section headings -- * I want to use verbatim in a fbox (or in some other command) -- * I want \subsubsections on the table of contents -- * How can I prevent line breaks in maths mode? -- * I want my own kind of list -- * Roman text as a maths superscript is the wrong size -- * Is there a Unix option to latex to make it run in batchmode? -- * How can I put TeX Fragments into xfig documents? -- Optional styles -- -- Bibliography -- -- -- The APA style theapa.bst theapa.sty -- -- \CITE MACROS: -- -- -- Case changing option for article titles -- -- \CITE OPTIONAL ARGUMENTS: -- -- CHANGING CITATION PUNCTUATIONS: -- -- CHANGING CITATION LABELS: -- -- -- APA SERIATIONS: The "seriate" environment -- -- apalike.bst apalike.sty -- -- chapterbib.sty -- -- citesort.sty -- -- drftcite.sty -- -- cite.sty -- -- named.bst named.sty -- -- Additional .bst files -- -- Trees, charts and graphs -- -- bnf.sty bnf.tex -- -- cd.sty cd-doc.tex -- -- chomsky.sty -- -- TreeTeX.tex l_pic.tex classes.tex tree_doc.tex -- -- flowchart.sty -- -- nnet.tex nnetdemo.tex -- -- Mathematical environments -- Fonts -- -- Choosing font types -- -- Font Scaling: Helvetica and Times -- -- Running headings -- -- Special effects -- -- Pretty boxes -- -- Picture environment -- -- Floats -- -- PostScript -- -- Verbatim -- -- Dirty tricks -- -- Tabular -- -- Footnotes -- -- Fixes -- Further Document styles -- -- seminar.sty -- Generally useful page formatting styles -- -- Date and time -- -- Music -- Beta test styles -- Further reading -- -- Lamport's book -- Email and remote LaTeX help and resources -- -- UK TeX ftp archive -- -- Other local directories at Birmingham -- Help with LaTeX -- Online help via WWW and FTP -- Related documentation -- UPDATES ------------------------------------------------------------ NEW PDF AND GRAPHICS FACILITIES Since this file was originally written a new command has come available for creating PDF files directly from latex files: pdflatex At present there is no ved interface to that, though one may be added later. It should be easy for experiencd Pop-11 programmers to do, by extending the 'ENTER latex' command. There are also new ways of importing graphics into latex file, if your latex file contains, near the top \usepackage{graphicx} you can use the latex command \includegraphics[width=WWWcm,height=HHHcm]{FIGURE} This could replace latex commands of the form: \psfig{figure=../fig/FIGURE.eps,width=WWWcm,height=HHHcm} Use the includgraphics command without a suffix. If you have two files FIGURE.eps and FIGURE.jpg (or .png, or .pdf) with the same image, then the ordinary latex command will use the .eps file and the pdflatex command will use one of the others if available. On unix and linux systems you can use the convert program to create a .eps file from one of the others, or vice versa, e.g. convert image.png image.eps convert image.eps image.png -- FOR BEGINNERS ------------------------------------------------------ Beginners at Birmingham may prefer to start by looking at TEACH LATEX Also /bham/doc/help/latex.teach A tutorial introduction TEACH LATEX.TEX Also /bham/doc/help/latex.tex A tutorial in the form of an editable latex file The latter is a sample latex project report with instructions for running it through latex while in Ved, previewing it, and printing it. This file gives far more detailed information. A partly out of date HTML latex help package is available for reading in a web browser in /bham/doc/latex-help/LaTeX.html with advice on bibtex in /bham/doc/latex-help/BibTeX.html There is also miscellaneous information in /bham/doc/tips/latex.tips -- Introduction ------------------------------------------------------- This document gives an introduction to the main ideas of the LaTeX document preparation system and provides sufficient information for most users to be able to do the most common things, e.g. writing articles, letters, memos, theses, etc. It also includes some hints and tips on commonly occurring problems. It nevertheless should be thought of as very incomplete, and many readers will need to study the published documentation on LaTeX (see below) or consult expert users. (See the information on email helplines below.) The document, designed to be read in VED, but accessible via any online document browser, is a collaborative effort by various people in the School of Cognitive and Computing Sciences at Sussex, and the School of Computer Science at Birmingham. It includes some information on local utilities and startup procedures at Sussex and Birmingham, so not everything described here will work at all sites. Moreover, some things work only at Sussex, some only at Birmingham, as indicated below. In particular, file path names starting "/bham" work only at Birmingham, and others, e.g. starting "/usr/local" or "/local" will work only at Sussex. (At Sussex /usr/local and /local refer to the same directory. The corresponding directory at Birmingham is "/bham", though there are some differences in the structures used.) -- Why bother with LaTeX? --------------------------------------------- LaTeX (pr. lay-tek or lah-tek) is one of many ways to prepare documents on a computer. It is a mark-up language, so you insert formatting commands into your document. You then process the document to produce a file which can be previewed on screen, or printed on a laser printer. LaTeX is built on a program called TeX (although you need not worry about that). It is well supported throughout the academic world. BIBTeX is a program that is used in conjunction with LaTeX to deal with references. You can also include PostScript figures with LaTeX. If you are a heavy maths user, you'll find everything you need in LaTeX (well...). There are other formatters available (e.g., troff, Page Maker, FrameMaker, Interleaf and various Mac software packages). Read the help files (e.g., HELP *RNO for nroff), try them out and see which you feel comfy with. -- Overview ----------------------------------------------------------- LaTeX is a program which reads your document (or "tex" file, because it will be called something like "report.tex") and produces a file ready for printing (called something like "report.dvi"). The output file can be fed into a previewer (e.g. xdvi) for examining on the screen to save wasting paper. The input file contains a mixture of text and formatting commands (as in nroff and troff, though the syntax for the commands is totally different). Commands in LaTeX start with the \ character. For example, \pagebreak will force a newpage (but you shouldn't have to use that command--LaTeX should break up your pages sensibly). Other commands have compulsory arguments. The command \vspace, for instance, can be used to inserting vertical space, but it needs to know how much space. Compulsory arguments are placed in curly braces, so the commands looks like: \vspace{2 in} (for two inches of space). Sometimes you will come across optional arguments for commands, and these are placed between square brackets. For example, LaTeX places a figure wherever it thinks best, but you can (optionally) bias this to placing the figure at the top of the page by saying \begin{figure}[t]. If you want the default behaviour, you leave out the square brackets: \begin{figure}. -- Structure of a TeX file -------------------------------------------- Your file should begin with a line that looks like this: \documentstyle[11pt]{article} The bit in the square brackets is optional. You can identify the size of the text here (e.g., 12pt for twelve point text; the default is 10pt, and the other option is 11pt). The bit in the curly braces identifies the general "style" of the document. Possible styles are: article, letter, book, thesis and report. If you also include "a4" within the square brackets, various page parameters will be set for a4 size paper. Most of the time you'll use: \documentstyle{article} or something like \documentstyle[a4,11pt]{article} You can adjust the article style to your own taste by defining additional style option files (e.g., myveryown.sty), and say: \documentstyle[myveryown]{article} or \documentstyle[myveryown,11pt]{article} In your "sty" file you can define your own macros, or set the default space between paragraphs, etc. See the Lamport book for details. Place the body of your work between: \begin{document} . . . \end{document} That's it. -- Environments ------------------------------------------------------- Text may be broken into separate "environments" delimited by curly braces, i.e. { ...... } where a command specifying the type of environment usually occurs after "{" or by \begin{...} .... \end{...} where the name of the environment goes between the braces. Example 1: to print something in Bold Font use the environment {\bf The text to be printed ....} Example 2: to ensure that several lines are centred on the page \begin{center} %Note the American spelling The first bit of text to be centred\\Another line to be centred \end{center} There are many other commands for changing environments, some to do with the type of font, some to do with the layout of text. There are also commands for indicating section headings, subsection headings, etc. -- Special characters: $ % # & ^ _ \ ~ -------------------------------- There are a number of special characters over which you must take care: $ start and end of mathematical mode (also \( ... \) ) % a comment (everything to the right is ignored) # used for parameters in macros & separates columns in tabular mode ^ precedes a superscript _ precedes a subscript { and } used by Latex to group text \ start of a command ~ non-breakable space If you wish to use any of the above characters apart from ^ \ ~ just put a \ before them (e.g., "\&" produces an "&", and "\_" produces "_"). The other characters are more difficult to handle, as preceding them with "\" has a special interpretation in Latex. \ used to start a Latex command command, \\ indicates a line break. ~ non-breakable space , \~ puts a circumflex over next letter. To make it appear on its own do \~{}, e.g. \~{}xyz will come out as: ~xyz > and < may print in unexpected ways as they are sometimes interpreted as special characters (upside down "?" and "!"). suppress this by using verbatim (explained below) or math mode, e.g. $>$ and $<$ will print as > and < ^ precedes a superscript in Math mode (e.g. $x^y$), and in ordinary text mode \^ inserts a "^" above the following letter. To make it appear on its own, use the same trick as for "~", i.e. x\^{}y will print as x^y -- -- Using \verbatim, \verb and \symbol to print special characters The latex "verbatim" environment and "\verb" (short for verbatim, not a part of speech) command, described in Lamport, can be used to ensure that exactly what you have typed is printed. Follow "\verb" with a delimeter then the characters you want printed, then the delimeter. E.g \verb.~. will print as the ~ character (note the use of "." as opening and closing delimeter there), and \verb;<>; will print as <> (here ";" has been used as the opening and closing delimeter). Another method is to use the ascii code for the character, e.g. \symbol{126} will print the ~ character, and \symbol{94} will print ^. (See HELP ASCII for a full list of codes.) For extended verbatim text over many lines, e.g. simulating typewriter output, use the form: \begin{verbatim} ... \end{verbatim} -- -- Problems with ">" and "<" Depending on the font you use, the characters ">" and "<" may not behave as expected, e.g. sometimes printing as upside down "?" and "!". You can usually get them to appear as desired by switching temporarily to a "teletype" environment, e.g. {\tt -> <>} will print as expected: -> <> Similarly switching to mathematics mode between dollar signs should work e.g. $-> <>$, though a slightly different font will then be used. You will need to experiment to find out what suits your needs. E.g. try $<> + - =>$ Unfortunately you can't use "\verb" in a section heading, though math mode and \symbol should work. -- -- Other special symbols There are numerous special symbols (e.g., accents and things like \copyright and \pounds), all described in the books listed at the end of this file. Exactly which symbols are available will depend on which fonts are available for LaTeX and for the printer you use. -- Quotation marks ---------------------------------------------------- There are a few other typing conventions to remember: Use `` and '' for opening and closing double quotes Use ` and ' for opening and closing single quotes. Use "\," to separate multiple quotation marks as in ``The word is `quote'\,'' An alternative is to group the symbols for LaTeX, as in ``The word is `quote'{''} The " character produces '' in documents, unless you use the Times font or the verbatim environment or the \tt font. -- -- Converting quotes automatically in VED For VED users, there is a command ENTER latex quotes that converts all occurrences of ' and " to ` or '' or `` as appropriate. You may need to use "ENTER diff" on the new file and the original to ensure that only desired changes have been made. (See HELP VED_LATEX) -- Hyphens and dashes ------------------------------------------------- Use --- for a dash between phrases. Use -- to identify numerical ranges (e.g., 1979--1990). use - for compound words, i.e., ordinary hyphens. use \- to tell latex that it can break a word there if it needs to, e.g. manage\-ment -- Lines too long (\sloppy \fussy) ----------------------------------- Sometimes latex produces some lines that are too long and it is hard to get it to break them sensibly either by inserting hyphens or by inserting \linebreak A possible solution is to use the command \sloppy That allows latex to stretch white space, so that if it prevents a line being too long by putting some of it onto the next line, it is willing to stretch spaces on the preceding line. The opposite command, which is in effect by default, is \fussy This sometimes causes lines to be too long. These commands can occur within the text body of the file. -- Paragraphs, spacing and indentation -------------------------------- To start a new paragraph, just leave a blank line in your document. The next line will be indented to indicate the start of a paragraph. Apart from that extra spaces and newlines are ignored by LaTeX (except in a \verbatim environment---see below). You can control paragraph spacing using \parskip and \parindent as described below. LaTeX has its own ideas about how to insert spaces after a period, question mark, exclamation mark or colon. It tries to distinguish cases at the end of a sentence from within sentence uses, using more space after the latter, and sometimes gets it wrong. (You probably won't even notice this, but see Lamport (p.14--15) to find out how to force LaTeX to do the right thing, by using "\ " for a within-sentence space and "\@." or "\@?" to force the end of sentence interpretation.) -- Specifying the title for the document ------------------------------ The \maketitle command produces a title on the first page. In order to specify what should go into it, use the \title, \author and (if necessary) \date commands. For example, immediately after the \begin{document} line you could have: \author{Your name goes here} \title{Your title goes here} \date{October 1990} \maketitle If you leave out the \date entry, today's date will be inserted (generated by the \today command, which can be used anywhere in the text to insert the date of printing). Alternatively you can do your own heading using \begin{center} ... \end{center} as described below. -- Running LaTeX ------------------------------------------------------ -- -- For Sussex COGS users only: Ensure that you have the following in your .login file: source /usr/local/global/TeXlogin # Set up TeX This sets the two environment variables $TEXINPUTS and $TEXFONTS (which tells LaTeX where to find the files it needs). -- -- For Birmingham users only: The following lines can be included in your .login file, or equivalent, to ensure that you are able to use packages associated with LaTeX. source /bham/global/LatexLogin At Birmingham there are now two versions of latex, invoked with different commands. latex209 [essentially equivalent to the old latex], latex2e [The latest version of latex] The "latex" command defaults to the latter. For more information about the setup at Birmingham, browse the directory: /bham/pd/packages/ N.B. Where you see the command "latex" below, you should interpret it as one of "latex209", "latex2e", depending on which version you wish to use. See also HELP VED_LATEX on how to tell the "ENTER latex" command which to use. -- -- For all users Once you have saved your file, you need to run it through the LaTeX program. E.g., to process your document "report.tex", type: unix% latex report (where "unix%" is the prompt from the Shell, not something you type). If you see any errors, you can type "h" to get help, press "x" to exit, or hit return to continue. LaTeX-ing your document will produce a number of files. report.aux (the auxiliary file) will contain various cross-referencing information (e.g., for a table of contents, or figure numbers, or references, etc.) report.dvi is the file you actually print out, after converting it to a format your printer understands. Most commonly "dvips" is used to convert the .dvi file to a postscript file. The .dvi file is also used by the previewer, xdvi. report.log contains logging information recorded by latex report.toc contains information for building a table of contents, if you requested that with the \tableofcontents command. If you do have any cross references, or if you build a table of contents, you will have to run LaTeX a number of times (twice, normally, three times (maybe four!) if you use BIBTeX). LaTeX will tell you this. If you are a VED user, you may find it more convenient to use the ENTER latex command as described in HELP * VED_LATEX -- Printing and previewing -------------------------------------------- LaTeX-ing your document produces a DVI file (e.g., report.dvi). You can preview this using xdvi (see below) or print it using dvips to convert it to postscript. -- -- Using dvips to convert a .dvi file to postscript To print the file you will need a laser printer that accepts postscript output. (see HELP * PRINTERS). [At Birmingham see TEACH * PRINTING ] Suppose you want to use a printer called "spa", to print the file report.dvi. You type: unix% dvips -Pspa report This reads in report.dvi, outputs a stream of postscript and sends it to the printer specified, i.e. spa in this case. Alternatively you can assign the printer name to the $PRINTER unix environment variable in your .login or .cshrc file, e.g. setenv PRINTER spa in which case dvips will not need to be told explicitly which printer to use. I.e. it suffices to type unix% dvips report Note that you don't have to specify the ".dvi" extension when using dvips. (HELP * VED_LATEX/'latex print' shows how to print directly from VED.) -- -- Saving dvips postscript output in a file If you have set the $PRINTER but wish to prevent dvips from sending the output direct to the printer, e.g. because you wish to save the postscript output in a file, then you can use the "-f" flag to tell dvips to behave like a "filter", e.g. unix% dvips -f report.dvi > report.ps or use the "-o" flag to specify the output file unix% dvips -o report.ps report If you have trouble getting the output onto an a4 sheet, you can try using the "-t a4" flag, as in dvips -t a4 report.dvi dvips -t a4 -f report.dvi > report.ps etc. The dvips program takes the LaTeX output file and converts it into a language the printer understands (PostScript). See "man dvips" for more information about options. On some unix systems, instead of using dvips, you use the "-d" flag after the lpr command, to get a .dvi file printed, e.g. lpr -Pspa -d report.dvi The -d option tells the printer that it's getting a LaTeX output file (dvi = device independent, to be converted to a language the printer understands). Saving postscript output is useful if you wish to make the file easy for others to print out later. Many online collections of papers are stored in the form of compressed postscript files. In VED the command "ENTER latex print ps" will cause the postscript to go into a file rather than to the printer. -- -- Using xdvi to preview a file There are several ways to "preview" a file before printing it, i.e. see on the screen what it will look like when printed. This can save you a lot of time, and can also save a lot of paper wasted on wrongly formatted drafts. If you use the X window system, you can preview your dvi file with xdvi. I.e. type unix% xdvi report.dvi & or in VED, while looking at your report.tex file: ENTER xdvi or (at Sussex) unix% xtex report & You can use other flags to control the size, the location, the size of paper assumed, and so on, e.g. unix% xdvi -s 4 -paper a4 -geometry -150-0 report & The "&" after the Unix command makes it run in the background as an X process, so that you can continue using the window in which you run xdvi for other purposes. In particular, you can close the xdvi window (in the usual way -- see HELP * XBEGINNERS), rerun LaTeX and then open the xdvi window. Xdvi will then update itself to display the latest version of your document. Alternatively if the xdvi window is partly covered and you click on its title bar to bring it to the front it will also automatically update its contents if the .dvi file has changed. (For other previewers you may have to explicitly click on "reopen file".) See the "man xdvi" file for all the options. See section below on previewing files with postscript figures included. -- -- Other previewers: pageview and ghostscript/ghostview On suns, you may also be able to use "pageview" on the output of dvips, e.g. dvips -f -t a4 report.dvi | pageview - & (the "-" tells pageview to use its standard input instead of looking for a postscript file). Alternatively create a postscript file, as explaned above, and run pageview on the postscript file pageview report.ps & At some sites the ghostview or gspreview utility is available, which is usually preferred to pageview, as it is more flexible, e.g. At Birmingham: ghostview report.ps & At Sussex gspreview report.ps & Ghostview (or gspreview) provides an interface to "gs" the interpreter for "Ghostscript", a language that is very similar to PostScript. Ghostview and pageview can be used to preview files that include imported figures or images created using postscript (as described below), as these cannot be previewed using xdvi. See MAN * GS and MAN * GHOSTVIEW (Birmingam) or MAN * GSPREVIEW (Sussex) for details. [If you still use SunView, see if one of these is available: texsun, dvisun, dvipage. E.g. unix% texsun report & or unix% dvipage report & ] -- -- Previewing postscript at Sussex To preview PostScript use "gs", the Ghostscript previewer. That is, convert the whole of your document to PostScript: unix% dvips -o report.ps report.dvi and then preview it: unix% gs report.ps See MAN * GS for details. GS is found in /usr/local/gnu/bin. To make it available Sussex COGS users may add the following line to ~/.login source /usr/local/global/GNUlogin # Set up GNU There is an X11 interface to GhostScript called "gspreview". It is much easier to use than "gs". To run: unix% gspreview report.ps See MAN * GSPREVIEW for more details. -- -- Previewing postscript at Birmingham If you have produced a postscript file, you can use ghostview to view it on the screen as it would appear on the printed page, using a command something like unix% ghostview -a4 -magstep -1 .ps & where "a4" indicates the paper size on which the file is intended to be printed, and "-magstep -1" indicates that a reduced magnification should be used, which may be necessary if you wish to see complete pages on the screen. See MAN * ghostview for more information. If you don't wish to create a postscript file, you can feed the output from dvips directly into ghostview, thus dvips -f -t a4 report.dvi | ghostview -a4 -magstep -1 - & (Don't forget the "-" before the "&"). You may be able to use pageview instead of ghostview. For details see MAN * pageview. -- -- Previewing in an xterm window or on a "dumb" terminal If you are not using a windowing system, you will have to make do with using the "dvi2tty" program to preview your file. This program does its best at displaying the dvi file on a ascii terminal. E.g. dvi2tty report.dvi | more (In VED use the ENTER dvi2tty command, described in HELP VED_LATEX) For information on options available see "man dvi2tty". -- Using LaTex and the xdvi previewer from VED ------------------------ The file HELP * VED_LATEX explains how you can give VED commands to run latex, run the xdvi previewer, and get your file printed. In general this is far more convenient than giving the commands from the Unix shell. [LIB * VED_LATEX is still under development and may change.] -- A short example ---------------------------------------------------- Try out the following by placing the commands into a file called "mytest.tex" % This is the start of the example \documentstyle[a4]{article} \begin{document} \author{Type your name here} \title{My Beautiful Document} \maketitle \section{Introduction} If you can be bothered to type in (or just cut and paste) this example you will learn the basic cycle of events that results in a printed document. \section{Further features} You can divide your document into numbered sections using the command ``\verb.\.section''. \subsection{Subsections} You can also create subsections, and, believe it or not sub-subsections. Here we start a new paragraph. This will be indented, unlike the paragraphs immediately following a section heading. Likewise this paragraph. % This comment, starting with "%" will be ignored \end{document} % That ends the example. The extra blank lines between, say, \begin{document} and \maketitle are just for visual clarity: LaTeX ignores them. Likewise, blank lines could have been left between the \end{document} and the text. Blank lines within the text signal the start of a new paragraph. There are default sizes for paragraph gap, indentation of the first line of a paragraph, top margin, left and right margins, text width, text height, and many others. These can be changed either using "style" files that change them or by extra commands in your document. Some of them are explained below. -- -- Running the example file through Latex From VED you can do ENTER latex, then ENTER latex xdvi, and if you wish to print the file ENTER latex print. Otherwise: If you have saved that file, you can run LaTeX: unix% latex mytest If you get any error messages, you probably mistyped something. Exit LaTeX by typing "x", edit mytest.tex and try latex-ing again. To preview on screen: unix% xdvi mytest & (Using X) unix% dvi2tty mytest (standard terminal output) To print, use one of the formats described above, e.g. unix% dvips mytest.dvi unix% dvips mytest unix% dvips -Pspa mytest unix% dvips -f -t a4 mytest.dvi | lpr or from VED ENTER latex print or ENTER latex print ps To save the postscript in a file. (as described in HELP * VED_LATEX) -- Getting help ------------------------------------------------------- Sooner or later you'll have some kind of problem with LaTeX and not know what to do about it. It might be an error message you can't figure out---even after looking in section 6 of the LaTeX book. It might be that you want to do something special, but don't know how to (even after looking in this file). Here are a few ways to get solutions to any LaTeX problems you may have... -- -- Help via email and usenet -- -- -- At Sussex: Sending mail to "texpert@cogs" will reach a group of local users who are LaTeX experts. You can also, as a last resort, send email questions to "helpline@cogs". The resident LaTeX expert will help you solve your problem. -- -- -- (tex-users at Sussex) Another Sussex email group is the tex-users mail alias. To become a member, send a message to postmaster@cogs asking to be added. tex-users is only for service announcements concerning tex, and is specifically *not* for technical tex queries. Mail "texpert" or "helpline" instead. -- -- -- At Birmingham: There is an email list "latex-users" to which requests for help can be sent. You may find that someone else on the email list knows the answer. Alternatively you can use the "support" program to log a request for help with one of the computer officers. (See MAN SUPPORT) If you would like to join the Birmingham latex-users email list send a message addressed to "majordomo" containin the following line: subscribe latex-users and your name will usually be on the list by the following morning. -- -- -- Via usenet You may also be able to get help by posting to the following usenet groups: uk.tex comp.text.tex comp.lang.postscript For help reading and posting news in VED see at Sussex: HELP * VED_NET, HELP * VED_POSTNEWS at Birmingham: HELP * VED_GN, HELP * VED_POSTNEWS Posting a message to such groups should solve your problems. Many news groups posts out regular (monthly) "frequently asked questions" (FAQ) lists (with solutions). Finally, there is a group in the US that will try and solve really tricky LaTeX problems. Their e-mail address is: LaTeX-help@cs.Stanford.EDU. This is a last resort measure! -- -- How to report errors If you suspect there is a bug in the latex-related software or documentation you should report it, using "helpline" at Sussex, or the "support" command at Birmingham. (At Birmingham: If you think the problem lies with the UMS extensions to latex ("ums" = "user managed systems"), you can send an email message to "ums", or "latex-users".) Please report the error in as clear a fashion as possible, to help whoever has to fix the problem. After explaining the problem, please remember to state where you keep the relevant files and make sure they are readable by everyone. Many messages to texpert just say something like: "I'm using such-and-such a document style and I get such-and-such an error message. Why?" To answer such a question often requires looking at the .tex .aux and .log files. Please make them available. Better still, try to find the smallest .tex file that generates the error and give the location of that file when you report your problem or request help via an email list. -- Continuing with LaTeX -------------------------------------------- Here are a few of the things you can do with LaTeX. This isn't comprehensive, its just to get you started... The \em command switches you to an emphasized font (italics in Roman text, Roman in italic text). You should use { and } to mark the text you want emphasized. E.g., Always remember to {\em match up your braces} will produce (imagine that CAPITALS are italic) Always remember to MATCH UP YOUR BRACES Notice that there is a space after the \em command. This won't introduce extra space into your document. The space is needed to indicate the end of the command to LaTeX -- so LaTeX knows the difference between \em ma (to produce italic "ma") and the command \emma (which doesn't exist). This spacing and bracing applies to all LaTeX commands, not just \em. Curly braces are also used to identify the arguments to a command. For example: \section{Introduction}, where the bit between { and } is the argument to the \section command. A common mistake is to say... blah blah blah \em{this should be in italics} blah blah blah However this will result in everything after "this" being emphasized, not just the phrase between the braces. The \em command does not have any arguments; it just switches to an emphasized font. Hence, to constrain the commands effects it is necessary to place it within a "group" --- that is, place \em inside the braces or an environment. On the other hand, \section DOES expect an argument. The truth is that braces are just a way to group text. Commands like \section just read the next group from you document. Hence, \section Hello world produces The section heading of "H" and the section begins with the text "ello world". However, \section {Hello world} does just what you'd expect it to, i.e., produce a section heading called "Hello world". You'll soon learn which commands have arguments, and which don't. If you wanted your whole document to be in italics, you could say "\em" just after the \begin{document}. Note that if the text is already in italics, "\em" will switch it back to roman. This switch can be nested within braces { .... }. Other font changes are listed later. -- A longer example --------------------------------------------------- To get the hang of LaTeX, it's probably best to try an example file. Many of the features used in this example file are described below. % EXAMPLE.TEX file starts here. % Remember that % marks a comment (up to the end of the line). \documentstyle[11pt]{article} \author{Your Name Goes Here} \title{An Example \LaTeX\ file} If you are using latex209 ("old" latex) you may find it helpful to replace the first line with \documentstyle[a4,11pt]{article} % \LaTex produces the text "LaTeX" % NB: the \ followed by a space in the \title was necessary. If I had % typed "\LaTeX file" the space would have been used up to identify % the end of the "\LaTeX" command, and the output would % have been "LaTeXfile". The "\ " command (that's a backslash % followed by a space) is one way to force LaTeX to leave a space. \begin{document} \maketitle \section{Introduction} You'll notice that the start of sections are not indented. Subsequent paragraphs are (as you'll see in a moment). Don't worry about what your input document looks like (e.g., how many spaces you have between words, or how many new lines). \LaTeX\ will take care of it. There! {\em What did I tell you?} Paragraphs indented. A blank line in the input file starts a paragraph. % \em switches to italics for emphasis between { and } only. Let's have a little bit of gratuitous maths\ldots % \ldots produces "..." in the document. You can't just type ... % because the spacing would be wrong. Trust me. $$ % indicating start of display maths mode \dot w_{ij} = \alpha o_i o_j - \beta w_{ij} $$ % indicating end of display maths mode $$ \sigma_i = \frac{1}{1 + e^{-n_i}} $$ OK, now time for a quote I quite like: \begin{quotation} \LARGE % this change in font size will only be effective % inside this environment Oh dear, now I've made a terrible mess of things. And all I wanted to do was rule the universe. \begin{flushright} % Don't worry about environments within environments (Dr. Zachary Smith) \end{flushright} \end{quotation} I like this quote so much, I centered it: \begin{center} ``It's easier to get forgiveness than permission.'' % Note how to get left and right double quote symbols. \end{center} \section{The end} That's all. Except for a useless statistic: 43\% % (Note the backslash before the %. A common mistake is to leave it out % when giving a percentage, and then wonder what happened to all the % text to the right.) \end{document} Other examples available at most sites /usr/local/lib/tex/inputs/small.tex and: /usr/local/lib/tex/inputs/sample.tex At Birmingham, try these two example files for latex209 (old latex) /bham/pd/packages/tex/inputs/latex209/base/small.tex /bham/pd/packages/tex/inputs/latex209/base/sample.tex At Birmingham these are example files for latex2e (new latex) /bham/pd/packages/tex/inputs/latex2e/base/small2e.tex /bham/pd/packages/tex/inputs/latex2e/base/sample2e.tex % try them NOW! % (Though they may be elsewhere on your machine.) -- Font change commands ----------------------------------------------- \bf bold font \tt typewriter (Some characters are different in this font. For example, the " will produce a "). \rm roman font (default). \sc small capitals font. \sf sans serif font \it italic font \sl slanted font - slanted slightly less than italic. N.B. It is not possible to "pick and mix" these fonts. For example, \bf\em will not produce a bold, italic font. Think of the fonts as real lumps of metal, sitting in a tray (there's no way to take a bold lump of metal and "mix" it with an italic lump of metal.) However, other fonts do exist, but need to be loaded specially (see section on "Common problems"). When switching from italic or slanted font back to Roman, it is sometimes useful to insert a small space to prevent the last slanted character touching the first non-slanted character, or leaving too small a space after a word. Add a small extra space using "\/" as in Surely he {\em did\/}n't? to stop the "d" leaning onto the "n". This is called "italic correction". See also the section on "Optional styles", and the subsection on "fixes". -- Changing the size of text ------------------------------------------ \tiny \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge Notice that LaTeX is case sensitive. N.B. The ordering of a font size change command and a font style change command is important. For example, \large\em produces large, emphasized text, whereas \em\large produced just large text. A size change command resets the font to roman. -- Section and subsection headings (numbered and unnumbered) ---------- You can produce section headings with the \section{Name of section} command. This command numbers the section, whereas \section*{Name of section} does not number the section. You can also use \subsection and \subsubsection. LaTeX also includes \part, \chapter, \paragraph and \subparagraph commands, described in Lamport. -- Changing the current page number ----------------------------------- If you wish to increment or decrement the current page number (after which subsequent pages will follow in sequence) use the format \addtocounter{page}{N} where N should be a positive or negative integer. E.g. to increase by 1, e.g. leaving a gap for something to be inserted: \addtocounter{page}{1} The addtocounter command can be used with other counters, including: part part figure enumi chapter subparagraph table enumii section page footnote enumiii subsection equation mpfootnote enumiv subsubsection Use the format \addtocounter{counter}{value} For more on counters (at Birmingham) see /bham/doc/tips/latex.tips -- Commonly used environments (quotation, center, etc) ---------------- (NB Latex uses the American spelling: "center" not "centre".) There are a number of environments you may need. These are of the form: \begin{environment_name} . . . \end{environment_name} Environments include: quotation --- indents the text center --- note the American spelling flushright --- all text aligned against the right margin flushleft --- text aligned against the left margin abstract --- place after \begin{document} figure --- for figures tabular --- for tables tabbing --- for "tab" stops verbatim --- print text exactly as given (see below) -- -- List-Making Environments These can be used for creating lists of points, e.g. with bullets, or numbers, or labels for each list. All are described further below. itemize enumerate description For these two see Lamport's book: list trivlist -- -- Environments with left and right margins increased equally quote quotation verse -- -- Others You can look these up in the index to Lamport: array math displaymath equation eqnarray table titlepage -- Centred text (the "center" environment) ---------------------------- Here is an example of the use of the "center" environment. \begin{center} All this text will be centred, with LaTeX taking care of exactly how much will fit on one line. However, if I wanted a centred line to end at a particular word I could insert \\ in the middle of the text. This line will also be centred, and this, because of the preceding blank lines. \end{center} -- Changing left and right margins temporarily ------------------------ This section is based on part of the information obtained from this file in the online latex FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?keyword=margin&question=89 You cannot simply change the margins of part of a document within the document by modifying the parameters shown in Lamport's figure C.3. They should only be changed in the preamble of the document, i.e., before the \begin{document} statement. To adjust the margins within a document we define an environment: \newenvironment{changemargin}[2]{% \begin{list}{}{% \setlength{\topsep}{0pt}% \setlength{\leftmargin}{#1}% \setlength{\rightmargin}{#2}% \setlength{\listparindent}{\parindent}% \setlength{\itemindent}{\parindent}% \setlength{\parsep}{\parskip}% }% \item[]}{\end{list}} This environment takes two arguments, and will indent the left and right margins by their values, respectively. Negative values will cause the margins to be narrowed, so \begin{changemargin}{-1cm}{-1cm} narrows the left and right margins by 1cm. To mark the end of the block with changed margins use \end{changemargin} I.e. if you wish to increase text width, make the arguments negative. To decrease textwidth, make them positive. Note that the changes are RELATIVE to the previous setting. -- Verbatim text ------------------------------------------------------ The LaTeX "verbatim" environment and \verb (short for "verbatim", not a part of speech) command, described above, can also be used to ensure that exactly what you have typed is printed. E.g \verb.~. will print as the ~ character (note the use of "." as opening and closing delimiter. The form \begin{verbatim} . . \end{verbatim} can also be used to produce simulated typewriter output going over several lines. (Compare \tt, mentioned above.) See also the section on "verbatim" in "Optional styles", below. -- Numbered, "bullet", or labelled lists ------------------------------ The "enumerate", "itemize" (note the "z"), and "description" environments provide indented lists of points in three different formats. Here's an example: -- -- Bullet lists \begin{itemize} \item this is the first item \item this is the second \end{itemize} The list will be produced with a bullet before each item (a small filled-in circle). -- -- Numbered lists The "enumerate" environment numbers each item. \begin{enumerate} \item this is the first item \item this is the second \end{enumerate} -- -- Labelled lists The "description" environment allows each indented list item to have a bold introductory label \begin{description} \item[First] this is the first item \item[Second] this is the second \end{description} -- -- The "list" environment You can specify your own default label for the beginning of a list, e.g. a large bold letter "o". \begin{list}{\large \bf o}{} \item My very first example. With lots of text following to fill up space and force a line break to see what happens to indentation. \item My second example. With lots of text following to fill up space and force a line break to see what happens to indentation. \end{list} Note that the third group of braces "{}" can contain information to change defaults, set counters, etc., as illustrated in the section below headed "I want my own kind of list". The trivlist environment can be used for embedded list items using the current indentation. These environments can be embedded (to produce sublists). -- Footnotes ---------------------------------------------------------- The \footnote command can be used within text to produce a footnote. It's used "inline," \footnote{By analogy with inline code} as illustrated here. The subsection on "footnotes" in "Optional styles" describes ways in which you can modify the way footnotes appear. -- Using tabs to align text ------------------------------------------- The "tabbing" environment enables the \= command to be used to set tab stops and \> to move to the next tab stop. Use \\ to force the beginning of a new line. A line that ends with \kill (to produce no output) can be used for setting tab stops. \` means everything else on the line should be right justified. E.g. \begin{tabbing} This line \= is used for \= setting \= tab stops \kill first \> second \> third \> fourth\\ one \> two \> three \> four \` last\\ \end{tabbing} The lines starting "first" and "one" will have the words printed in columns at the locations where "is" "setting" and "tab" would have appeared had the line "This line is used for setting tab stops" been printed (which it isn't because of \kill). The word "last" will end flush with the right hand margin. Use the "tabular" environment to draw boxed items, with \hline for drawing horizontal lines, and \vline or | for vertical lines. (For full details see Lamport.) WARNING: you can't include \> or \= within the context of things like {\bf .... } or {\em .... } etc. So if you with to tab a bold line, you have to do, for example: {\bf first bit } \> {\bf second bit} \> {\bf third bit} -- Some more details about typing in your text ------------------------ -- -- More details about quotation marks: Use "\," to separate multiple quotation marks as in ``The word is `quote'\,'' An alternative is to group the symbols for LaTeX, as in ``The word is `quote'{''} The " character produces '' in documents (except in verbatim mode, or if you use the Times font family). -- -- Spaces after punctuation: LaTeX has its own ideas about how to insert spaces after a period, question mark, exclamation mark or colon. It tries to distinguish cases at the end of a sentence from within sentence uses, using more space after the latter, and sometimes gets it wrong. (You probably won't even notice this, but see Lamport (pp. 14--15) to find out how to force LaTeX to do the right thing, by using "\ " for a within-sentence space and "\@." or "\@?" for force the end of sentence interpretation.) -- Page breaks -------------------------------------------------------- A page break (new page) can be forced with the \newpage command, which requires a new page to start (after the current line of text if used within a paragraph). \pagebreak does not force, but "encourages" breaking of a page. It can be followed by [N] where N is an integer from 0 to 4 indicating the strength of encouragement. N = 4 forces a break, and is the default. The \nopagebreak command can be used to discourage LaTeX from breaking a page at the current line, though it is not infallible. The \samepage declaration can be used to prevent automatic page breaks, with an environment. Page breaks are then inserted using \pagebreak. For more detail see section C.11 of Lamport. -- Controlling the format of paragraphs and lists --------------------- You can control spacing between paragraphs and the amount of indentation at each paragraph using the following \parskip AMOUNT e.g. \parskip 0.3cm, \parskip 0.5in, \parskip 20pt specifies the gap between paragraphs \parindent AMOUNT specifies indentation of the first line. You can turn off indentation with: \parindent 0in See Lamport section C.2.2 for more on paragraph style parameters. See Lamport section C.5.3 for controlling the format of itemised lists, using \partopsep, \itemsep, \parsep, \leftmargin, \rightmargin, \listparindent, \itemindent, \labelsep, \labelwidth, -- Setting your own defaults ------------------------------------------ You can adjust the preset styles to your own taste by defining additional style option files (e.g., myveryown.sty), and say: \documentstyle[myveryown]{article} or \documentstyle[myveryown,11pt]{article} In your "sty" file you can define your own macros, or set the default space between paragraphs, etc. For example, the file "myveryown.sty" might be: % MYVERYOWN.STY starts here \parskip=5mm Which when included in the \documentstyle will set the space between paragraphs to be 5mm. -- -- Telling LaTeX where to find your .sty files LaTeX needs to know which directory myveryown.sty is in, so when you log in you should set the appropriate search path in your .login file. -- -- -- Using TEXINPUTS At most sites, except Birmingham the following mechanism works: is in a directory searched by the $TEXINPUTS variable. To find out what $TEXINPUTS is, type: unix% echo $TEXINPUTS You may wish to have a special directory which contains LaTeX things (such as myveryown.sty or whatever you want to call it). If so, add a line like the following into your .login setenv TEXINPUTS $HOME/latexfiles:$TEXINPUTS LaTeX will then look in your directory called "latexfiles" for things like myveryown.sty, before it looks in the the "standard" directories. Be sure that you place the setenv command after the "Set up TeX" commands in your .login See the Lamport book for details on customization. -- -- -- At Birmingham Since January 1996, a new mechanism has been set up at Birmingham. This is still under development. In order to use it you should put the following into your .login file at a location where paths are set up. source /bham/global/LatexLogin People whose directories were first set up prior to 1996 will have a different command in their .login file, something like # source /bham/global/TeXlogin # Set up TeX They should change this to the new form. This makes available two versions of Latex: the older version, known as Latex209, and a new version, known as Latex2e. All the information in this help file relates to Latex209, though some of it may still work with the new version. There are additional latex facilities in the UMS (User Managed Systems) directory at Birmingham. See the README files in the directory: /bham/ums/tex -- Cross referencing (figure numbers, section numbers, etc) ----------- LaTeX generates figure, table, chapter and section numbers for you. You will probably want to refer to these numbers in your document. The command \label{key} associates a name with the last number generated. This number can then be inserted in your document with a \ref{key} command. For example, suppose you have this figure in your document: \begin{figure} \vspace{2in} \caption{This is the caption of my figure.} \label{foo} \end{figure} The \caption command generates the figure number, which is then associted with the key "foo" by the \label command. In your text you can then say... blah blah see figure~\ref{foo} blah blah ...and the correct figure number will be inserted. \pageref{key} command will insert the page number where the \label{key} occured: blah blah see figure~\ref{foo} on page~\pageref{foo} blah blah \label is a general command and will work with anything that produces a number in "the approved way". All of the following produce a number and can be assigned a \label: \part \item (in "enumerate") \chapter \caption (figures and tables) \section equation environment \subsection eqnarray environment \subsubsection \newtheorem macros See Lamport, pages 71 and 72 for details. Note that if you use cross references, you'll have to run LaTeX twice to get the references right. -- Hints for long documents (e.g. theses) ---------------------------- 1. You don't have to put all your text in one file. It is usually convenient to separate your document into chapter size chunks. For example, your thesis might include an introductory chapter, which you might put in "intro.tex" and a chapter on the literature called "lit.tex", etc. You can combine these separate files by using a "root" file (call it thesis.tex or root.tex or main.tex or whatever). It will contain the usual LaTeX "preamble" information (like \documentstyle). E.g., % thesis.tex \documentstyle[11pt]{thesis} \author{ME} \title{Three years, no probation} \maketitle \begin{document} \include{intro} \include{lit} \include{method} . . . \include{results} \include{conclusion} \end{document} Running LaTeX on "thesis.tex" will produce thesis.dvi which contains all your chapters. Note that changes in thesis.tex will propagate through all the included files. For example you might change your bibliography style, or paper size, or switch to double spacing -- and all with a command in the root file. A file which is included starts on a new page. Use \input{file} to just insert the text of file.tex into your root file without a newpage. Sometimes you may be working on just one or two chapters, and won't want to waste time LaTeX-ing and previewing the whole thesis. For example, if you just wanted to look at intro.tex and conclusion.tex you could add the following line just before \begin{document} \includeonly{intro,conclusion} NOTE: a comma between file names, and no spaces. If there is a \includeonly command, an included file will be read only if it is in the \includeonly list. LaTeX calculates page numbers from the last time a file was LaTeX-ed. Hence, if you are working with \includeonly files that have un-included files between them, the page numbers may be wrong. -- More about DVIPS --------------------------------------------------- Dvips (the program you use to print-out LaTeX documents) has lots of useful options: You don't have to specify the printer (-P option) every time you use dvips. By default, dvips prints on the device named in the environment variable $PRINTER. You can see what this is set to by typing the following: unix% echo $PRINTER You may find it useful to set $PRINTER in your .cshrc or .login file. E.g. if you mostly print on printer "spb", you could add the following line to ~/.cshrc or ~/.login: setenv PRINTER spb Now you can just say "dvips filename" to print to spb. Specifying the -P option overrides the setting of $PRINTER. Incidentally, many programs look to $PRINTER for the default printer, including lpr and lpq. dvips recognizes the following options (and many others...see MAN * DVIPS) -c num Generate num copies of every page -p num The first page to print. -l num The last page to be printed. -n num Print at most num pages. -r Print the pages in reverse order. If you want the PostScript output from dvips to go to a file, you can use the -f "run as a filter" option: unix% dvips -f report.dvi > report.ps or use the -o "output to file" option: unix% dvips -o report.ps report.dvi -- -- Printing N pages on each a4 page -------------------------------- -- -- -- At SUSSEX: To print 2 or 4 pages of your document on a single piece of paper use one of the following options to dvips: dvips -Pspa2 prints 2 dvi pages per real page on spa dvips -Pspa4 prints 4 dvi pages per real page on spa dvips -Pspa8 prints 8 dvi pages per real page on spa dvips -Pspa9 prints 9 dvi pages per real page on spa dvips -Pspb2 prints 2 dvi pages per real page on spb dvips -Pspb4 prints 4 dvi pages per real page on spb dvips -Pspb8 prints 8 dvi pages per real page on spb dvips -Pspb9 prints 9 dvi pages per real page on spb These options use Angus Duggan's PSUtils package. See MAN * PSNUP for details. -- -- -- At BIRMINGHAM: If you are a "ums" user you can use psnup as follows: dvips -f -t a4 report.dvi | psnup -2 | lpr to print two pages side by side reduced to half size. If you already have the report.ps file, you can do psnup -2 report.ps | lpr If you are not already a user of "ums" (User Managed System) you can put the following into your .login file: source /bham/global/UMSlogin This will make a collection of additional utilities, supported by users not the systems staff, available to you. -- Writing letters in LaTeX ------------------------------------------- The "article" style is set up to handle things like sections and titles, and all the other kinds of things you need for writing articles. Likewise, the "letter" style can deal with the things you need for writing letters (e.g., addresses). This is described in detail in section 3.8 of the Lamport book. To begin a letter, your LaTeX file must start: \documentstyle{letter} You may wish to add some optional styles to this. For example, \documentstyle[a4,ukdate,12pt]{letter} will produce a letter on a4 paper, in 12pt with a UK-style date (3rd March 1992 rather than March 3, 1992). Next, begin the document and add your address and signature: \begin{document} \address{321 Ship Street,\\Brighton,\\BN2 2TU} \signature{A. Person} or perhaps \signature{A. Person\\Director} Having set these, you can produce any number of letters between separate \begin{letter} ... \end{letter} commands. For example, type: \begin{letter}{Mr B. Goodfriend\\322 Ship Street,\\Brighton} To address the letter to Mr B. Goodfriend. You can then begin the letter with an \opening command... \opening{Dear Bill} ...write your letter, and close with... \closing{Yours} If you like you can add \cc, \ps and \encl lines: \cc{A CC line} \ps(P.S. I forgot to mention...} \encl{List of enclosures} Don't forget to do an \end{letter}, and a \end{document} -- -- COGS headed letters --------------------------------------------- [The next few sections are for Sussex users, up to the line [End of Sussex specific information.] ] -- -- ssxlet (Sussex only) The `ssxlet' document style option modifies the `letter' document style to conform with the guidelines in the Sussex `House Style'. It can be used by saying one of the following: \documentstyle[ssxlet]{letter} \documentstyle[ssxlet,11pt]{letter} \documentstyle[ssxlet,12pt]{letter} It produces a letter suitable for printing on A4 paper. The "University of Sussex at Brighton" crest is addded, along with the COGS address (so you don't have to set \address). In addition to the standard letter commands, you can set: \extension{8765} sets your telephone extension. \faxextension{8888} sets your FAX extension. \username{fredb} sets your user name. \inrefto{Your ref}{123} sets a reference. \printer{spb} sets the printer. In addition to the `letter' environment, there are environments for producing memos and faxes: \begin{memo}{Fred Bloggs\\ COGS} ... \end{memo} \begin{fax}{Jane Doe\\ LFCS}{(031) 123 456} ... \end{fax} The `fax' environment will automatically count the number of pages. This can be overridden by saying: \pagecount{4}{56} which sets the page count of the 4th FAX to 56. The following commands produce compliments slips and business cards: \makecompliments \makecards -- -- -- Customizing ssxlet for users Most users will have some commands they want to use in every letter. For example, all Alan Jeffrey's letters have: \signature{Dr Alan Jeffrey} \name{Alan Jeffrey} \username{alanje} Rather than typing these by hand in every letter, they can be put in a customization file called ssxuser.rc. This file should be put somewhere where LaTeX can read it, for example in the directory which you run LaTeX in, or in a directory in your $TEXINPUT path (for UNIX users). This file can contain any LaTeX commands, not just setting parameters, for example Alan's ssxuser.rc file also contains: \input{psutopia.sty} \raggedright You may wish to customize different environments in different ways. For example, you may wish to leave your signature blank on memos, but not on letters and FAXes. This is acheived with the \everymemo command, for example: \everymemo{\signature{ }} This specifies commands to be executed whenever \begin{memo} is called---in this case setting a blank signature. The following commands are understood: \everycards \everycompliments \everyfax \everyletter \everymemo Users can also use any of the customization commands from the next section, although most won't want to. -- -- -- Customizing ssxlet for schools The ssxlet document style option is designed to be as portable as possible, and should work for any Sussex school. This is acheived by providing another customization file, ssxskule.rc, which should be set up by the local LaTeX wizard. The file ssxskule.rc is a file of LaTeX commands, just like ssxuser.rc. It must contain the following commands: \school{SCHOOL NAME} \building{SCHOOL BUILDING} \postcode{SCHOOL POSTCODE} \hostname{SCHOOL EMAIL HOST} \crest{30mm}{HOW TO PRODUCE A 30MM CREST} \crest{33mm}{HOW TO PRODUCE A 33MM CREST} \crest{35mm}{HOW TO PRODUCE A 35MM CREST} \crest{40mm}{HOW TO PRODUCE A 40MM CREST} \bembo{roman}{viii}{FONT NAME OF 8PT BEMBO ROMAN} \bembo{roman}{ix}{FONT NAME OF 9PT BEMBO ROMAN} \bembo{roman}{x}{FONT NAME OF 10PT BEMBO ROMAN} \bembo{roman}{xi}{FONT NAME OF 11PT BEMBO ROMAN} \bembo{roman}{xii}{FONT NAME OF 12PT BEMBO ROMAN} \bembo{roman}{xiv}{FONT NAME OF 14PT BEMBO ROMAN} \bembo{roman}{xvii}{FONT NAME OF 17PT BEMBO ROMAN} \bembo{bold}{xii}{FONT NAME OF 12PT BEMBO BOLD} \bembo{bold}{xiv}{FONT NAME OF 14PT BEMBO BOLD} \bembo{italic}{viii}{FONT NAME OF 8PT BEMBO ITALIC} \bembo{italic}{ix}{FONT NAME OF 9PT BEMBO ITALIC} \landscape{HOW TO START ROTATING A PAGE BY 90 DEGREES} \endlandscape{HOW TO STOP ROTATING A PAGE BY 90 DEGREES} \newprinter{PRINTERNAME}{COMMANDS SPECIFIC TO THIS PRINTER} In addition, you can set the following if you like, although you probably won't need to: \university{THE NAME OF THE UNIVERSITY} \address{THE ADDRESS OF THE UNIVERSITY} \country{THE NAME OF THE COUNTRY} \stdcode{THE STD CODE} \switchboard{THE NUMBER OF THE SWITCHBOARD} The command \international is a disguise for: \country{UK} \stdcode{+44 273} You can specify additional material at the foot of the page with: \additionalinfo{INFORMATION} For example, to get `{\em Dean of School:} Professor J. Bloggs' as a footer, say: \additionalinfo{Dean of School: Professor J. Bloggs} You can also set the following lengths, using \setlength: LENGTH DEFAULT PURPOSE \paperheight 297mm Height of sheet of paper \paperwidth 210mm Width of sheet of paper \headrulewidth 0mm Height of rule between head and body \headrulesep 1mm Gap above that rule \addressrulesep 1mm Gap below that rule \headsize 33mm Height of the letter and fax header \headwidth 166mm Width of the letter and fax header \memoheadwidth 180mm Width of the memo header \addressanddatewidth 166mm Width of the address and date field \addressanddateheight 35mm Height of the address and date field \headtextsep 35mm Minimum distance from head to body \foldmarklength 0mm Length of the fold marks \foldmarkheight 0.1mm Height of the fold marks (Note that using \international or setting a positive \headrulewidth does NOT conform to the Sussex House Style. These options are provided for upward compatability with previous versions.) [End of Sussex specific information.] -- -- Letterheads at Birmingham The following facility was implemented by Mark Ryan. Detailed, up to date instructions may be found in /bham/ums/tex/inputs/SoCSheading.sty You can start a letter to be printed with the Birmingham crest and School address, as follows \documentstyle[a4,11pt,epsf,SoCSheading]{letter} If you are not a UMS user, it will have to be \documentstyle[a4,11pt,epsf,/bham/ums/tex/inputs/SoCSheading]{letter} Followed by your own variant of the following: \address{\SoCS} \myname{XXX YYY} % put your name here \myemail{XXXXXX @cs.bham.ac.uk} % your email address \mytelephone{414 XXX} % your phone number \myalttelephone{General office: 4773} % (optional) \signature{XXX YYYY} % your signature \raisetextby{10mm} % default is zero. This is used if you have a % long letter that you want to squeeze onto a % single page. \phoneprefix{+44 121} % that is the default. If you prefer % you can change it to (+44)(0)121. \date{DD MMMM YYYY} % defaults to \today %% The next bit controls how much the "footer" of the letter gets %% indented (I.e. yours sincerely etc). The default is more than 10mm \longindentation=10mm \begin{document} \begin{letter}{ Dr.\ Victoria Hughes\\ Administrator for Science Schemes\\ The Nuffield Foundation\\ 28 Bedford Square\\ London WC1B 3EG} \opening{Dear Dr.\ Hughes,} < Body of letter > \closing{Yours sincerely} \end{letter} \end{document} Instead of "11pt" in the first line you can use "12pt" if you'd prefer a slightly larger font. -- VED Interface to LaTeX --------------------------------------------- ved_latex provides convenient commands for driving LaTeX, xdvi and dvips from VED. See HELP * VED_LATEX for details. Examples: latex Write the current file, then run latex on it, and read any output into a temporary VED file. xdvi Run xdvi on the .dvi file, using as arguments the string ved_xdvi_args, which defaults to '-s 4 -paper a4' latex print Print the file, using the command in the string ved_latex_pr_command which defaults to 'dvips -f -t a4 '. latex print ps Converts the .dvi file to a PostScript (.ps) file, which can be previewed with GhostScript. NB this assumes that latex has been run on the current file to create the .dvi file. bibtex Runs bibtex. -- The "figure" environment ------------------------------------------- Blocks of text or other items can be put in a "figure" thus: \begin{figure}[advice] \caption{figure title} \label{fig:myfig} \end{figure} Figures are objects that are not part of the normal text, and are usually "floated" to a convenient place, like the top of a page. Figures will not be split between two pages. The optional argument [advice] specifies where you would like LaTeX to place your figure. There are four forms of advice, which can be combined: h (Here) - where the figure environment appears. t (Top) - at the top of a text page. b (Bottom) - at the bottom of a text page. p (Page of floats) - on a separate float page, with no text, only floats. Sometimes latex ignores your request because of a clash with global settings for textfraction or ther global parameters described below. In that case you can (in Latex2e) insert "!", e.g. \begin{figure}[!h] The standard report and article styles use the default placement tbp. The body of the figure is made up of whatever text, LaTeX commands, etc., you wish. The \caption command allows you to add a caption which will occur after the Figure number. The use of the \label command means that you can later refer to that figure as Figure~\ref{fig:myfig} which will come out in the printed version as something like "Figure 1" or "Figure 2", etc. (See section on cross referencing, above.) -- PostScript figures ----------------------------------------------- You can use various LaTeX commands to draw pictures, but this requires you to work out co-ordinates, etc. (See the section on "pictures" in the Lamport book.) A more general method is to put your figure into PostScript format. PostScript is a language made up of graphic commands. You can create a PostScript file by hand (just like programming: PostScript files are ASCII text files). Or you could use one of the drawing programs (e.g. xfig, described below, or tgif: see MAN * XFIG, MAN * TGIF). Some programs produce PostScript as output (e.g. graphedit, tgif), but some require you to convert their output to PostScript format (e.g. xfig). Once you have a PostScript file, you can use the "psfig" macros to include it in your LaTeX document. First, load the style option: \documentstyle[psfig]{article} or \documentstyle[epsfig]{article} You then simply say something like: \begin{figure} \psfig{file=filename.ps} \caption{This is a postscript figure} \end{figure} to include the PostScript figure, "filename.ps" Run LaTeX and dvips in the usual way, and the figure will be in your document. NOTE: Some of the software described below may be different on different machines. The examples below were tested on a sun4 computer (e.g., rsuna at Sussex), but may not work on other machines. NOTE: instead of "psfig", some people prefer "epsf" for inserting figures. Some of the hints below are for psfig, and some for epsf. -- -- Previewing PostScript files When you use older versions of xdvi (or xtex or texsun) to preview a document which contains a PostScript figure, you will not be able to see the figure on the screen as those programs could cope only with .dvi files, not postscript. However, the latest version of xdvi can cope with postscript files that are referenced in .dvi files produced using psfig or epsf. You may have to ensure that the xdvi command is run in the same directory as the .dvi file and the postscript files, as it may not otherwise find the postscript. (The Ved command "ENTER xdvi" described in HELP VED_LATEX does this automatically.) An alternative to using xdvi is to use dvips after running Latex, in order to create a postscript file, as described above, and then use a postscript previewer. You can use dvips to convert the whole of your document to PostScript, using dvips as described above, e.g.: unix% dvips -o report.ps report.dvi and then preview it, using a previewer, e.g. unix% gspreview report.ps & #at Sussex unix% ghostview report.ps & #at Birmingham See MAN * GS and MAN * GHOSTVIEW (Birmingam) or MAN * GSPREVIEW (Sussex) for details. To make gspreview available at Sussex add the following line to your ~/.login file: source /usr/local/global/GNUlogin # Set up GNU Of course, you could check your file by printing it out, but examining the output by printing the file can be slow and wasteful of paper. Instead you can use one of the other mechanisms described above. -- -- Ways to produce PostScript -------------------------------------- Often you will want to produce figures of various kinds to include with your text. Latex includes some commands for drawing figures, but it is usually more convenient to use figures produced by a drawing program. Alternatively you may wish to save the graphical screen output of some other program to include in a paper. There are several different formats for storing graphical information in a file. If you use a utility that does not produce postscript directly you may be able to convert the output to postscript using some other utility. When you have produced an "encapsulated" postscript file, this can be combined with your latex text source by means of the latex "psfig" command as outlined above. -- -- Programs that generate Postscript Here are some of the programs you can use to produce PostScript code to include with your output from latex: Program Produces... Convert with... xfig fig "export" button tgif PostScript - graphedit PostScript - xgraph PostScript or fig - graph plot psplot FrameMaker ? xwd, then xpr xwd ? xpr screendump rasterfile rash Much of the remainder of this section details how these conversion programs can be used. You can also refer to the manual pages (man) for these programs. -- -- BoundingBox ----------------------------------------------------- LaTeX needs to know which bit of the PostScript figure you want to use. This means including a line near the start of the PostScript file identifying the "bounding box". (Remember: PostScript files are like programs (text); you can edit them.) Some programs, like xfig, include the BoundingBox for you automatically. The bounding box is a line in the PostScript file which looks like this: %%BoundingBox: llx lly urx ury The four numbers (llx, lly, urx, ury) define a box where, (urx,ury) +----------------+ llx is lower-left x | what you want | lly is lower-left y | printed | urx is upper-right x | | ury is upper-right y +----------------+ (llx,lly) If you get a LaTeX error message like... ! \compute@bb: FATAL ERROR: no bounding box supplied (in \psfig) or found (in PostScript file).. ...it means that the BoundingBox was missing. (Note the capitalization of BoundingBox, and the space after, but not before, the colon). If your postscript file does not contain a bounding box, the best you can do is to get a ruler out, measure the area, and type the %%BoundingBox line into the PostScript file by hand. Remember, the BoundingBox is measured in "points", and there are 72 PostScript points to the inch, relative to an origin at the lower left corner of the page. The steps are... 1. Print out your PostScript file (e.g., "lpr -Pspa filename.ps") 2. Measure llx, lly, urx, ury in inches 3. Multiply the measurements by 72 4. Edit your PostScript file and, on the second line (after %!), insert: %%BoundingBox: llx lly urx ury For example, if your PostScript page looks like this... +------------+ | | An A4 page. | | | urx | The *s are the figure you |-------> | want to bound. | * ^ury | *** | | |llx *** | | |--> *** | | | ^ | | | |lly | | | | | | +------------+ ...and suppose you measure the ll and ur distances and find... llx = 1in urx=2.2in lly = 1.5in ury=3.8in ...then, you should add this line (EXACTLY) to the PostScript file: %%BoundingBox: 72 122 158 273 So, the start of the PostScript file might look like this... %! (Already there) %%BoundingBox: 72 122 158 273 (The line you added) %%Title: /tmp/xfig-export005384 (The rest was %%Creator: fig2dev in the file %%CreationDate: Wed Jul 22 19:16:37 1992 already) ...etc NOTE: The first 2 characters must be %! (this identifies the file as a PostScript file) The bounding box will probably need some fine-tuning, but at least it's almost right. A generally useful PostScript/BoundingBox debugging tool is to put a box around the figure: \begin{figure} \fbox{\psfig{file=foo.ps}} \end{figure} The fbox will be based on the bounding box figures, so you can see if one of the coordinates is too large/small by the way in which the figure sits in the box. -- -- Things PSFIG can do --------------------------------------------- The \psfig command accepts other arguments other than just "file=filename.ps". For example... \psfig{file=file.ps,width=2in,angle=72} ...will read the file "file.ps", scales the x and y so that the figure is two inches wide, and rotates the figure 72 degrees. NB. Be sure not to leave any space between arguments to psfig. For example, in \psfig{file=file.ps, width=2in} the width=2in will be ignored. ^ By default, the width and height of the figure are taken from the BoundingBox of the figure. If "width" is specified, the figure is scaled so that it has the specified width. Its height changes proportionately. You can also specify the "height", in which case the figure is scaled so that it has the specified height. Its width changes proportionately. If both "width" and "height" are specified, the figure is scaled accordingly. "rheight" and "rwidth" are the reserved height and width of the figure, i.e., how big TeX actually thinks the figure is. They default to "width" and "height". The "clip" option ensures that no portion of the figure will appear outside its BoundingBox. "clip=" is a switch and takes no value, but the `=' must be present. Outside of \psfig{...} there are other LaTeX commands you can give: \psdraft draws an outline box, but doesn't include the figure in the DVI file. Useful for previewing. \psfull includes the figure in the DVI file (default). \psscalefirst width= or height= specifies the size of the figure before rotation. \psrotatefirst (default) width= or height= specifies the size of the figure after rotation. Asymmetric figures will appear to shrink. You'll probably want to keep all your PostScript figures in one directory. Normally, psfig searches the current directory for figures, but you can change this by saying something like: \psfigurepath{/csuna/home/richardd/psfiles/} Obviously you replace "/csuna/home/richardd/psfiles/" with the full path for your directory. You can find out what this is by using "cd" to move into the directory and then type: unix% pwd Note that \psfigurepath requires the extra "/" at the end of the path. \psfigurepath is only searched when no path information is specified in "file=" and the file is not found in the current directory. -- -- How to center \psfig figures ------------------------------------- To center a \psfig figure, you must turn the results of \psfig into a box. That is, place \mbox{ } around the \psfig{ } command. For example: \begin{figure} \begin{center} \mbox{\psfig{file=foo.ps,width=5cm}} \end{center} \end{figure} If you're going to do this a lot, you might define the following macro: \newcommand{\centerpsfig}[1]% {\begin{center}\mbox{\psfig{#1}}\end{center}} \begin{figure} \centerpsfig{file=foo.ps,width=5cm} \end{figure} -- -- Notes on using f2ps --------------------------------------------- You can convert xfig output ("fig format") to PostScript with either f2ps or fig2dev (see notes on using fig2dev, and notes on using xfig, below). A problem is that f2ps produces strange bounding boxes. The bounding box in a postscript figure defines a box based on the coordinates: lower-x lower-y upper-x upper-y (see the section "BoundingBox", above). f2ps produces bounding boxes in which the lower-y is greater than the upper-y. The effect on paper is a mirror-image, upside-down version of your figure. Quite a nice effect...but probably not the one you want. One solution is to use \psfig's angle command to rotate the figure. A rotation of 360 (yes...360) works, and so does a rotation angle of zero degrees. E.g., \begin{figure} \psfig{file=file.ps,angle=0} \end{figure} You can avoid the problem by using Xfig's Export option (see below). -- -- Including xwd output in LaTeX files "xwd" is a unix program that captures images of an x-window, which can then be converted to PostScript (with "xpr") for inclusion in your LaTeX document. So, anything you can put in an x-window can be included in a LaTeX document. For example, graphs plotted in POP-11 (using, say * RC_GRAPHPLOT) can be dumped with xwd. When converting xwd output to Postscript with the "xpr" command, you must use the "-psfig" option to suppress translation of the PostScript picture to the center of the page. Also note that you may wish to use the -portrait option with xpr, if your figure is rotated 90 degrees on the page. Typical usage will be: unix% xpr -psfig -portrait -dev ps file.xwd > file.ps -- -- Masking xwd output From: Ian Rogers Date: Fri, 20 Sep 91 17:24:22 +0100 > Is there any way to mask a picture grabbed by xwd and processed by xpr > so that you can select a particular portion of the image to be included > in your latex file? See MAN * XWDTOPNM, MAN * PNMCUT, MAN * PNMTOXWD Using this, you'll produce a pipe something like, this, if your printer is called "spa": unix% xwdtopnm dump.xwd | pnmcut x y width height | pnmtoxwd | xpr -Pspa -- -- Other pnm facilities MAN * PNM describes a collection of utilities dealing with "portable anymap file format". The utilieis operate on portable bitmaps, graymaps, and pixmaps, produced by the pbm, pgm, and ppm segments. There is no file format associated with pnm itself. SEE ALSO anytopnm(1), rasttopnm(1), tifftopnm(1), xwdtopnm(1), pnmtops(1), pnmtorast(1), pnmtotiff(1), pnmtoxwd(1), pnmar- ith(1), pnmcat(1), pnmconvol(1), pnmcrop(1), pnmcut(1), pnmdepth(1), pnmenlarge(1), pnmfile(1), pnmflip(1), pnmgamma(1), pnmindex(1), pnminvert(1), pnmmargin(1), pnmnoraw(1), pnmpaste(1), pnmrotate(1), pnmscale(1), pnmshear(1), pnmsmooth(1), pnmtile(1), ppm(5), pgm(5), pbm(5) -- -- Including Framemaker output in LaTeX From: Robert Davidge Date: Fri, 20 Sep 91 20:21:08 +0100 Following Ian Rogers advice about xwdtopnm and pnmcut, I have managed (after a long time) to extract a picture drawn in framemaker using xwd and then shave almost all the framemaker frame from it. This comes about because of the so far impossibility of including framemaker drawings in latex. I must confess that the values for pnmcut are trial and error and do not represent understanding of what is going on. Nor do they completely get rid of the framemaker part but here they are for any frameusers that might want to try. unix% xwdtopnm layout.xwd | pnmcut 110 120 480 580 | pnmtoxwd \ | xpr -device ps -output cut.ps -rv -scale 3 -psfig where layout.xwd is the original grabbed framemaker picture by xwd and cut.ps is the file to be called by the ps-macro in latex. I have used a scale to reduce the picture in cut.ps and in the ps-macro. Without these reductions the file seems to get ignored by dvi2ps. If you regularly use latex, then it would be easier to give up Framemaker! (Try using tgif or xfig for your diagrams.) Further hints: 1. used xwd with -nobdrs option to stop xwd from including the xwindow boarder, and 2. Remove the dotted frame around FrameMaker by selecting and cutting it. -- -- Notes on using fig2dev When converting from fig output using fig2dev, use the -c and -P options and the file should appear with the appropriate amount of surrounding space. I.e., unix% fig2dev -L ps -c -P file.fig file.ps -- -- Notes on using xfig In xfig, you can click on "export" to produce a PostScript version of your figure. However, be sure to select the "pstex" (or "Combined PS/LaTeX (PS part)") format, and not the default "ps". If you don't do this you may end up with an ink blob over your figure. -- -- Including SunView screen dumps in a LaTeX file. The idea is to convert the screendump into PostScript. 1. Assume your have obtained a screendump file called "dump", i.e., unix% screendump > dump 2. Convert to PostScript. Ensure that you have set the following (perhaps in your .login) setenv PL_PATH /usr/local/newsprint alias rash $PL_PATH/pl.$HOST_TYPE/sunras/rash.2ps Convert dump to dump.ps unix% rash -p dump.ps -e -m -s 10cm 15cm < dump -e means Enscapuslated PostScript (suitable for including in documents) -s sets the size of the image (necessary with -e) To find a good set of values for -s, print your original screendump with: unix% lpr -v dump and get a ruler and measure it. NB: "rash" has lots of useful option, like: -i -2 -nxm -s -S -H For scaling -l -c For positioning -R -r For rotation (specify angle) -m Convert colour to 8-bit gray scale 3. Include dump.ps in your LaTeX file using the psfig. E.g., \psfig{file=dump.ps} 4. Run LaTeX as usual, and print with dvips. -- -- Notes on including UNIRAS PostScript files [For Sussex users:] The UNIRAS (and the other unimap, unigraph, etc. packages on solx1) can produce PostScript output (via the HARDCOPY command). These files need to be edited to work within LaTeX. Proceed as follows: 1. When printing HARDCOPY choose the SECTION command and use the mouse to put a tight box round the part to be printed. 2. Edit the UNIRAS Postscript file (default name POST) and remove %%BoundingBox altogether 3. Print the UNIRAS Postscript file. 4. Draw a tight rectangular box around the figure. 5. Measure the (llx,lly) coords of the lower left corner and the (urx,ury) coords of the upper right corner of the box in points (72pts = 1inch). See section on "BoundingBox", above. 6. Include the relevant BoundingBox comment %%BoundingBox: llx lly urx ury 7. Find and delete the word "initgraphics". 8. Near the "initgraphics" remove the "translate" command and its arguments (which will look like: 28 28 translate). 9. Remove the setrgbcolor definition: /c {setrgbcolor} def GhostScript cannot handle the "setrgbcolor" command, so removing it should enable you to preview your document on screen. When this is done the PostScript file may work as normal within LaTeX. -- -- Notes on including PostScript in "seminar.sty" [For Sussex users:] Page 31 of the Seminar User's guide notes that: "At least some versions of the psfig macros do not magnify the dimensions correctly, and are therefore difficult to use with seminar.sty." This seems to be the case at Sussex, so don't use \psfig to include Postscript files in "seminar.sty" (you will find that the scale of the figure is wrong or that \psfig leaves too much space for the figure). The Seminar Users' Guide suggests you use the "epsf" macros for PostScript figures. To do this, add "epsf" to the options of \documentstyle, and include your 7in figure "myfig.ps" with the lines: \setslidelength{\epsfxsize}{7in} \epsffile{myfig.ps} -- Printing large files ----------------------------------------------- Screendumps, and other types of images, tend to make very large files. When printing you may be told that the file is "too large to copy" (the printer will print as much as it can). If this is the case, rlogin to the machine which controls the printer, if you can, and re-print the file using the -s option. (At Sussex, rsunx controls spa, csrp controls spb.) E.g., unix% dvips -o report.ps report unix% lpr -s report.ps By the way, when you are told "too large to copy" the printer will try to print as much as it can. You will probably want to remove the print job with lprm (see MAN * LPRM). -- Example of PostScript in LaTeX ----------------------------------- Just to clarify the above, here's an example you can try out. This example is for capturing a X-windows image using "xwd". ITEMS 2 AND 3 APPLY TO XWD ONLY 1. Create a LaTeX file called test.tex that looks like this: \documentstyle[psfig]{article} \begin{document} This file contains a picture. Here it is: \begin{figure} \psfig{file=picture.ps} \caption{A picture} \end{figure} Some text after the figure. \end{document} 2. Grab xwindow picture with "x window dump" unix% xwd -nobdrs > picture.xwd (The cursor will change to a plus sign. Move the cursor over the window you want to capture and click a mouse button. Any small window will do; try the clock or mailbox.) 3. Convert "xwd" file to PostScript. unix% xpr -psfig -portrait -dev ps < picture.xwd > picture.ps 4. Run latex (should get a message about picture.ps being included) unix% latex test 5. If you have a version of xdvi that can handle inluded postscript files preview thus unix% xdvi -s 4 -paper a4 test & 6. If you wish to see how it looks on paper, print with something like unix% dvips -f -t a4 test | lpr or unix% dvips -Pspb test 7. Alternatively create a postscript file using dvpis and then preview, using one of the previewers mentioned previously, e.g. unix% dvips -o test.ps test unix% ghostview test.ps (at Birmingham) unix% gspreview test.ps (at Sussex) -- REFERENCES IN LATEX ------------------------------------------------ -- -- BIBTEX Your life will be made a lot simpler if from day one you keep all your references in a file (or three). BIBTeX provides a way for you to do this. Entries in a .bib file look like this: @BOOK{maggie, AUTHOR = {M. A. Boden}, TITLE = {Computer Models of Mind}, YEAR = 1988, PUBLISHER = {Cambridge University Press}, ADDRESS = {Cambridge} } There are different categories (e.g., Technical report, article, etc). See the Lamport book for details. (Also, HELP VED_BIB, at Birmingham.) Once you have all your references in one file, you can refer to them by labels (in the example, "maggie"). In your tex file you would say: see \cite{maggie} for details to produce: see [1] for details or see (Boden, 1990) for details depending on which bibliography style you use. (See the section on Optional Styles/ Bibliography). BIBTeX remembers what you have referred to, and builds up a bibliography for you. This way, you can't forget to include a reference to something you have cited. The process of producing a document now becomes: unix% latex report % Finds out what you \cite'd unix% bibtex report % Extracts \cite'd entries from bibliography unix% latex report % Inserts bibliography unix% latex report % Gets cross references right Read the LaTeX book for details. -- -- -- bibcard - an X based interface for BiBTeX For Sussex users: X11 users can search and edit their bibtex databases using a graphical interface called "bibcard". Bibcard presents each bibliographical entry as a "card" in a window. Run by typing: unix% bibcard & or unix% bibcard name_of_bib_file.bib & WARNING: Bibcard will NOT retain the format of existing bib files when re-saved. Be sure to save a back-up of your existing bib files until you are sure bibcard's format suits you. Hints: 1. To begin a new entry, click on EDIT and select ADD. You will be presented with a blank "card" to fill in. You can click on the small buttons marked with an upside-down triangle to get lists of options for some fields (like month, or reference type). 2. Clicking on any field opens an "expanded field" window. This is an Emacs-like editing page, which you may like to use for long titles, or comments. Don't forget to save your file before quitting bibcard Further reading: MAN * BIBCARD -- -- TIB [For Sussex users:] Another way to produce a bibliography is to use "tib". Tib is a preprocessor for TeX to insert citations and make bibliography lists. Unlike BIBTeX, Tib works on the .tex file rather than the .aux file, and as such cannot deal with references occurring over many files. This may make it unusable for producing a thesis. See MAN * TIB -- -- Using VED_BIB [For Birmingham users] See HELP VED_BIB, and LIB VED_BIB. These are available from outside Birmingham via ftp ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/ved_latex/ved_bib ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/ved_latex/ved_bib.p -- -- BY HAND If you just want to type a few references at the end of your document and don't want to mess with the bibliography programs, you can use the following macro: % simple bibliography entries \newcommand{\bibentry}[1]% {\noindent\hangindent=0.5cm\hangafter=1 #1\medskip} Use this in your .tex file as follows: \section{References} \bibentry{Boden, M. A. (1988) {\em Computer Models of Mind.} CUP.} \bibentry{Hofstadter, D. R. (1979) {\em G\"odel, Escher, Bach: An Eternal Golden Braid.} Harvester Press: Brighton, UK} OR use \bibitem as described in the Lamport book. N.B. You'll have to type them in alphabetical order if you want them to be listed in alphabetical order, and you cannot use \cite to refer to them. -- INDEXES ------------------------------------------------------------ To create an index, you do the following: * Include the makeidx document style option. * Put \makeindex in the header of your document. * Put \printindex where you want the index to go. * Put some \index{foo} entries into your document. * Run latex on your document, then say makeindex filename, then run latex again. * Read MAN * MAKEINDEX -- TRANSPARENCIES (overheads, slides) --------------------------------- You can use LaTeX to make transparencies for talks, but you'll probably want to change some of LaTeX's features: you'll at least want a larger sized text, and you'll probably want each page centered vertically on the page. The document style option "seminar" allows you to do this, as does the command "slitex". See the section on "Optional Styles", subsection "Document styles" for details of the (easier to use) seminar package. -- -- SliTeX Appendix A of the Lamport's LaTeX user's guide describes SliTeX. Rather than typing "latex" to format your document, you type "slitex". However, there are lots of restictions on the LaTeX commands you can use. You require a root file, which tells SliTeX which files contain slides. Here's an example root file, root.tex: \documentstyle{slides} \begin{document} \blackandwhite{myslides} \end{document} To process this file, you'd type: unix% slitex root SliTeX will read the file "myslides.tex", which should be black and white slides. (See the Lamport book for details on producing colour slides). Each slide in "myslides.tex" should be between \begin{slide}{} and \end{slide}. The argument to \begin{slide} is used for producing colour slides; for black and white slides it is just {}. -- COMMON PROBLEMS -------------------------------------------------- -- * How do I prevent unwanted line breaks ---------------------------- If you use "~" as a space character, as in "J.~F.~.Kennedy" the space will never be replaced by a line break. Use \mbox to prevent a word, e.g. a procedure name, being hyphenated, as in \mbox{\bf append}. (Note this has nothing to do with the "mbox" file used by unix mail.) You can also use an "end-of-line-comment" indicated by "%" to start a long word on one line and end it on another, without LaTeX inser% ting any space. (Like that, assuming "ting" came at the start of the next line.) -- * How do I force a line break or a blank space? -------------------- To force a line break in the middle of some text use one of \\ \\[AMOUNT] \newline \linebreak[N] Where AMOUNT specifies the amount of vertical space required, e.g. \\[1cm] \\[3.2in] and N specifies the strength of encouragement to break a line. N is an integer from 0 to 4, the latter being strongest, and the default. \nolinebreak[N] can be used to discourage line breaks. For more detail see Lamport section C.11 If you leave blank line in your file, it will force a newline, but will also start a new paragraph, (including indentation of the first line). Use \vspace to force vertical space to be left between portions of text, e.g. \vspace{2.5 in} % 2.5 inches of blank space This requests a space to be left after the current line. If it's within a paragraph, and you don't want to start a new paragraph use either the \\[AMOUNT] format or \vspace with \\ to force a line break followed by blank space, E.g. \vspace{2.5 in}\\ That will be ignored at the top or bottom of a page. Use \vspace* instead to ensure that the space is reserved, even at page boundaries. The verbatim environment can also be used. -- * How do I double space my document? ------------------------------- See section: STYLES/ Generally useful If you really have to, say: \def\baselinestretch{1.5} near the top of your file. Spacing is a complex issue in LaTeX, and I don't really understand it. If you want to have sections of your document single spaced, you have to reset baselinestretch to 1, and then change font size! Here's an environment to produce single spaced (one paragraph) quotations in a double spaced document:- \newenvironment{ssquote}{\begin{quotation}}% {\def\baselinestretch{1}\small\normalsize\end{quotation}} Use it like this: \begin{ssquote} Desi put down the manuscript. She couldn't believe it. Noah had made the Unpronounceable by accident out of a piece of gateau and a giant electric toaster. (Boating for beginners, Jeanette Winterson) \end{ssquote} -- * How do I include a pound sign? ----------------------------------- Use \pounds (followed by a space, which won't be printed). E.g., I think the book costs \pounds 12.99. (see also Optional styles/ fixes) -- * I want a bold \pounds {\bf\pounds} but get a bold dollar sign! --- This is a bug in the new font selection scheme. For the moment, you can get round this by saying: \makeatletter \subst@fontshape{cmr}{bx}{u}{cmr}{m}{u} \makeatother before the \begin{document}. -- * When I use \ref in \caption I get error messages. ---------------- Always put a \protect in front of a \ref in a \caption. I.e., \caption{Figure taken from \protect\ref{maggie}} -- * What are "moving arguments" and "fragile commands"? -------------- From Rainer Schoepf on comp.text.tex "MOVING arguments are nearly always those that are eventually written to a file and read in again later. (There are a few other cases, but the basic problem is the same.) FRAGILE commands are those whose correct expansion depends on the exact circumstances in which it occurs. (Example: everything that scans for an optional argument since it does different things depending on whether this is present or not.) The whole point here is that TeX *always* does a full expansion when it writes something to a file, and that at this point it is almost invariably disastrous to expand fragile commands. There is only one way to avoid that: Process everything to be written to a file in a special way so that writing it has the same effect but does not expand, for example by converting \ref to the five characters \ r e f (space). That's how \protect works: it takes its argument and processes it in such a way. There is, however, another way to do it: apply such special processing automatically to everything that is to be written to a file. Though this is a good idea in the first place, it has one crucial drawback: there are some things that you do want to be left alone, like \thepage which must eventually be replaced by the page number when the writing takes place. This leads to rather complicated constructions; take a look at the definition of \addcontentsline in latex.tex to see what I mean. And here you hit the problem: how do you (the user) control what is to be expanded and what is not? So, you have the choice to insert \protect or not. Of course, the real problem are the cases where you must insert \protect to avoid a crash. And in these cases you may legitimately ask: why? Unless a VERY good reason for the existence of fragility be given, I must consider it a FLAW in LaTeX's design. It is a flaw in LaTeX's design. And it will go away with LaTeX3." -- * How do I get to use fonts other than the default one? ------------ First see the subsection "Fonts", in the section "Optional styles" below. (Search for -- Fonts.) To use fonts other than the standard \em \bf etc., it is necessary to load in the font with the command: \newfont{\ssq}{cmssq8} This loads the 8-point sans serif quotation font (cmssq8) and assigns it to the command \ssq. It is also possible to scale the fonts, i.e., \newfont{\bigssq}{cmssq8 scaled\magstep5} One increase in magstep magnifies the font 1.2 times. magstep0 1000 magstep1 1200 magsetp2 1440 magstep3 1728 magstep4 2074 magstep5 2488 See appendix D of the Buerger book. Fonts are stored in $TEXFONTS, usually set to the directory /usr/local/lib/fonts/texfonts. You can check this directory to see if the font you want exists. E.g., the cmssq8 font is represented by the file cmssq8.tfm -- * I still get page numbers even when I say \pagestyle{empty} ------- \maketitle inserts a page number for page one (undoing any \pagestyle{empty} commands than come before it!) Insert a \thispagestyle{empty} after a \maketitle to overcome this. -- * How can I print only a few pages instead of the whole LaTeX file? There are several different methods. One is to make a reduced version of your .dvi file using dviselect (if available) or dvicopy. Another is to ask dvips to produce a truncated postscript file. These options are described in the next sections. Another is to use psselect (if available) to extract selected pages from a postscript file. -- -- Using dviselect To select in DVI format... [Does not work at Birmingham] unix% dviselect -i inputfile.dvi -o outputfile.dvi n Where n is the page of inputfile.dvi you want and outputfile.dvi will be a file containing just that page. See MAN * DVISELECT for other options for extracting material from dvi files (such as, eg, ranges of pages). (From: Robert Gaizauskas) or -- -- Using dvicopy unix% dvicopy inputfile.dvi outputfile.dvi This program prompts you for "Options". Type: select 6 4 to extract the four pages 6,7,8, and 9. Again, you will be prompted for options. Just hit return (or type in some other pages that you also want to extract). To select in PostScript format... The dvips program will print selected pages and produce a PostScript file. E.g., unix% dvips -o outfile.ps -p 7 -l 14 inputfile Will print pages 7 to 14 from infile.dvi to the PostScript file outfile.ps See section on "More about DVIPS". -- * My PostScript figures are rotated 90 degrees on the page. -------- Some conversion programs (e.g., f2ps) by default produce "landscape" output. If this is not what you want, then you can give the programs an option to specify "portrait" mode. See the man pages for details. E.g., unix% f2ps -P file.fig file.ps or unix% xpr -psfig -portrait -dev ps < file.xwd > file.ps or unix% xpr -portrait -dev ps < file.xwd > file.ps If you are using \psfig you can specify the rotation angle, e.g., \psfig{file=myfig.ps,angle=90} -- * How can I use [such and such] a maths symbol? -------------------- See also the description of stmaryrd.sty in the subsection on "Maths" in the sectiopn on "Optional styles". * HOW DO I GET "END-OF-THEOREM" FILLED BLACK BLOB? \rule{2.5mm}{2.5mm} and if you want it flushed against the right-hand margin \begin{flushright}\rule{2.5mm}{2.5m}\end{flushright} * HOW DO I GET A DOT PRODUCT SYMBOL? [From John Kruschke on comp.text.tex] The following defines the command \dotproduct (place it after \documentstyle) \newcommand{\dotproduct}{\raisebox{.3ex}{\tiny$\bullet$}} * HOW DO I GET THE "LESS THAN OR APPROXIMATELY EQUAL TO" SIGN? The following two commands define the symbols you need, \simgt (greater than) and \simlt (less than): \newcommand{\simgt}% {\,\hbox{\lower0.6ex\hbox{$\sim$}\llap{\raise0.6ex\hbox{$>$}}}\,} \newcommand{\simlt}% {\,\hbox{\lower0.6ex\hbox{$\sim$}\llap{\raise0.6ex\hbox{$<$}}}\,} * HOW DO I GET SYMBOLS FOR "THE REAL NUMBERS"..ETC? See also the description of stmaryrd.sty in the subsection on "Maths" in the section on "Optional styles". [From the FAQ monthly mailing on comp.text.tex] These symbols are known as "blackboard bold" and are available in the recently released AMS fonts "msam" (e.g., "msam10" for 10pt) and "msbm". They replace the older "msxm" and "msym." The fonts have a large number of mathematical symbols to supplement the ones provided by TeX. The fonts are available via anonymous ftp from e-math.ams.com (130.44.1.100) in the directory ./ams/amsfonts. Two files which load the fonts and define the symbols are provided, and both work with either TeX or LaTeX. Additionally a replacement for the old amssymbols.sty file using the new fonts was posted by Tony Li on August 13, 1990, but does not seem to have made it into the major style repositories. Questions or suggestions regarding these fonts should be directed to tech-support@math.ams.com. A set of LaTeX macros for a "lazy person's" blackboard bold are: \newcommand{\R}{{\sf R\hspace*{-0.9ex}\rule{0.15ex}% {1.5ex}\hspace*{0.9ex}}} or \newcommand{\R}{\mbox{\protect\makebox[.15em][l]{I}R}} \newcommand{\N}{{\sf N\hspace*{-1.0ex}\rule{0.15ex}% {1.3ex}\hspace*{1.0ex}}} \newcommand{\Q}{{\sf Q\hspace*{-1.1ex}\rule{0.15ex}% {1.5ex}\hspace*{1.1ex}}} \newcommand{\C}{{\sf C\hspace*{-0.9ex}\rule{0.15ex}% {1.3ex}\hspace*{0.9ex}}} -- * I don't want a caption in my figures ----------------------------- The \caption command not only produces the text "Figure N:" in a figure, but also increments the figure counter. If you leave out a \caption command, the figure counter will not change: you'll end up with \ref producing the same number for each figure. So, use the following \nocaption command which produces no text, but does increment the counter. It needs to be placed in a .sty file, and my also work for tables. % Increment the counter, but produce no text \newcommand{\nocaption}{\refstepcounter\@captype} And use like this: % A figure with no caption \begin{figure} \nocaption \label{blah} \end{figure} -- * How can I recover my text from a dvi file? ----------------------- If you accidently remove your .tex file but still have a .dvi file, you can recover the text using the "dvi2tty" program. Dvi2tty was designed to preview a dvi file on an ASCII terminal. So... unix% dvi2tty report.dvi > report.txt will reconstruct a text file (report.txt) from the DVI file. It won't be perfect, and may lose/add a few spaces here and there...but it's better than nothing! -- * How can I get more figures on a page? ---------------------------- [From Pablo A. Straub on comp.text.tex] Figures, and other "floating text", obey a number of parameters. Adjustments enable you to have more figures and text in pages (i.e., it is less likely to have a page with a figure and whitespace). For explanation see pages 177-178 of LaTeX manual. % E.g., put this into your personal style file or before \begin{document}. \setcounter {topnumber}{3} % common default: 2 \renewcommand {\topfraction}{0.8} % common default: 0.8 \renewcommand {\bottomfraction}{0.8} \setcounter {totalnumber}{4} % common default: 3 \renewcommand {\textfraction}{0.2} % common default: 0.2 \renewcommand {\floatpagefraction}{0.7} % common default: 0.5 What the parameters mean: topnumber is the maximum number of floats allowed at the top of a page bottomnumber as topnumber but for the bottom of the page. topfraction is the maximum fraction of the page that can be occupied by floats at the top of the page. E.g. 0.25 specifies that the top quarter of the page may be devoted to floats. bottomfraction as topfraction, but for bottom of the page. totalnumber is the maximum number of floats allowed on a page floatpagefraction is the minimum fraction of a "float page" that must be occupied by floats. (A "float page" is a page which contains only floats -- no text). textfraction is the minimum fraction of a page that must be devoted to text. (The other 1-textfraction can be floats). Also of interest: floatsep the vertical space between floats at the top or bottom of a page. textfloatsep the vertical space between a float at the top or bottom of a page and the text on that page. -- * How can I make latex put a figure where I ask for it? ------------ LaTeX places a figure wherever it thinks best, even, sometimes at the end of the whole file, if it cannot fit it in earlier consistently with the settions of topfraction, bottomfraction, textfraction, etc. described above. You can give latex advice regarding preferred placing by placing after "\begin{figure}" one of the following optional parameters: [t] -- use top of next page [ht] -- use top of this page [h] -- put the figure "here" [b] -- use bottom of the page [p] -- put on a float page e.g. \begin{figure}[t] Sometimes your requested placing is ignored because it overrides some global constraints (e.g. those described in the previous section). However, you can strengthen your request by preceding it with an explanation mark (In Latex2e), e.g. to strongly recommend placing the figure exactly "here" use: \begin{figure}[!] -- * How do I put two figures side-by-side? --------------------------- [From Thomas Stuempfig on comp.text.tex] Putting two figures side by side is quite easy, you just have to understand what the figure-environment really does. The figure-environment gives TeX the advice to put the included stuff to a position in the document with enough space for the figure. Furthermore the figure-environment is telling the \caption-command to produce "Figure #:" (instead of "Table #:"). Knowing this, the solution is easy (but it took me about 6 months): You put two minipages inside the figure. Each minipage may have its own \caption and so you get 2 figures side by side. The following example can demonstrate this: \begin{figure} \begin{minipage}[b]{4cm} % "b" to out the captions on the same line \vspace{5cm} \caption{The left picture} \end{minipage} % no empty line here so the figures are side by side \begin{minipage}[b]{5cm} \vspace{7cm} \caption{The right picture} \end{minipage} \end{figure} -- * Is there an easy way to use _ (underscore)? ---------------------- Normally the underscore character has a special meaning to LaTeX, but this can be inconvenient at times (for example, when you're writing about program identifiers that use the _ as part of their name). The following macro allows you to type \code{compute_change} to typeset compute_change in \tt font without having to use \_ to get the underscore. \def\setcode#1{\tt #1\egroup} \def\code{\bgroup\catcode`\_=\active\setcode} [From Joachim Schrod on comp.text.tex] -- * I want a verbatim-style underscore in math mode ------------------ [From Iamonn McManus on comp.text.tex] "When in math mode, both \verb|_| and \_ give the ordinary underscore! How can I get the verbatim underscore in math mode? My first guess was $\mbox{\verb|_|}$ but that gives an error message." $\hbox{\verb|_|}$ will work. The problem with just \verb|_| is that \mathcode`_ = "8000, so when TeX comes to typeset a _ in math mode, it uses its \active meaning. You could always change the \mathcode to get around this problem. The reason \mbox doesn't work is that it reads its argument before the inner \verb gets a chance to change \catcodes. -- * How do I change the size of the margins? ------------------------- [From Harry Fearnle on comp.tex.text] The following 12 variables describe the sizes of all the margins on a LaTeX page. They can be set in the preamble (after \documentstyle but before \begin{document}). To change the topmargin to 2 inches you should say \topmargin=2in Remember: you can always use negative values to move things up the page. E.g., \voffset=-0.5in will move the vertical offset half an inch up the page. For example, if you wanted to make your document 1cm longer (and moved 1cm up the page). \addtolength{\topmargin}{-1cm} \addtolength{\textheight}{1cm} The following are for odd pages... 1 \hoffset = 0pt \ 2 \voffset = 0pt \ Values appropriate for 10pt article style 3 \oddsidemargin = 63pt \ 4 \topmargin = 27pt \ 5 \headheight = 12pt \ 6 \headsep = 25pt \ See the diagram below 7 \textheight = 528pt / Taken from Kent McPherson's 1988 paper: 8 \textwidth = 345pt / `Page Layout in LaTeX' TUGboat 9(1):78-82 9 \marginparsep = 11pt / 10 \marginparwidth = 90pt / 11 \footskip = 30pt / 12 \footheight = 12pt / ...for even pages \oddsidemargin is replaced by \evensidemargin ---------------------------------------------------------------------------- | ! ^ | | ! 2 | | ! v | |..........................................................................| | ! ^ | | ! 4 | | ! v | | ! -------------------------------------- | | ! | ^ | | | ! | 5 | Header | | ! | v | | | ! --------------------------------------- | | ! ^ | | ! 6 | | ! v | | ! -------------------------------------- ----------------- | | ! | ^ | | | | | ! | ! |<9>| | | |< 1>! | ! | | | | | ! | ! | |<---- 10 ---->| | | !< 3 >| ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | | | Margin | | | ! | 7 Body | | | | | ! | | | Notes | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! |<------------------ 8 --------------->| | | | | ! | ! | | | | | ! | ! | | | | | ! | ! | | | | | ! | v | | | | | ! ---------------------------------------- ----------------- | | ! ^ | | ! 11 | | ! v | | ! -------------------------------------- | | ! | ^ | | | ! | 12 | Footer | | ! | v | | | ! --------------------------------------- | | ! | ---------------------------------------------------------------------------- -- * I need blank headers when the page contains only figures -------- [from Sebastian Rahtz on comp.text.tex] As with all other questions in the world, it's there in latex.tex if you look for long enough. Add the following to your very own style file. % if there are floats around % then set pagestyle to be empty \def\@tryfcolumn #1{\global\@fcolmadefalse \xdef\@trylist{#1}\xdef\@failedlist {}\begingroup \let\@elt\@xtryfc \@trylist \endgroup \if@fcolmade \typeout{Page with floats and nothing else} \thispagestyle{empty} \@vtryfc #1 \fi} -- * I get "Misplaced \omit" errors in in tabular --------------------- If you're using \multicolumn, remember that the command must come either at the start of a row, or directly after an "&". In particular, make sure you do not leave blank lines, as in this example: \begin{tabular}{ccc} One & Two & Three \\ \multicolumn{2}{c}{Don't leave blank} & Lines \\ \end{tabular} -- * I want a few lines of text in a table ---------------------------- You need to set a cell of your table as a "parbox". You do this at the start of the tabular, and you need to specify a width of the cell. E.g... \begin{tabular}{lp{1.25in}} A short cell & A cell that can go on and on and on for a number of lines, which could include environments like ``itemize'' etc.\\ Another cell & One more cell\\ \end{tabular} ...would produce something like: A short cell A cell that can go on and on and on for a num- ber of lines, which could include environments like ``itemize'' etc. Another cell One more cell See the example on p. 182 of the Lamport book. -- * I get an overfull vbox message on every page with fancyheadings.sty This is caused by the fact that the \headheight in the standard styles is rather small, especially if you use 11pt or 12pt options or bigger headlines. \addtolength{\headheight}{1.6pt} \addtolength{\footskip}{1.6pt} -- * "Appendices" is in the wrong place on the contents page ---------- If you say something like: \addtocontents{toc}{APPENDICES} \appendix \include{appedix1} \include{appendix2} You will find that the word "APPENDICES" appears after the "Appendix I" in the contents page. The short term fix is to place the \addtocontents line INSIDE the first appendix file (appendix1.tex in this case). If you look in the .aux file that LaTeX generates for your file thesis.tex, you'll discover: \@input{appendix1.aux} \@writefile{toc}{APPENDICES} \@input{appendix2.aux} that is, the \@writefile command that says `put the word APPENDICES' in the TOC (table of contents) has appeared *after* the \@input command that says `input the .aux file for appendix 1'. Since appendix1.aux includes: \@writefile{toc}{\string\contentsline\space {chapter} ... this means that the .toc file includes: \contentsline {chapter}{\numberline {A}Backus-Naur % (Appendix I) formulation of the syntax of database items}{67} APPENDICES Why is this? Well, TeX has two ways of writing to a file... \immediate\write (meaning do it now!) and \write (meaning do it when the page is output). The former has to be used by \include (for technical reasons), and the latter has to be used by \addtocontents (since table of contents lines may need to know the page number). So LaTeX generates: \write to thesis.aux "\@writefile{toc}{APPENDICES}" \immediate\write to thesis.aux "\@input{appendix2.aux}" and the \immediate\write is allowed to overtake the \write. Phew! [ From Alen Jeffrey ] -- * Bibtex doesn't work with thesis style ---------------------------- Bibtex won't work with an aux file written with thesis.sty. But it will if you run LaTeX in some other mode rather than thesis mode. So, if you... 1. Take the root file for the thesis, change \documentstyle{thesis} to \documentstyle{book} (as books, like theses, have chapters: I had to make one other change; `book' mode didn't recognise \starttext) 2. Run LaTeX on it 3. Run bibtex on it so all the right .bbl files get written 4. Then change back to \documentstyle{thesis} and LaTeX it the usual 77 or so times, then Hey Presto! you have a bibliography! From: Adam Kilgarriff -- * I want to centre section headings -------------------------------- >I need to submit a paper in which the section headings are centred, >not left justified as in article.sty. Is there a simple line I can >add to my latex - without having to write a .sty file - the mysteries >of which are beyond my comprehension? You `just' need to redefine \section, \subsection etc. For example, in art10.sty, you'll find the definition: \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}{\Large\bf}} (You can look up the definition of \@startsection in /usr/local/lib/tex/inputs if you like :-) The bit we're interested in is the last argument which sets the style the section should be in, so if you want centred headings you can say: \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus -.2ex}{2.3ex plus .2ex}{\centering\Large\bf}} Unfortunately, \@startsection is one of LaTeX's `hidden commands' with an @ in the name, so you either have to write a .sty file with lines like the above in it (recommended if you're doing this more than once) or surround the code by \makeatletter ... \makeatother. From: Alan Jeffrey See also: Setting your own defaults, above. -- * I want to use verbatim in a fbox (or in some other command) ------ >I want to use verbatim text within a framebox but I keep getting errors >if i use the verabtim environment. You can't use \verb or \verbatim inside an argument for another command, for reasons to do with TeX's baroque parsing algorithm. The following environment "fboxedminipage" acts like a minipage, except it's got a box around it: \newenvironment{fboxedminipage}[1]% {\setbox0\vbox\bgroup\hbox\bgroup\begin{minipage}{#1}}% {\end{minipage}\egroup\egroup\fbox{\box0}} Hence you can say: \begin{fboxedminipage}{\textwidth} \begin{verbatim} This is some text in a minpage, so I can put almost anything I like in here. \end{verbatim} \end{fboxedminipage} -- * I want \subsubsections on the table of contents ------------------ Set the counter secnumdepth to the largest depth of sectioning that you want numbered, for example: \setcounter{secnumdepth}{3} will number sections, subsections and subsubsections. -- * How can I prevent line breaks in maths mode? --------------------- One useful trick for line-breaking in-line mathematics (such as $x=y$) is that TeX never breaks a line around mathematics surrounded by braces, so $x=y$ can be broken around the `=' but ${x=y}$ cannot. TeX's rules for line-breaking in-line mathematics is to allow breaking around `relations' (such as $=$, $\subseteq$, $\sim$, etc.) and `binary operators' (such as $+$, $\cup$, $\oplus$, etc.) and nowhere else. If you're very keen on hackery, you can set the values of \binoppenalty and \relpenalty to encourage or discourage these line breaks, for example: \binoppenalty=10000 % Don't line-break mathematics \relpenalty=10000 % under any circumstances or: \binoppenalty=70 % Line-breaking mathematics \relpenalty=50 % isn't so bad... The current values are 700 and 500, respectively. These values should probably be set globally and then not tampered with---if you try changing them in the middle of a document you may get unexpected results! Personally, if you've got any in-line mathematics longer than half a line, I'd use a display environment (such as eqnarray*) anyway. >If it's more than a line long then you have to manage breaking it >yourself using eqnarray and possibly lefteqn -- see Lamport p. 49-50. Indeed---you need to understand a displayed formula in order to line-break it, and a typesetter which can interpret arbitrary mathematical formulae is quite a way off! Alan. -- * I want my own kind of list --------------------------------------- How to build itemized lists that look like this (for example): (i) The first item (ii) The second item LaTeX's list environment allows you to build lists with user defined labels. To do this you need to first define a new counter (so that LaTeX can keep track of an item's number). So insert the following before \begin{document}: \newcounter{numpar} I called this counter "numpar" because it is going to be used to produce numbers in parentheses. You can use any name you like. The list environment takes two arguments: the label to use, and any parameters to set: \begin{list}{(\roman{numpar})}% {\usecounter{numpar}\setlength{\rightmargin}{\leftmargin}} The first argument says: the label should be a "(" followed by the item number as a lowecase Roman numeral, closed with a ")". Other ways to produce the number include: \arabic{...} Arabic numerals \Roman{...} Uppercase roamn numerals \alph{...} Lowercase letters (no more than 26 items!) \Alph{...} Uppercase letters \fnsymbol{...} One of the 9 footnote symbols (star, dagger, etc). The second argument of the list environment tell's LaTeX that the counter to use (and reset) is called "numpar" and that the margins are to be reduced slightly. You can then type your items as normal, and LaTeX will update the "numpar" counter for you: \item The first item \item The second item Finish with: \end{list} If you're going to use this a lot, you'll probably want to define your own environment. E.g., put this before \begin{document} (along with the \newcounter): \newenvironment{numpar}% {\begin{list}{(\roman{numpar})}% {\usecounter{numpar}\setlength{\rightmargin}{\leftmargin}}}% {\end{list}} Then in your document you can say: \begin{numpar} \item The first item \item The second item \end{numpar} More details in Lamport. -- * Roman text as a maths superscript is the wrong size ------------- If you typset something like $x_max$, the "max" bit will appear in maths italic. Often, you really want it to appear in Roman. The Lamport books suggests doing this: $x_{\mbox{max}}$. This places the "max" in Roman, but does not reduce the size of the font appropriately. The solution is to do this: $x_{\rm max}$. But take care...When you use \rm instead of \mbox you are still in maths mode---and maths mode ignores spaces. So if you do this: $x_{\rm maximum value}$, the output will be "maximumvalue". You need to explicitly insert the spaces: $x_{\rm maximum\ value}$. See: The TeXbook, p. 163. -- * Is there a Unix option to latex to make it run in batchmode? ----- To run the file "file.tex" through latex in \batchmode you can say: unix% latex "\batchmode\input file.tex" -- * How can I put TeX Fragments into xfig documents? ----------------- [This section contributed by Roger Evans] 1) In xfig, put the bits of latex you want into ordinary text strings. Then pull up an edit box on the string and set the 'special' flag. You may also want to set the 'hidden' flag, which causes the ugly latex text to be replaced in the xfig diagram by a dummy placeholder string '<<>>'. If you want multi-line latex, you can do this in the edit box, but not when directly typing in in text mode. 2) Don't use the xfig export options for pstex - they don't work! Instead, save the digaram, say as foo.fig and do this: % fig2dev -L pstex foo.fig > foo.pstex % fig2dev -L pstex_t -p foo.pstex foo.fig > foo.tex The first line creates postscript for the figure, but omitting all the special text. The second line creates latex from the special text, and also merges in the postscript (that's the -p bit) just created. The result is a fragment of latex (NOT a whole document) that you can \input into you latex document. HOWEVER, this latex uses old-style fonts specifications and so our (ie COGS) latex gets upset. As long as your font usage is undemanding, you can simply remove the offending specifications, or patch them with things like \bf I guess. NB: the only sensible way to preview such things is with a postscript previewer, since neither xdvi nor xfig show the whole document properly. [PS: xfig text objects have another flag (apart from hidden and special) - 'rigid'. Does anyone know what it's for??] -- Optional styles ---------------------------------------------------- The standard LaTeX can be modified to suit a variety of tasks. This is usually done by including a "style option" in the \documentstyle line. For most cases to include style x you say: \documentstyle[x]{article} (which will read the file x.sty for the TeX directory). If you want to include options x, y and z you'd say: \documentstyle[x,y,z]{article} The remainder of this section contains subsections of grouped style files which you may find useful. Full details for each style can be found by looking at the start (or sometimes end) of the .sty and/or .tex files found in /usr/local/lib/tex/inputs/ The styles will be read left to right (ie., x.sty first, then y.sty; z.sty last). Any changes made by x.sty may be changed back by z.sty -- so sometime the order of the style files is important. -- -- Bibliography ---------------------------------------------------- To change from the default bibliography format, to the format xxx, you must have at least the following in you TeX file: \documentstyle[xxx]{article} \begin{document} \bibliographystyle{xxx} \bibliography{mybib} \end{document} Where "mybib" if the name of your .bib file. -- -- -- The APA style theapa.bst theapa.sty (for use with BIBTEX and formatting articles.) This style option is invoked by putting "theapa" within the square brackets, e.g. the document might start thus: \documentstyle[a4,theapa]{article} This uses The American Psychology Association rules (or some of them) to produce citations, bibliographies, and optionally section headings. -- -- \CITE MACROS: Examples of references to bibliography items might be \cite{MinA,MinB} which produces: (Minsky, 1967, 1983) or \citeA{MinA} which produces: Minsky (1967) According to the APA manual, the very first citation of a reference item requires the full list of authors; but following citations of the same reference item require the short list of authors (i.e., switches to using "et al."). There are commands for forcing the "full" or the "short" form to be used: \fullcite, \fullciteA, etc. enforces full citations The \cite commands are best explained by examples: \cite{mcclfact} produces: (McCloskey, Aliminosa & Sokol, 1991) \citeA{mcclfact} produces: McCloskey, Aliminosa & Sokol (1991) \citeauthor{mcclfact} produces: McCloskey, Aliminosa & Sokol Notice that the next citation has more than three authors, so theapa automatically switches to the "et al" version after the first full length citation. I.e., \cite{mcclfact} produces: (McCloskey et al., 1991) \citeA{mcclfact} produces: McCloskey et al. (1991) \citeauthor{mcclfact} produces: McCloskey et al. You can explicitly use the short or full version of a citation with: \fullcite{mcclfact} produces: (McCloskey, Aliminosa & Sokol, 1991) \fullciteA{mcclfact} produces: McCloskey, Aliminosa & Sokol (1991) \fullciteauthor{mcclfact} produces: McCloskey, Aliminosa & Sokol \shortcite{mcclfact} produces: (McCloskey et al, 1991) \shortciteA{mcclfact} produces: McCloskey et al. (1991) \shortciteauthor{mcclfact} produces: McCloskey et al. The same author with different years is treated appropriately: \cite{Apt,MinA,MinB,Bond} produces: (Apt, 1989; Minsky, 1967, 1983; Bond, 1991) ^^^^^^^^^^^^^^^^^^ One other cite macro: \citeyear{mcclfact} produces: (1991) -- -- -- Case changing option for article titles By default, article titles are converted to lower case except the first character (unless protected by `\uppercase{...}'). The conversion can be turned off by the command: \notitlecasechange' If you want cases of a part of title to stay as uppercase, use `\uppercase{...}', not just `{...}'. Putting parts in braces also prevents case change. E.g. La{T}e{X} -- -- \CITE OPTIONAL ARGUMENTS: The cite macros can take two kinds of optional arguments: \cite[optional notes]{label} So, blah blah \cite[p.~77 for details]{mcclfact}. produces: blah blah (see McCloskey et al., 1991, p. 77 for details). This works with all the \cite commands The reference in the bibliography will look something like: McCloskey, M., Aliminosa, D., \& Sokol, S.~M. (1991). {\em Facts, rules, and procedures in normal calculation: Evidence from multiple single-patient studies of impared arithmetic fact retrieval. {\em Brain and Cognition}, {\em 17}, 154--203. -- -- CHANGING CITATION PUNCTUATIONS: The following command format can be used to specify the format in which citations will be printed: \citepunct{open paren}% {between authors in parenthesis and ref. sec}% {between authors in text}% {between author(s) and year}% {between citations}% {before notes}% {closing paren}% {open quote for article titles}% {closing quote for article titles} For example, \citepunct{[}{and}{\&}{ }{, }{: }{]}{``}{,''} - use square brackets `and' between authors in parenthesis and ref. sec. '&' between authors in text space between author and year comma between citations comma before notes e.g. [Apt and van Emden 1986, Lloyd 1985: Notes] e.g. Apt & van Emden [1986] - ``article title,'' (in double quote marks and comma in them) The default is: \citepunct{(}{\&}{and}{, }{; }{, }{)}{}{.} -- -- CHANGING CITATION LABELS: The following type of command can be used to change the format of citations: \citelabels{editor label}% {editors label}% {volume label}% {number label}% {edition label}% {page label}% {pages label}% {chapter label}% {tech. rep. label} For example, \citelabels{, editor}{, editors}{Volume}{Number}{edition}% {page}{pages}{chapter}{Technical report} The default is: \citelabels{ (Ed.)}{ (Eds.)}{Vol.}{No.}{edition}% {p.}{pp.}{chap.}{Tech.\ rep.} Depending on which document style option you're using, the bibliography will be headed by the word "Reference" or "Bibliography" by default. You can change these by typing: \def\refname{References} to use "References" as the bibliography heading for articles. ENFORCING APA STYLE SECTION HEADING Place one of the following macros before \begin{document} \OneLevelHeading \TwoLevelHeading \TwoLevelHeadingA \ThreeLevelHeading \FourLevelHeading \FiveLevelHeading These macros modify the way \section , \subsection etc work. For example, \OneLevelHeading only allows one level of headings, i.e., a \section, which will be set normalsize, centered, uppercase, and boldface. Full details are in the tutorial notes in the file theapa.sty. -- -- -- APA SERIATIONS: The "seriate" environment Blah blah blah \begin{seriate} \item first item, \item second item. \end{seriate} Blah blah blah results in: Blah blah blah (a) first item, (b) second item. Blah blah blah The APAenumerate environment Blah blah blah \begin{APAenumerate} \item first item ... ... ... continue continue \item second item ... ... ... continue continue \end{APAenumerate} Blah blah blah results in: Blah blah blah 1. first item ... ... ... continue continue 2. second item ... ... ... continue continue Blah blah blah The APAitemize environment Blah blah blah \begin{APAitemize} \item first item ... ... ... continue continue \item second item ... ... ... continue continue \end{APAitemize} Blah blah blah results in: Blah blah blah o first item ... ... ... continue continue o second item ... ... ... continue continue Blah blah blah -- -- apalike.bst apalike.sty If you use this, \cite's come out like "(Jones, 1986)" in the text but there are no labels in the bibliography, and something like "(1986)" comes out immediately after the author. Author (and editor) names appear as last name, comma, initials. A `year' field is required for every entry, and so is either an author (or in some cases, an editor) field or a key field. -- -- chapterbib.sty Allow multiple bibliographies in a LaTeX document, including items \cite'd in more than one bibliography. -- -- citesort.sty Allow, but strongly discourage, line breaks within a long series of citations. Compress lists of successive numbers to one number range, e.g., 5,6,7,8,9 --> 5--9. Compatible with versions of \@cite that use exponents. Modified to sort the numbers so they come out in increasing order, regardless of the way they appear in the source. O(N^2) sort! -- -- drftcite.sty Use the label instead of the number for citations, as if \bibitem[name]{name}{....} but write the proper citation number to the aux file. -- -- cite.sty Compresses lists of numbered \cites (like citesort). Does not sort citations numbers. -- -- named.bst named.sty \cite commands produce: [Author Year] or Author or [Year] or Year -- -- Additional .bst files The following bibliography styles require only a \bibliographystyle command (no .sty file exists for them): plain.bst - Entries sorted alphabetically and numbered. alpha.bst - Like plain, but uses labels like Knu66 (from author and publication year). unsrt.bst - Like plian, but entries appear in order of their first citation. abbrv.bst - As plain, but abbreviates journal names, names and months names. -- -- Trees, charts and graphs -- -- bnf.sty bnf.tex Pretty Printing Context Free Grammars -- -- cd.sty cd-doc.tex Commutative Diagrams (something to do with grammar) -- -- chomsky.sty Gives: S / \ / \ / \ / \ / \ NP VP / \ / \ / \ / \ Det N / \ | | Vt NP The man | / \ bit Det N | | a dog Comments: chomsky is fine, provided trees you want to draw are binary or unary branching (I've only tried simple labelling, of the kind standardly used in linguistics parse trees). It won't do anything with more than two branches at a node, and if there's only one branch at a node it offsets it to the right, which looks fine when the branch above is a diagonal, but a bit out if it is vertical, e.g S / \ / \ / \ / \ NP VP / \ | / \ | Det N V | | | | | | The man eats Also the documentation scarcely makes the syntax for describing trees clear. It gives the line \chomsky [/;,/] \endchomsky. which really ought to say \chomsky [/;RIGHTDAUGHTER,LEFTDAUGHTER/] \endchomsky. where right and left daughters can be trees, atoms or null. If only one is null it should be LEFTDAUGHTER. All in all, I'll learn xfig and xfig-to-ps stuff! (Or tgif) -- -- TreeTeX.tex l_pic.tex classes.tex tree_doc.tex Macros for drawing trees (like chomsky.sty) Say \input TreeTeX in your .tex file. Comments: TreeTeX is very complex and looks hard to use. You'd have to be doing a lot of binary-only tree-drawing to make it worth getting into. -- -- flowchart.sty Here is a tool that might be useful; you can use it to get lines which bend (90 degrees) ending in arrows, and you can study it (ha ha) to figure out how it might be extended to do a flow chart. It is included within a program to test demonstrate it. It uses only the LaTeX picture macros for graphics. -- -- nnet.tex nnetdemo.tex Neural network weight diagram macros for LaTeX -- -- Mathematical environments --------------------------------------- fleqn.sty Makes equations flushed against the left margin (rather than the usual centered equations). Described in the Lamport book. \mathindent governs the amount of indent from the left margin. an can be set with a command like: \mathindent=0cm equationarray.sty Combine the capabilities of the eqnarray environment and the array environment. equations.sty A collection of macros to aid in constructing displayed equations in LaTeX. subeqn.sty Within the subequations environment, the only change is that equations are labelled differently. The number stays the same, and lower case letters are appended. For example, if after doing three equations, numbered 1, 2, and 3, you start a subequations environment and do three more equations, they will be numbered 4a, 4b, and 4c. After you end the subequations environment, the next equation will be numbered 5. stmaryrd.sty Provides > 100 new math symbols. Described in: /usr/local/lib/tex/doc/misc/stmaryrd.tex -- Fonts -------------------------------------------------------------- -- -- Choosing font types The following document style options change which fonts are used: psavant makes \sf produce Avant Garde Book psbook makes \rm produce Bookman Light pscour makes \tt produce Courier pshelv makes \sf produce Helvetica psnewcen makes \rm produce New Century Schoolbook pspalat makes \rm produce Palatino pstimes makes \rm produce Times New Roman cmroman makes \rm produce Computer Modern Roman (the default) cmsans makes \sf produce Computer Modern Sans (the default) cmtypewr makes \tt produce Computer Modern Typewriter (the default) pscharte makes \rm produce Charter psutopia makes \rm produce Utopia (due to a bug in the Sun NeWSPrint PostScript interpreter, Utopia cannot be printed on spa) psrock makes \rm produce `Rockwell' (slab-serif font most famous for being used on every boring 1970s government form. It is only available on SparcPrinters (such as spa at Sussex). Note that none of the above change the way that mathematics is set, so they're only suitable for documents with no mathematical content. There is a style file called "pstimesm" which loads pstimes.sty and also produces mathematics in the times font. Note, however, that this does not work with the Sparc printer (spq) and there is no \boldmath. -- -- Font Scaling: Helvetica and Times 10pt Helvetica and 10pt Times Roman are fonts which do not live well together, since Helvetica is much larger than Times. A good combination turns out to be 8.5pt Helvetica with 10pt Times. To achieve this automagically, the document style options pstimesm, pstimes, psnewcen, pspalat, pshelv, psavant and pscour will now automatically scale themselves so that their x-heights (the height of a lower-case `x') match. The first font to be loaded will be used at 100%, and the others will be scaled to fit. For example, \documentstyle[pstimes,pshelv]{article} will use Times at 100% and Helvetica at 85%, whereas \documentstyle[pshelv,pstimes]{article} will use Helvetica at 100% and Times at 117%. To switch this off, use the psrawpt document style option. -- -- Running headings ------------------------------------------------ fancyheadings.doc fancyheadings.sty Here is a document style option that allows you to customize your page headers and footers in an easy way. It combines features that were separately available in other pagestyles, without introducing much complexity. You can define: - three-part headers and footers - rules in header and footer - headers and footers wider than \textwidth - multiline headers and footers - separate headers and footers for even and odd pages - separate headers and footers for chapter pages LHEAD CHEAD RHEAD ----------------------------------- (rule) E.g., \thispagestyle{fancy} \headrulewidth=0cm % no rule under the header \rhead{} \chead{} % Nothing on the right or center \lhead{Candidate 12345} % the left text headerfooter.sty Sets the header and footer (with optional rule lines) \pageheader{LEFT}{CENTER}{RIGHT} \pagefooter{LEFT}{CENTER}{RIGHT} Doesn't like \maketitle draft.sty This is a first attempt at a draft option for the standard LaTeX styles. Without requiring any changes to a LaTeX file (other than specifying the draft option :-) and without changing the formatting of the ``real'' text , mark the spots where \label, \cite, \ref, \index, or \glossary commands occur in text, and print the command arguments in the margin. drafthead.sty Puts "DRAFT" with date and time at top of each page. threepart.sty Three part head and foot macros. -- -- Special effects ------------------------------------------------- (See also: pretty boxes) drop.sty ** ** ACRO for dropping and enlarging the * * * first letter(s) of a paragraph. * * A bit like this, really. Of course, text after the drop character continues as you'd expect it to. bigstart.sty A general macro to provide large letters at the start of paragraphs. rot.sty rot.tex These macros allow you to rotate or flip a \TeX\ box. Very useful for sideways tables or upsidedown answers. \begin{rotate}[opt] text, table, figure etc. \end{rotate} Opt is l,r,u or f. The default is l. For example, to set a postscript figure, complete with rotated caption: \begin{figure} \centerline{ \begin{rotate}[l] \vbox{ \centerline{\psfig{...}} \caption{....} } \end{rotate} } \end{figure} Note that rot.sty uses PostScript commands to rotate things, so you'll have to use a previewer that knows about PostScript (e.g., ghostview or gspreview) to see the rotated object. marnote.sty Macros to print a short note vertically in left or right margin on all pages. literal text is rotated appropriately. -- -- Pretty boxes ---------------------------------------------------- boxedminipage.sty Adds the boxedminipage environment---just like minipage, but has a box round it! boxit.sty Defines a boxit environment, which draws lines around its contents. Usage: \begin{boxit} text you want to be boxed, can contain other environments \end{boxit} shade.sty shade.tex A set of macros that can produce text enclosed in shaded boxes. shadow.sty The command \shabox has the same meaning of the LaTeX command \fbox except for the fact that a "shadow" is added to the bottom and the right side of the box. It computes the right dimension of the box, even if the text spans over more than one line; in this case a warning message is given. -- -- Picture environment --------------------------------------------- multibox.sty Two new commands for use in the picture environment which provide multiple boxes in pictures. -- -- Floats ---------------------------------------------------------- captcont.sty Permit the use of captions in continuations of floats. \captcont is like \caption, except that it doesn't update the counter, and it doesn't make an entry in the list of figures or list of tables. lcaption.sty Provides smart formatting of long captions. The captions are formatted like: Figure 14.19: This figure shows the universe, as seen from outside. Note the particularly interesting coloration of the area around the Cygnus loop. For convenience, the universe was flattened and reduced in size to fit into the margins. The inhabitants don't seem to mind. Indent less with a command like: \advance\capwid by -2em Figure 14.19: This figure shows the universe, as seen from outside. Note the particularly interesting coloration of the area around the Cygnus loop. For convenience, the universe was flattened and reduced in size to fit into the margins. The inhabitants don't seem to mind. floatfig.sty floatfig.tex \begin{floatingfigure} allows text to flow around a figure. subfigure.sty Creates a subfigure box with an optional CAPTION under a FIGURE. The FIGURE is centered with \subfigtopskip of vertical space added above wrapfig.sty Environment "wrapfigure" to manually place a figure at the side of the page and wrap text around it. endfloats.sty Puts all figures on pages by themselves at the end of an article in a section named Figures. Likewise for tables. Reference can be made in the text of where the figure should have been (only caption appears - see \markersintext and \nomarkersintext [default] below. \ref and \label always works on the ones at the end). morefloats.sty Increases LaTeX's limit of 18 unprocessed % floats in memory at once to 36. -- -- PostScript ------------------------------------------------------ psfig.sty Code for including PostScript code in LaTeX. See section on PostScript figures, above. Recommended. epsf.sty epsf.tex More macros for including PostScript in your documents. insertplot.sty Yet another way to include PostScript figures. ps-macros.doc ps-macros.sty Local code (once) used to include PostScript figures in LaTeX. It is a public-domain program, which has been modified to work with the Sussex University dvi2ps program. color.sty Defines macros like \Red \Green \WildStrawberry and so on to change the colour of text. The macro \background{\Blue} will change the colour of the whole page to blue. The colours can be previewed on a colour machine using GhostScript, on in shades of grey elsewhere. The computing center has a colour PostScript printer. -- -- Verbatim -------------------------------------------------------- alltt.sty Defines the `alltt' environment, which is like the `verbatim' environment except that `\', `\{', and `\}' have their usual meanings. Thus, other commands and environments can appear within an `alltt' boxedverbatim.sty Produces verbatim text inside a framebox tabverb.sty Verbatim With Tabbing and Page Breaks This environment is similar to the LaTeX verbatim environment but it interprets tab characters as usually expected. It has the additional feature that a CTL-L in the verbatim environment invokes the LaTeX macro \newpage (thereby giving you some control over page breaks). verbatimfiles.sty This LaTeX style-file defines two user-callable macros: \verbatimfile{} for verbatim inclusion of a file \verbatimlisting[n]{} for verbatim inclusion with line numbers every nth line program.sty For typesetting algorithms. -- -- Dirty tricks ----------------------------------------------------- at.sty Save up TEXT to be output at absolute distance HPOS from the left edge and VPOS from the top edge of the paper. numdef.sty Prefixing a macro definition with \num allows numbers at the end of the command name ( At first glance ) -- -- Tabular --------------------------------------------------------- dectab.sty Allows decimal alignment in tabular environment dcolumn.sty Another way to align decimal points in tables. hhline.sty \hhline produces a line like \hline, or a double line like \hline\hline, except for its interaction with vertical lines. supertab.sty supertab.tex This file provides the supertabular environment, which is an extension to the standard tabular environment. Large tabulars are automatically split across pages. Separate commands for the table-head and table-tail are provided, in order to repeat these on each page. tables-doc.tex tables.sty Macros that are handy for making tables. See TABLEDOC TEX for a longer description. The token-counting macros are straight from the TeXbook's "Dirty Tricks" appendix. tabls.sty Modify LaTeX's table building macros to keep text from touching text or hlines above or below. See instructions after \endinput. tabularx.sty Like tabular, but modifies the widths of certain columns rather than the inter column space, to set a table with the requested total width. array.sty newarray.sty Users can add their own letters to LaTeX's standard list of column specifiers (`c', `p', etc.), and implicit \left \right delimiters around an array or tabular. Also the \extracolsep command works with this style. tabular.sty This file defines a \Tabular environment which is essentially similar to the \tabular environment but is able to handle very large tables which have to be split across pages. (sounds like supertab, above). -- -- Footnotes ------------------------------------------------------- endnotes.sty Like a footnote, but puts the note at the end of the document footnote.sty Numbers footnotes subsequently on each page. ftn.sty Lets you use footnotes inside tabular, array, minipage etc. environments. -- -- Fixes ----------------------------------------------------------- talcor.sty It is amazing that for all these years TeX users, from the novice to the practiced TeXnician, have put up with figuring out when to type \/ to insert an italic correction. Of all the typing conventions I have taught myself to use to deal with TeX, this is the only one I can't stand. The macros below (hopefully) deal with all italic corrections by themselves, with the user never needing to think about them again. pounds.sty \pounds produces $ in maths mode. This is a fix for it. (\pounds still may not work with "times.sty".) quote.sty This file defines the macros \begindoublequotes and \enddoublequotes, which let TeX replace the double-quote character (") with TeX's left double-quote and right double-quote. For example: "This is a test." ---> ``This is a test.'' -- Further Document styles -------------------------------------------- Some of these work only at Sussex. res.sty res-sample.tex Resume document style. resume.sty resume-sample.tex Style option for formatting resumes. icann92.sty Style for the Proceedings of the international conference on artificial neural networks, 1992. This style seems to be used by Elsevier publishers for a variety of conferences. ICANN92.STY defaults to 10pt font, but Elsevier usually specify 12pt, so you'll probably say: \documentstyle[12pt,icann92]{article} By default, COGS' address is inerted after the author name (if you use \author \title and \maketitle as usual). You can redefine the address with \address{}. \section and \section* automatically make your section titles uppercase. Once submitted, you can add a "where published" text to the top of your paper by saying \showwherepublished before \maketitle. You define what gets printed with the \publishedin{WIDTH}{TEXT} macro (again, before \maketitle) and the WIDTH of the paragraph it is printed in. E.g., \publishedin{2in}{\small The International Conference on Wire and Cables, 1992.} \showwherepublished By default, no page numbers are printed, but once published you can set \firstpage{N} (before \maketitle} to have page numbers on your document, starting from page N. See the head of icann92.sty for details on the usage. llncs.sty susxllncs.bst LaTeX macro package from Springer-Verlag for Lecture Notes in Computer Science. Sample document: /usr/local/lib/tex/doc/misc/llncs.tex To use: \documentstyle{llncs} Locally, we have a bibliography style called susxllncs.bst to allow you to use llncs in conjunction with BIBTEX. Typical usage: \documentstyle[citeauthoryear]{llncs} \begin{document} \bibliographystyle{susxllncs} text text \cite{something} text text \bibliography{mybibfile} \end{document} The only bibliography entries defined so far are: inproceedings book, phdthesis and article. ssxcsrp.sty Style option for creating covers for CSRPs. To use it you set the following parameters: \title{My Big Report} \author{B. Boffin} \date{January 1993} \reportnumber{CSRP 1234} Then the command \makecover will produce a cover, in the same way that \maketitle produces a title. The cover is set in Official House Style(TM) Bembo, so xdvi will have trouble previewing it, but it will print on any of the Sparc printers using dvips. ssxcsart.sty Style for Univeristy of Sussex CS articles, published as technical reports. It understands the following document style options: crc (camera ready copy, suitable for printing at magstep 2) lncs (use Springer's LNCS page dimensions) oneside (this is a one-sided document) cover (include a cover page) draft (indicate overfull hboxes with rules) maketitle now looks like: \title{Fishing for fun and profit} \author{Fred Bloggs \and Jane Doe} \date{March 1992} optional \reportnumber{0/92} optional unless producing crc \indicia{Copyright \copyright\ 1992 us.} optional \title and \author both take optional arguments for shortened versions, if the title or author list is too long for the headings, e.g: \title[Fly fishing\ldots]{Fly fishing and its applications to pseudo-orthocomplements in Gelfand quantales} \author[Fred Bloggs et al.]{Fred Bloggs \and Jane Doe \and \and Joe Doe \and His Aunty Mable \and Her Dog Fifi} \thanks is not provided---use the \indica command instead. New environments, itemize* and enumerate*, which the same as itemize and enumerate, but are suitable for short lists. One-sided documents are set with a ragged bottom. Tables and figures are now set in \footnotesize. If you don't like this, you can say \renewcommand{\floatfont}{\normalsize}. The ssxtimes style option (for users at Sussex) sets the document in Times and Helvetica rather than Computer Modern. -- -- seminar.sty (Not yet at Birmingham) This is an optional LaTeX style for producing slides (see the section on TRANSPARENCIES, above). The user's guide for seminar is (at Sussex) /usr/local/lib/tex/doc/seminar/doc/sem-user.tex (and .dvi). A paper copy can be found in room 4C10 (at Sussex). Begin your file of slides with the line: \documentstyle[slidesonly,portrait]{seminar} The "slidesonly" indicates that you'll be producing just slides (seminar can produce other things -- refer to the user's guide for details). By default, seminar is set up to produce slides in landscape (with the text running across the longest side of the page). The following describes how to produce slides in portrait on A4 paper (i.e., how most of us in the UK want our slides to look). Create a slide: \begin{document} \begin{slide*} \begin{center} \Large\bf This is the title \end{center} \begin{itemize} \item The first point \item Second point \item Last point \end{itemize} \end{slide*} % You can have more \begin{slide*}...\end{slide*} commands in here. % End the file with \end{document} \end{document} ("slide*" produces portrait slides; "slide" produces landscape slides). Seminar increases the font size to be readable. Commands like \large \normalisize \bf \em and so on all work as you'd expect, but are all scaled up. Run latex as usual to produce your slides (do not use slitex). For information on postscript figures in seminar, see the section on postscript (above), the subsection on "Notes on including PostScript in seminar.sty" Customizing seminar Seminar reads a configuration file called "seminar.con". This file can contain your customizations to seminar. For example, my seminar.con file might look like this: \input pstimesm.sty % To use Times Roman font \input epsf.sty % To include postscript figures % The following enables landscape printing (should I need it) \renewcommand{\printlandscape}{\special{landscape}} \slideframe{none} % I don't want frames around my slides \slidestyle{empty} % nor page numbers \input a4.sty % I use A4 paper seminar.con should reside in any one of your directories that LaTeX looks in (possibly just your current working directory, or any directory in $TEXINPUTS). See the section on "Setting your own defaults" for details of how to set $TEXINPUTS. Note also that seminar.sty reads your seminar.con file, so you don't have to \input seminar.con yourself (in fact doing so can lead to LaTeX error messages). Refer to the user's guide for lists of parameters you can change. -- Generally useful page formatting styles ---------------------------- doublespace.sty Double spaces a document. Note: This version sets a baselinestretch of 2. If this is too much, put \setstretch{1.5} (or some appropriate value) before the \begin{document} command. To print the document with single spacing again, without removing "singlespace" environments, just put a \setstretch{1} at the top of the document. Double spacing is turned off within footnotes and floats (figures and tables). Also provides: \begin{singlespace} ... \end{singlespace} a4.sty Sets the page size for a4 paper. Make sure this is the last option you specify in \documentstyle. a4wide.sty Like a4, but with wider margins. twocolumn.sty Produces two column output. See Lamport for details. undhead.sty Underlines page headings. listlab.sty Provides a new command \listlabels, which lists all the labels defined in your document, along with their value and page number. Useful for keeping track of all those label names which made a lot of sense when you thought of them but you can't remember what they are now! It works in the same way as \tableofcontents, and generates a file called FILENAME.lab. -- -- Date and time --------------------------------------------------- time.sty time.tex Here is a simple macro to get the current time in (La)TeX. It is designed to display the current time in the format "10:05 A.M.", whenever you type the command \now, just as \today produces the current date in LaTeX. If you want the seconds as well, for whatever reasons, simply uncomment the parts I have commented out (leaving the comments addressed to the user, of course!). ukdate.sty \today (replaces American-style macro of same name) generates today's date in the form Thursday 4th October 1066. The `th' is raised, reduced in size and underlined in the same font style (family) as the rest of the date. \dayofweek generates the day of the week, based on TeX's values of \day, \month and \year. \phaseofmoon generates the current phase of the moon, again based on TeX's values for \day, \month and \year. -- -- Music ----------------------------------------------------------- musictex.sty The MusicTeX manual (musictex.dvi) and a number of examples reside in the directory /usr/local/lib/tex/doc/musictex/ The environment \begin{music}...\end{music} can be used to typset music, as in this example: \documentstyle[musictex]{article} \begin{document} \begin{music} \parindent 1cm \def\nbinstruments{1}\relax % a single instrument \def\instrumenti{Piano} \nbporteesi=2\relax \generalmeter{\meterfrac{4}{4}}\relax \debutextrait \normal \temps\Notes\ibu0f0\qh0{cge}\tbu0\qh0g|\hl j\enotes \temps\Notes\ibu0f0\qh0{cge}\tbu0\qh0g|\ql l\sk\ql n\enotes \finextrait \end{music} \end{document} I have no idea what all this means. Ask octavio@cogs.susx.ac.uk -- Beta test styles --------------------------------------------------- At Sussex: LaTeX looks in the directories specified in the variable $TEXINPUTS. By default, this is /usr/local/lib/tex/inputs/ (and the current directory). All new document styles and document style options first become available in the directory: /usr/local/lib/tex/inputs/beta/ After a couple of weeks, these new files will be moved into /usr/local/lib/tex/inputs/ and old versions will be moved to: /usr/local/lib/tex/inputs/obsolete/ If you'd like to use the new versions, add the following line to your .login file: setenv TEXINPUTS .:/usr/local/lib/tex/inputs/beta:$TEXINPUTS Or, if you'd just like to try out a particular new style option FOO: \documentstyle[beta/FOO]{article} Similarly, to revert to a previous version: \documentstyle[obsolete/FOO]{article} WARNING: beta test versions of software may contain bugs (that's why they are being tested...to remove the bugs) -- Further reading ---------------------------------------------------- At Sussex: The Sussex University Computing Centre has produce two booklets on LaTeX. Both are tuned for their own services, but they offer more detail than this help file. "An Introduction to LaTeX", and "Writing Your Thesis in LaTeX" -- -- Lamport's book The main book on LaTeX: To learn LaTeX, just work through the first few chapters of this book. L. Lamport [1985] "LaTeX: A document preparation system" Addison-Wesley Reading, Mass Library: Z 253.4.L38 Lam, Long, Short and Reserved loan copies. The Lamport book is the one to have in front of you at all times. Another intro book is: B. J. Buerger [1990] "LaTeX for Engineers and Scientists" Mc-Graw Hill ISBN 0-07-008845-4 \pounds 24.95 If you really want to become a TeX hacker, you should have a go at reading... D. E. Knuth [1985] The TeXBook: Computers and typesetting, A. Addison-Wesley Reading, Mass. Library: QE 1918 Knu, 2 long loan copies. There are many additional books and online sources of information. -- Email and remote LaTeX help and resources -------------------------- At Sussex you can email texpert or helpline At Birmingham you can email latex-users, or advice If nobody here can help you could try sending a message to anyone of the TeX bulletin boards. (These can be read in VED -- see HELP * VED_GN). In particular you should read comp.text.tex and possibly comp.lang.postscript. Posting a message to such groups should solve your problems. News groups posts out regular (monthly) "frequently asked questions" lists (with solutions). There is a group in the US that will try and solve really tricky LaTeX problems. Their e-mail address is: LaTeX-help@cs.Stanford.EDU. This is a last resort measure! -- -- UK TeX ftp archive Various documents are to be found on the UK TeX archive. You can get to it using ftp, gopher, netscape, mosaic, or lynx. Here is the address: ftp://ftp.tex.ac.uk Look in particular at these directories: ftp://ftp.tex.ac.uk/tex-archive/ ftp://ftp.tex.ac.uk/tex-archive/info The info/lshort/ sub-directory contains documents giving a short introduction to Latex There is also a full collection of software and documentation at the Imperial College Sun server: http://src.doc.ic.ac.uk/packages/tex/uk-tex/ The FAQ file can be accessed as: ftp://ftp.tex.ac.uk/tex-archive/help/TeX-FAQ and a directory of supplements as: ftp://ftp.tex.ac.uk/tex-archive/help/TeX-FAQ-supplement At Sussex, the file /usr/local/lib/tex/doc/ftp/FILES.byname lists all the files in the archive (as of 5 May 1993). -- -- Other local directories at Birmingham At Birmingham you can also explore the files in these directories: /bham/pd/packages/tex/doc/ /bham/pd/packages/tex/inputs/ /bham/pd/packages/tex/man/ The online Man files related to tex and latex. If you get one of these into a VED buffer you can read it with the command: ENTER nroff -man -- Help with LaTeX ---------------------------------------------------- TeX and LaTeX are complex programs, and solutions to typesetting problems are not always obvious. Here are a few ways to get solutions to any LaTeX problems you may have... At Sussex there is a TeX e-mail line. To become a member, send a message to postmaster@cogs. You can then post questions to tex@cogs. However, you should first try an ask the people around you --- some of the problems you experience will be well known. At Birmingham you can become a member of the latex-users email list by sending a message to "majordomo" in the Computer Science department containing the line subscribe latex-users -- Online help via WWW and FTP ---------------------------------------- A useful overview of the benefits of latex, with pointers to further information: http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/ There is a World Wide Web site that you can access using netscape, mosaic or lynx to get information about latex or bibtex. The URLs are: On LaTeX in general: http://jasper.ora.com/texhelp/LaTeX.html On BibTeX: http://jasper.ora.com/texhelp/BibTeX.html Those files can also be accessed (using mosaic or lynx) at Birmingham as /bham/doc/latex-help/LaTeX.html /bham/doc/latex-help/BibTeX.html See HELP * FTP for information about FTP. At Birmingham see HELP * WWW -- Related documentation ---------------------------------------------- General "man" and "help" files (not all available at Birmingham): MAN * TEX MAN * BIBTEX MAN * SLITEX MAN * DETEX MAN * LDVIPR MAN * MAKEINDEX HELP * PRINTERS HELP * RNO HELP * VED_NET MAN * TIB MAN * DVI2PS MAN * DVIPS HELP * VED_LATEX MAN * PSNUP MAN * BIBCARD Previewing MAN * XDVI MAN * XTEX MAN * DVIPAGE MAN * DVI2TTY MAN * TEXSUN MAN * DVISELECT MAN * GS MAN * GHOSTVIEW (bham) MAN * GSPREVIEW (sussex) HELP * XBEGINNERS Graphics MAN * GRAPH MAN * XFIG MAN * DVIPS MAN * PSPLOT MAN * F2PS MAN * GRAPHEDIT MAN * POSTSCRIPT MAN * XWD MAN * XPR MAN * PNMCUT MAN * XWDTOPNM MAN * PNMTOXWD MAN * RASFILTER8TO1 MAN * SCREENDUMP MAN * RASH MAN * PL MAN * POSTPRINT MAN * XGRAPH TEACH * RC_GRAPHPLOT MAN * TGIF (Birmingham) Remember: if you can get a graphic into PostScript format, you can include in it your LaTeX document. (Probably.) HELP * LATEX.LOGIN for site specific information on what to put in your .login file Some useful latex online manuals, etc. /bham/pd/packages/teTeX-1.0/share/texmf/doc/index.html Latex manual and many pointers to other sites http://www.tex.ac.uk/cgi-bin/texfaq2html Very useful FAQ /bham/pd/packages/teTeX-1.0/share/texmf/doc/latex/latex2e-html/externals.html Pointer to other documentation http://www.am.qub.ac.uk/latex/latex_1.html Yet another guide /bham/pd/packages/teTeX-1.0/share/texmf/doc/helpindex.html Not sure what this is --- $poplocal/local/help/latex --- Copyright University of Sussex 1995. All rights reserved. ---------- --- $poplocal/local/ved_latex/help/latex --- Linked to $poplocal/local/help/latex --- $usepop/pop/packages/vedlatex/help/latex --- Copyright University of Birmingham 2008. All rights reserved.