December 10, 2008
Eric Rasmusen, erasmuse@indiana.edu
This file is at http://www.rasmusen.org/a/latex-rasmusen.txt
These notes are latest tips and tricks that I have found useful or
thought might be useful. I wrote these for my own use and have not
tried to make them clear for others, but some other people will find
them useful.
I have an illustration file at
http://www.rasmusen.org/a/latex-rasmusen.tex and
http://www.rasmusen.org/a/latex-rasmusen.pdf
It is not as updated as often as this file.
For BEAMER, the way to make a latex file into a presentation PDF
similar to powerpoint, see
http://www.rasmusen.org/a/beamer-rasmusen.tex and
http://www.rasmusen.org/a/beamer-rasmusen.pdf
----------------------------------------------------------------------
SCIENTIFIC WORKPLACE
Here's what to do to convert a SWP-made file into one that regular
latex can process:
1. Delete the line \input{tcilatex} which I think Scientific
Workplace will put back in for you automatically when you load it.
2. Change \frame{ to {\tt , which will result in a line of nonsense
where each figure was, but will allow latex to process the file
without trouble.
----------------------------------------------------------------------
PICTURES
Latex actually makes pretty good pictures. Here is how to make a
200x100 mm picture, with 0,0 as its base point, and a line sloping up
in direction (1,1) and 50mm long starting at (0,0):
\begin{picture}(200,100)(0,0)
\put(0,0) {\line (1,1){50}}
\end{picture}
----------------------------------------------------------------------
BOLD MATH
LaTeX ignores the \bf in stuff like ${\bf \beta}$, but has \boldmath
to get around this. Unfortunately, it only works in text-mode, not
math-mode. But you can get around this by defining a new command for
each symbol you want boldfaced:
\newcommand{\bbeta}{\mbox{\boldmath$\beta$}}
This is my bold $\bbeta$, or you can do it like this
$$
\bbeta \; is \; bold \; but\; not \; \beta
$$
Or try this boldsymbol method:
$$
\boldsymbol{5}x \neq 5x \;\;\;\boldsymbol{\theta}y \neq \theta y
$$
ROMAN TEXT INSIDE MATH
Use mbox like this:
$$
x=y \; \mbox{if and only if}\; z=90
$$
--------------------------------------------
A dash has three marks like--- this.
A hyphen has two marks quasi--linked like that.
-------------------------------------------
$$
\bar{a} \;\; \breve{a}
$$
$$
\overbrace{ a + b+ \dots + z}\;\;\;\; \underbrace{ a + b+ \dots + z}
$$
$$
f(x) \overset {\rm def} {=} x^2 - 3
$$
----------------------------------------------------------------------
\begin{table} does tables as floats, trying to go at the top or bottom
of pages. \begin{tabular} puts them wherever they happen to be,
skipping everything and going to the next page if there isn't room and
just leaving blank space behind. Thus, \begin{table} is better. It
is an EXTRA command, though. You still need to use TABULAR too, like
this:
\begin{table} \begin{tabular} {ll}
First & Second & Third\\
A new row & Has\footnotemark & New text\\
\end{tabular}\end{table}
----------------------------------------------------------------------
VERBATIM
\begin{verbatim*} indicates where blanks are.
----------------------------------------------------------------------
FOOTNOTES INSIDE TABLES AND MATH
Use the \footnotemark command to insert the footnote number. To
insert the footnote itself, use
\addtocounter{footnote}{-1}\footnotetext{Here is my footnote}
\stepcounter{footnote}
outside the table or math but trying to be on the same page.
$$
x = y\footnotemark
$$
\addtocounter{footnote}{-1}\footnotetext{Except when $ x= 8$. }
\stepcounter{footnote}
\begin{tabular}{|l|l|r|l|}
\hline
lattice & $d$ & $q$ & last column\footnotemark \\
\hline
square & 2 & 4 & 1.763 \\
\hline
\end{tabular}
\addtocounter{footnote}{-1}\footnotetext{ That's two words in that
entry. }
\stepcounter{footnote}
----------------------------------------------------------------------
DECIMAL POINTS
An example of the @ specifier
In scientific tables it is often desirable to align the columns on a
decimal point. This can be done using the @ col specifier and breaking
the number into the integral part in a right-justified column and the
fractional part in a left-justified column:
The following input: will display as:
\begin{tabular}{r@{.}l}
3&14159\\ 3.14159
16&2\\ 16.2
123&456\\ \end{tabular} 123.456
Note that the decimal point is replaced by the column separator, & and
that the @suppresses the intercolumn space
*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*
How do I put a box around an entire equation, including the equation
number?
$$
5= x^2 \;\;\; \fbox{$24v =6 \alpha t + (1-\alpha)g^7$} \;\;\;
67=
\int\limits_0^8
$$
*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*@*
DEFINING YOUR OWN COUNTERS AND LABELS.
This is tricky in Latex, because while you can define new counters, I
can't see how you would attach their values to labels. The \label
command can only be used in environments that have their own counters
(such as \begin{equation}), and you can't fool those environments into
adding to a counter without having them print the value on the printed
page somewhere. So I used Tex programming, like this. I create a new
counter named \fignum and then attach it to a label called \1f, \2f,
and so forth, advancing the counter in between. I used \edef rather
than \def because \edef inserts the value at the particular time,
while \def would repeat the command \number\fignum each time \1f was
written.
\newcount\fignum\fignum=1
\edef\1f{\number\fignum}
\advance\fignum by 1
\edef\2f{\number\fignum}
Example: Figure \1f says this. The second part of it, Figure \1fa,
says something different. Figures \2f and \2f-a say something still
different.
This is plain Tex, not Latex.
You need to write backslash-1-f rather than backslash-f-1. I'm not
sure why-- it must be that the number gets interpreted as doing
something special to the definition rather than being part of the
name.
You have to remember to put your definitions earlier in the document
than when you use the term defined. You could put them all the start,
actually, but then you might forget to re-order them when you change
the order of the diagrams.
I think you can advance the fignum variable by a negative number if
you want to.
----------------------------------------------------------------------
BIBTEX.
I'm not sure if this is worth using or not. Here's how it works with
Miktex.
1. For your file myfile.tex, construct a bibliography database file
myfile.bib with a bunch of entries like this, which do not not have to
be in alphabetical order:
@article{hotelling:1929:ej,
author = {Hotelling, Harold},
journal = {Economic Journal},
month = {mar},
number = {153},
pages = {41--57},
publisher = {Royal Economic Society},
title = {Stability in Competition},
volume = {39},
year = {1929}
}
You can do this from Google Scholar by going to Scholar Preferences
and checking off towards the bottom that you want a Bibtex-format
link. After you set your prferences, Import into BibTeX will be a
link fror each item a Google Scholar search turns up.
2. Pick a style file such as econometrica.bst. Put that file and the
myfile.bib file into the same directory as myfile.tex.
3. Wherever you want the references in myfile.tex, insert the commands
\bibliographystyle{econometrica} %needs econometrica.bst file in
folder
\bibliography{myfile} %needs myfile.bib file in folder
\nocite{*}
The nocite command makes sure that all the entries in the myfile.bib
file get put into the references. Otherwise, only the ones cited using
bibtex commands get put in. The bibtex citing commands are just extra
commands to remember and make reading latex input files harder, so I
don't think I'll use them.
4. Change the name of myfile.tex to plain myfile.
5. Run myfile through pdflatex. That will create myfile.aux.
6. Run myfile through bibtex. That will use myfile.aux and
econometrica.bst and myfile.bib to create myfile.blg, a log file, and
also myfile.bbl, the bibliography formatted nicely.
7. Run myfile through pdflatex again.
----------------------------------------------------------------------
DATES
Put the last revision date of a paper on manually, e.g. May 20,
1998.
Also, put the commands "pdf'd \today".
----------------------------------------------------------------------
SPACES
A single backslash \ will make sure that there is just a single space
after a word. This is useful after a period which does not end a
sentence, e.g. in Mr. \ Jones, so there is just one space after the
period.
For a negative space in math mode, use \!
\hfill and \vfill both put space in up to the limits of the page
borders. Thus, Top of page \vfill Bottom of page will fill up an
entire page, with blank space in the middle.
The command ~ is supposed to prevent a linebreak.
\mbox and \fbox make boxes without and with borders, to keep text
together. There can't be a line break in the middle of that kind of
box. For a box that spans multiple lines, use \parbox{5cm}{Here is
what is inside.}
----------------------------------------------------------------------
\BEGIN{CASES} FOR EQUATIONS WITH SEVERAL CASES:
This will be useful. It puts a big curly bracket after the equals
sign to enclose the various cases that can occur.
\begin{equation*}
|x|=
\begin{cases} x & \text{if $x=0$,}
\\
-x &\text{if $x\le 0$.}
\end{cases}
\end{equation*}
----------------------------------------------------------------------
Here is a table with partial hrule, using the cline command across
columns 2 and 3, not going all the way across, and
partial vrules too.
\begin{tabular} {lcc}
& Radon & Unexposed \\
& & \\
\cline{2-3}
& \multicolumn{1}{|c|}{ } & \multicolumn{1}{|c|}{ } \\
Cancer &\multicolumn{1}{|c|}{$ \theta P(cancer|radon) \cdot n(radon)
$}
&\multicolumn{1}{|c|}{$\theta P(cancer|unexposed) \cdot
n(unexposed) $ } \\
& \multicolumn{1}{|c|}{ } & \multicolumn{1}{|c|}{ } \\
\cline{2-3}
& \multicolumn{1}{|c|}{ } & \multicolumn{1}{|c|}{ } \\
Healthy &\multicolumn{1}{|c|}{$\gamma P(healthy|radon)\cdot n(radon) $
} &\multicolumn{1}{|c|}{$\gamma P(healthy|unexposed) \cdot
\cdot n(unexposed) $ } \\
& \multicolumn{1}{|c|}{ } & \multicolumn{1}{|c|}{ } \\
\cline{2-3}
\end{tabular}
----------------------------------------------------------------------
COMMENTS.
There are three ways to do comments in Latex.
1. The standard way to do comments puts in % and then everything on
the line after it is commented out:
First I have some input, like $y = x^2 + \beta$. %Here is a comment.
2. If you put \usepackage{verbatim} at the start of your file, you can
do multiline comments like this:
\begin{comment}
Here is the first line of the comment.
Here is the second line.
Here is the third.
\end{comment}
3.If you put \newcommand{\comments}[1]{} at the start of your file,
you
can have the best way of all:
Say $y = x^2 + \beta$.\comments{Here is my comment. } Maybe $x=
4\phi$.
Note that if you use \usepackage{verbatim}, it creates an odd
command that makes everything after it in the file a comment. Suppose
you write:
\comment{Here is what I wanted to be my comment.} Here is some more
writing for my paper.
Then not only will the words in the brackets be a comment, but all the
words after the brackets and on the next lines and pages too.
----------------------------------------------------------------------
HYPHENS AND DASHES
For an m-dash (the typical width), write three hyphens, --- .
Typewriters use two hyphens for this -- .
----------------------------------------------------------------------
SPECIAL EQUATION NUMBERING
CURRENT WAY: Put a star after the equation command to suppress
numbering, like \begin{equation*}... \end{equation*}. Whether or not
you do that, you can put \tag{A1} on a particular line to make it
label as equation (A1) (It adds the parentheses automatically); or
\notag so there is no equation number displayed. To add a label that
you can refer to later, put in \label{A1}. Then later you can refer
to it as equation \eqref{A1}, which comes out as "equation (A1)". Note
that \eqref puts in the parentheses automatically; \ref does not.
\align replaces \array, they say.
HERE IS AN OLD WAY To put in your own equation number (1-35), without
changing the stnadard ordering, do this,putting the command at the end
of your equation (after the \end{array} if it is an array). Remember
to use $$, not \begin{equation}.
$$ \label{e1-35}
f(x) = x^2+34 \eqno{(1-35)}
$$
----------------------------------------------------------------------
\usepackage{hyperref}
\hypersetup{breaklinks=true,
pagecolor=white,
colorlinks=true,
linkcolor= blue,
hyperfootnotes= true,
urlcolor=blue
}
\urlstyle{rm}
%so it doesn't use a typewriter font for url's.
\url{
http://ihome.ust.hk/~tanjim/verylongaddresslikethisone-111111zxzxzxzxz
xzxzx
zxzxsqut_high.pdf}
This will use the package hyperref, and turn the address in
\url{sdfd} into a link, as well as displaying sdfd in the text in
color (which will look grey when printed). Also, it will split the
address sensibly across lines. The web address can include tilde and
underscore without special control characters, which is not usual in
tex. Also, references to footnotes, pages, and to equations and
other \ref{sdf} will be links to the original equations. If want a
reference to use the correct counter but not to create a link use
\ref*{label} or \pageref*{label}.
The manual for hyperref is at:
http://www.tug.org/applications/hyperref/manual.html#x1-90003.5
\url{sdfd} is a separate macro though, which I think can work even if
you don't use hyperref (but you want to split up across lines
sensibly, and be able to use underscore and tildes).
----------------------------------------------------------------------
VARIOUS LITTLE COMMANDS
\pagenumbering{roman} This also restarts the numbering to 1.
\not\exists for an exists symbol with a slash through it.
A special little extra space is proper for integrals, like this:
$$
\int_0^\infty x f(x)\,dx,\;\;\; not,\;\;\; \int_0^\infty x f(x)dx,
$$
To put the limits ofthe integral above and below the integral sign,
rather than at the sides ofthe top and bottom, say
$$
int\limits_0^1
$$
I should use notation like $\dot{x}$ and $\ddot{x}$ sometimes.
\dotfill for a long line of dots.
UNDERSCORE, UNDERLINE \_ is ok, no math $$ needed.
\begin{verbatim} \end{verbatim} for unformatted text.
----------------------------------------------------------------------
LIMITS AND MAXIMIZATION
The supposed LiMIT and MAX command are a cheat. They just write Lim
or Max and then subscript with the arrow or whatever.
$\lim_{x\to\infty} f(x)=0$
$\max_{0\le x\le 1}x(1-x)=1/4$
Instead use stackrel, like this:
$$
\stackrel{\rm \displaystyle lim }{\scriptscriptstyle x\to\infty}
f(x) = 534z + \frac{3}{y}
$$
and like
$\stackrel{\rm \displaystyle max}{\scriptstyle x} x(1-x) $, for
maximization.
I should probably make those into macros, since they take so many
commands.
\begin{verbatim}
\define \limminmax{arg1}{arg2} = \stackrel{\rm \displaystyle arg1 }
{\scriptscriptstyle arg2}
\end{verbatim}
\bigskip
----------------------------------------------------------------------
OVERLINING
Overlines can be done various ways. The two standard ways are the
overline, $\overline{U} _i$, and the bar, $\bar{U}_i$. Over capital
italicized U, both look odd. So try something fancier.
Try this: $\overline{\!U\!}$ or try this: $\overline{\!U}$. These
both put in some negative spaces somehow. I don't understand it, but
they do the trick. I like the second of these best.
----------------------------------------------------------------------
ENDNOTES
Usepackage{endnotes} \endnote{Here it is.} At the end of
the document, put \theendnotes to have them print out.
\let\footnote=\endnote
This is for use with the ENDNOTES package.
----------------------------------------------------------------------
REFERENCE LISTS GOING OVER SEVERAL PAGES
For reference lists, use \begin{description} \item[] Rasmusen, Eric
(1980) {\it A Book}. \end{description}
That will generate a list with the first word (Rasmusen) off to the
left a bit and the rest indented from it.
If I have a long document, sometimes long multipage lists go crazy in
latex and won't put in a pagebreak at the right spot. The solution is
to break off the list as a separate document, say, list1.tex. Use
\setcounter{page}{522} to start it at page 522. If there are labels
such as page numbers that are needed, they will be in a *.aux file in
the main document. Copy that *.aux file to the preamble, before
\begin{document}, of the list1.tex document.
----------------------------------------------------------------------
INDEXING
To tag index main entries, i.e. if the work `Likelihood' tag as
\index{Likelihood} next to that word.
For index subentries, use an exclamation point and tag as:
\index{Bayesian inference!advantage and disadvantage of}
``In some respects the Bayesian formulation\index{Bayesian
inference!advantage and disadvantage of} is the simpler and in
other respects the more difficult.''
Put these commands at the start:
\usepackage{makeidx}
\makeindex
Then use the *.idx file that is created
\indexentry{words!and|hyperpage}{1}
\indexentry{existing|hyperpage}{1}
to generate something like this:
\begin{theindex}
\item{extend}\hfill{3}
\item{extension problem}\hfill{3}
\item{extension of a map}\hfill{3}
\item{homotopic}\hfill{5}
\item{homotopy}\hfill{5}
\end{theindex}
I have an examples of tex input and pdf output, with different and
better
instructions, at
http://www.rasmusen.org/a/sample-index.tex and
http://www.rasmusen.org/a/sample- index.pdf
A good reference is:
``MakeIndex: An Index Processor For LaTEX'' by Leslie Lamport 17
February 1987 http://tex.loria.fr/bibdex/makeindex.pdf
Here is an example of how to create an italicized index entry. This
puts the entry ``{\it Producers-- The}'' at the location ``producers''
would have in the index.
The next game, inspired by Mel Brooks's offbeat film {\it The
Producers} \index{producers@{\it Producers-- The}}, illustrates a
peculiarity of optimal contracts
My second way to do indexes, the less intelligent way (because it
will repeat page numbers if more than one \label{} is on one page, and
it won't alphabetize) is to just put \label{termtoindex} in the text,
and \pageref{termtoindex} in the index. Check to see if a label is
assigned more than once, by mistake. To do that, you can look at the
latex processing log in *.log, or you can look at the *.aux file and
it will list all the page numbers assigned to a label.
----------------------------------------------------------------------
SHADED TABLES:
\usepackage[table,x11names,svgnames]{xcolor}
\rowcolors{2}{black!10}{black!5}
\begin{tabular}{l | llllll}
\hline
\rowcolor{black!25} Variable & Minimum & 25th percentile
&
Median & Mean & 75th percentile & Maximum\\
\hline \hline
Crimerate & 0.56 & 3.48 & 5.36 & 5.97 & 7.76 &
22.08\\
Murderfraction & 0.00 & 0.00 & 0.00 & 0.36& 0.58
&2.50\\
Pop & 1.16 & 16.76 & 40.27 & 116.82 & 98.72
&9329.99\\
\hline
\end{tabular}
----------------------------------------------------------------------
HYPERLINKS FROM PDFs
\usepackage[bookmarks=true,bookmarksopen=true,colorlinks=
true,urlcolor=
{red!60!black},linkcolor={blue!80},pdfview=fit,breaklinks=true]
{hyperref}
\href{mailto:erasmuse@indiana.edu}{erasmuse@indiana.edu}
\url{http://www.rasmusen.org}
----------------------------------------------------------------------
DIAGRAMS
Diagrams: use alt-PRINT SCREEN to do a screen capture and use PAINT to
make a JPG. Or, use powerpoint, and SAVE AS a jpg file.
In miktex, diagrams are simple. Just insert:
\begin{figure}
\centering
\includegraphics[width=80mm]{options2.jpg}
\caption{Figure 2: Pointwise and Extremum Riskiness}
\end{figure}
or even just
\includegraphics[width=80mm]{options2.jpg}
To get the caption not to automatically number, use:
\usepackage{ccaption} \captiondelim{}\renewcommand{\thefigure}{}
\renewcommand{\figurename}{}
The folowing is useful to get figures put on the same page with text
instead of
off on their own pages.
\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
----------------------------------------------------------------------
POWERPOINT
http://www.ecs.soton.ac.uk/~srg/softwaretools/presentation/TeX4PPT/
This is the best of the two tex powerpoint programs. Free, and easy
to install.
Needs Powerpoint 2002.
----------------------------------------------------------------------
USING SUBSCRIPTS AND SUPERSCRIPTS TOGETHER
How to make $x^i_j$ different from $x_j^i$.
$X_i^{\phantom{i}j}$ and $X^j_{\phantom{j}i}$?
"Some
useful tips and tricks in LaTeX".
----------------------------------------------------------------------
INTEGRALS AND PRODUCTS AND SUMMATIONS IN FRACTIONS
Q: If I use a \prod or \int within a \frac{}{} they end up very
small
with the sub/superscripts alongside rather than above or below.
Answer:
\frac{\displaystyle \int_a^b dx f(x)}{\displaystyle \prod_{i=1}
^{\infty} a_i}
"Some useful tips and tricks in LaTeX".
More generally:
----------------------------------------------------------------------
TILDES
FOR WIDE TILDE ON TOP OF SOMETHING: \widetilde{12345}
FOR TILDE IN TEXT, NOT on top of something: $\sim$ . This is what to
use in URL's.
\textasciitilde is for a high tilde (no $ needed). $\sim$ is for a
midlevel tilde.
For Tilde in text, on top of the next letter: \~
----------------------------------------------------------------------
PUTTING THINGS ON THE SAME PAGE (Does this really work?)
Put \begin{samepage}...\end{samepage} around the whole mess.
"Some useful tips and tricks in LaTeX".
----------------------------------------------------------------------
MAXIMIZING F(X) BY CHOICE OF X
$$
{Maximize \atop x } x^2-x
$$
$$
{Maximize \atop \scriptstyle{x} } x^2-x
%Tthe scritpstyle is too small, really.
$$
----------------------------------------------------------------------
BRANCHING "IF" DEFINITIONS
Sometimes I want to use a big bracket to say X=2 if Y<3 but X=5 if
Y \geq 3.
Here's the style for that:
\begin{tabular}{ll}
$ \pi_i =$& $\left\{ \begin{tabular}{lll}
$V-x_i$ & if
$T(x_i) < Min\{ T(x_j, T(x_k) \} $ & (Firm $i$ gets the patent)\\
& & \\
$\frac{V}{2} - x_i$ & if $T(x_i) = Min \{T(x_j),T(x_k)\} $ & (Firm
$i$ shares
the patent
\\
\end{tabular} \right.$\\
\end{tabular}
----------------------------------------------------------------------
PROOF END SYMBOL
At the start, have:
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
Then put $\blacksquare$ at the end of the proof.
----------------------------------------------------------------------
FORMAT FOR A TWO-BY-TWO GAME
\begin{center} {\bf Table 11: IMF Aid }
\begin{tabular}{lllccc} & &
&\multicolumn{3}{c}{\bf Debtor}\\
& & & Reform & & Waste \\
& & Aid & 3,2 & & -1,3 \\
& {\bf IMF} & & & & \\
& & No Aid & -1,1 & & 0,0 \\
& & & & & \\
\multicolumn{6}{l}{\it Payoffs to: (IMF, Debtor).}\\
\end{tabular}\\
\end{center}
----------------------------------------------------------------------
RAGGEDRIGHT, LEFT JUSTIFICATION
The tex default is to right- and left-justify the page, which looks
very professional. I just read, though, that psychologists find this
actually slows down reading compared to just left-justifying, because
people are not used to the diverse spacing of letters and words that
is required for uniform margins on both sides. Also, a raggedright
looks better for working papers, I think.
The command for that is
\begin{raggedright}
\parindent 24pt
\parskip 10pt
\end{raggedright}
You need to put the parindent and parskip commands AFTER the
begin{raggedright}
----------------------------------------------------------------------
PROCESSING TEX
The free Miktex (http:
//www.miktex.org/) looks to be an excellent latex and tex Windows
processor program. I've been using SWP, and putting figures in looks
to work better in Miktex. Miktex gets PDF's right, which my version of
SWP does not always do, and it processes straight from myfile.tex to
myfile.pdf. On the other hand, it has some problems, noted below,
which make it unhandier to use.
I think I've foudn the best solution. In textpad, create a new TOOL
in CONFIGURE-PREFERENCES. Choose ADD, then DOS COMMAND, then write
pdflatex $file
(1) I have a suggestion for the standard installation instructions:
say more about the Windows command prompt. I haven't used it for
years, though I happened to remember it was in Accessories. Also, the
user should know that he can change the default directory in teh
command prompt to wherever he keeps his tex input files-- say,
d:/smith/latex-input, using the Properties (reachable by right
clicking the command prompt).
(2) The command prompt requires you to type in all your commands,
which is burdensome if they are long, e.g.,
pdflatex D:
\_home\_HomeWD\INCOMING\FIGURECOPY/myfilewithalongname.tex
You can't copy and paste in the usual way with CTRL-C and CTRL-V. What
you can do, though is to copy to the clipboard with CTRL-C and then
paste by rightclicking on the Command Prompt program and choosing
PASTE.
I will put a comment line like this at the start of my tex files:
% pdflatex chap07_MoralHazard.tex
then I can copy all but the % part and paste it into the command
prompt, and it will process chap07_MoralHazard.tex and write to
chap07_MoralHazard.pdf
(3) Something better would be a graphic interface to replace the
command prompt. I don't know how to write such an interface, but here
is what it would be: It would be simple: just a window in which the
user could do two things:
1. Browse and choose a tex file to process, e.g.,
myfilewithalongname.tex, instead of having to type in the full name in
the command prompt, and instead of having to have it in the command
prompt's directory.
2. Issue the processing command--- most simply "latex
myfilewithalongname.tex", or "pdflatex", or others that might be
useful. There should be two to five choices, and the user would check
the box of the command he wants to use.
The command would take the file from (1) and put the output in the
same directory as the input.
The interface could be fancier, but that covers what the user needs
every single time he uses Miktex, and it would save a lot of tricky
typing.
(4) Miktex is fouled up by carriage returns, even ones that are not
hard breaks. Thus, before I tex my files using it I need to strip off
all the carriage returns, thus making all my equations, nicely
separated into separate lines for visibility, into unreadable
paragraphs
With the help of Alan, I solved this problem. What I had to do was to
save my file as DOS or UTF-8 instead of as ANSI.
----------------------------------------------------------------------
SIZING
PRODUCTS
Use \prod, NOT \Pi , with {\displaystyle
\prod_1^3} if necessary.
THE LARGE CURLY BRACKET:
\left\{
THE LARGE SUMMATION SIGN: Use \sum, NOT \Sigma, with {\displaystyle
\sum_1^3} if necessary.
For integrals, to get them in the large style in Arrays or
in text use {\displaystyle \int_0^1}.
\begin{array}{ll}
\pi_1^d & ={\displaystyle -c + \int_0^{Eu} \left( \int_v^z (u-
v)
f(u) du \right) g(v) + \int_{Eu}^v \left( \int_v^z( u-v) f(u) du
\right) g(v)dv. }\\ & \\
&= -c + A_1 + A_2. \\
\end{array}
To change size of any operator like { | } [ ] ( ), one need to use
commands
\big
\Big
\bigg
\Bigg
For example, \bigg| These command are in order of increasing size.
This
is especially good for |, since it can take superscripts and
subscripts
properly then, unlike with \left|
----------------------------------------------------------------------
EQUATION ARRAYS
\begin{eqnarray}
F(x) &= &3x^2\\
& & \nonumber \\
& =& 4z
\end{eqnarray}
Use \begin{eqnarray}* to not have any nubmers. Note that there are
always 3 columns. The newer versino of this is
\begin{align}...\end{align}, which is easier to type and they say
looks better and handles long equations better so the euqation number
doesn't get overwritten.
----------------------------------------------------------------------
PAGE HEADERS
\pagestyle{myheadings}
\markboth { Ramseyer-Rasmusen }{ Ramseyer-Rasmusen}
OR,
\pagestyle{myheadings}
\markboth { } {$\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
\;
\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
\;
\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;
\;
\;\;\;\;\;\;$
Lyon and Rasmusen }
% these two things in conjunction put the page nubmers at the upper %
right of each page, with "Lyon and Rasmusen" just before them.
----------------------------------------------------------------------
EQUATION STYLES
\documentclass[12pt,epsf,leqno, fleqn]{article}
This is for left equation numbering, and for not centering the
equations but rather putting them towards the left at a fixed indent
from the margin. \documentclass is always better than \documentstyle,
because it permits packages to be used. Also, this does 12 pt type.
----------------------------------------------------------------------
DOUBLE SPACING
\baselineskip 24pt
This goes AFTER Begin Document.
--------------------------------------------------------
\pagestyle{empty}
This last command will remove page numbers. (put
before the Begin Document)
----------------------------------------------------------------------
\topmargin -1.5in
----------------------------------------------------------------------
TYPE FONT SIZES
By default, LaTeX uses 10pt Computer Modern Roman as its base font.
You can change this base font by using the 11pt or 12pt style option
on the documentclass line like this:
\documentclass[11pt]{article}
10pt Default 11pt Option 12pt Option
\tiny 5pt 6pt 6pt
\scriptsize 7pt 8pt 8pt
\footnotesize 8pt 9pt 10pt
\small 9pt 10pt 11pt
\normalsize 10pt 11pt 12pt
\large 12pt 12pt 14pt
\Large 14pt 14pt 17pt
\LARGE 17pt 17pt 20pt
\huge 20pt 20pt 25pt
\Huge 25pt 25pt 25pt
DIFFERENT FONTS: But these do not reliably work.
{\sf sans serif. Christianity depends ...}
{\tt typewriteer. might occur. }
{\rm Roman. Christianity depends on ancient }
I like the palatino font better than Times New Roman. Here is a
package that uses it, and which uses Helvetica for its sans serif
font: \usepackage{mathpazo}
For cursive font, use the pbsi package and \textbsi{ a command like
this.}
\usepackage[T1]{pbsi}
MATH FONTS
These are different from the others (LARGE, etc.)
\textstyle - default in the running text and in array environment
\displaystyle - default for displayed equations
\scriptstyle - default for first-level sub and superscripts
\scriptscriptstyle - default for higher-level sub and
superscripts
----------------------------------------------------------------------
"Left side text \hfill right side"
The hfill command is good for putting text on each side of a page.
" ~ \hfill right side"
The tilde ~ can be used for a space. "\;" works just as well. I
think \quad or \\quad works better in math mode-- maybe it's
intelligent and makes the space a nice-looking length.
----------------------------------------------------------------------
FOOTNOTES WITH SYMBOLS
This will make the first footnote an asterisk and the second one a
dagger,and
then goes back to the default, nubmers, starting with number 1.
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
Here's is one\footnote{starred note} and here is a
second.\footnote{Daggered footnote}
\renewcommand{\thefootnote}
\setcounter{footnote}{0}
To do asterisk footnotes, use the command:
Here is the text$^*$\footnotetext{$^*$ Here is the
footnote}.
----------------------------------------------------------------------
FOR OVERHEADS AND HANDOUTS
\reversemarginpar
\topmargin -1in
\oddsidemargin -.25in
\textheight 8.7in
\textwidth 7in
\pagestyle{empty}
----------------------------------------------------------------------
LISTS
\listoffigures
\listoftables
\begin{description}
\item[Oranges:] a fruit that Amelia likes a lot, just as she likes
grapes and pickles.
\item[Lettuce:] something Amelia does not like.
\end{description}
\begin{verse}
This is the first line of a poem\\
Here is the second, hwich is so long that it runs over on
to the next
line, where it will be indented.\\
And here is the third.\\
\end{verse}
----------------------------------------------------------------------
\begin{comment}% I need to have \usepackage{verbatim}
This is a comment.
\end{comment}
----------------------------------------------------------------------
The table is on page \pageref{t1}.
%This prints the page number where label t1 is found.
----------------------------------------------------------------------
{\it Here is some italics but with \emph{these words} emphasized in
Roman.} I can also use the same command to get \emph{italics} in the
middle of Roman words.
----------------------------------------------------------------------
Use $\Beta$ in tex, rather than $B$, so I can globally change it
easily later.
----------------------------------------------------------------------
http://www.mackichan.com/
Here is how to make a tex DVI file into a
postscripgt file:
dvips 9.dvi -Z -o myfile.ps
The -Z compresses it. The postcript files are quite large, though.
(394K from
70 K, for example, with 3 diagrams). The -Z commadn will comrpess it
about 40
prcent, I think, and it will still pirint drictly.
TO TURN A DVI FILE INTO AN ASCII FILE:
uuencode 9.dvi 9.dvi> negot.asc
----------------------------------------------------------------------
The command @{} kills the space between columns in a table and
replaces it with
whatever is in curly brackets. It can be used to cleverly align tables
around
decimal points, thus:
\begin{table} [! h] %This puts the table right here, not
floating.
Or just try:
\begin{table}[h]
\begin{table}[! h t] %This puts the table here or top
\begin{figure}[! b f] %This puts it at the bottom or on a
float page.
\begin{table}[!b] \label{t1}
\begin{tabular} {l r @{.} l}
Variable & Mean\\
X & 1 & 234\\
Y & 23 & 1\\
Z & 1456 & 34567\\
\end{tabular}
----------------------------------------------------------------------
\caption{The World in 1812} %This will appear as Table 1:
The World...
\end{table}
----------------------------------------------------------------------
(I Haven't tried this)
I need to write large tables that span many pages; I tried the tabular
environment but found out that it put everything on one page, with
most of the text going down the drain, i.e. below the physical page.
Is there a way of doing this smoothly, that is, without breaking the
large table into smaller ones that would approximately fit into one
page each? Answer: For LaTeX2e: You should look into either
supertab.sty or longtable.sty, both can be found in:
/usr/um/generic/tex3.141/latex2e/tools/
with documentation in:
/usr/um/generic/tex3.141/latex2e/tools/doc/
in the form of .dtx and .dvi files, you can run LaTeX on the .dtx
files, or simply look at the .dvi files.
----------------------------------------------------------------------
PACKAGES
To put in a package: All packages are located in TCItex/tex/latex . I
am not sure if I can put a new one in with a new directory, and it
will get read in. Tha owrked at the office, but not at home, f or
a0poster. I can just use ADD to get verbatim.
A0poster is good for large font sizes.
\documentclass[article ]{a0poster}
\usepackage{a0size}
----------------------------------------------------------------------
In TEXTPAD, hard breaks are put in, sometimes in
awkward places, so I may have to do some fiddling to make sure key
commands do not get cut across lines.
----------------------------------------------------------------------
The easiest way to get headings of funny 'sections' such as prefaces
in the table of contents is to use the counter secnumdepth described
in Appendix C of the LaTeX manual. For example:
\setcounter{secnumdepth}{-1}
\chapter{Preface}
Of course, you have to set secnumdepth back to its usual value (which
is 2 in the standard styles) before you do any 'section' which you
want to be numbered.
Similar settings are made automatically in the LaTeX book class by the
\frontmatter and \backmatter commands.
This is why it works: \chapter without the star does
1.put something in the .toc file;
2.if the secnumdepth counter is greater than or equal to zero,
increase the counter for the chapter and write it out.
3.write the chapter title.
----------------------------------------------------------------------
From the NoT os short intro to Latex 2e
\include {chap2.tex, chap2.tex, chap3.tex}
\includeonly{chap2.tex} %This means only chap2.tex will be
included.
This does not work in SWP.
----------------------------------------------------------------------
For packages:
http://www.ctan.org/tex-archive/help/Catalogue/alpha.html
\usepackage{boxedminipage}
\begin{boxedminipage}[c]{0.6 \linewidth} %box is .6 of entire line
text that I want to box, such as a game description, goes here.
\end{boxedminipage}
----------------------------------------------------------------------
ADVICE TO BEGINNERS
Do not use commands like \section{sd}, \theorem{sd} and so forth. In
reading the ms, this means you cannot see th enumber of the section or
theorem. It is easier, for articles as opposed to books, just to use
boldface and noindent directly.
----------------------------------------------------------------------
\begin{tabbing}
% set the tab positions
\hspace {1in} \= \hspace {1in} \= \hspace {1in} \= \hspace {1in}
\\
one \> be \> due to \> differences,\\
one \> to \> reputation \> the sort\\
\end{tabbing}
----------------------------------------------------------------------
MY STANDARD FORMATTING HEADER:
\documentclass[12pt,epsf]{article}
\usepackage{mathpazo} % for palatino font
\usepackage{verbatim} % for \begin{comment} feature.
\usepackage{ccaption} \captiondelim{}\renewcommand{\thefigure}{}
\renewcommand{\figurename}{} %for good figure captions
\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
\usepackage{hyperref} \hypersetup{breaklinks=true, pagecolor=white,
colorlinks=
true, linkcolor=black, hyperfootnotes= false, urlcolor=blue }
\urlstyle{rm}
\usepackage{graphicx} %for pictures
\usepackage{amsmath}
\usepackage{amssymb}
\reversemarginpar
\topmargin -.3in
\oddsidemargin -.1in
\textheight 8.5in
\textwidth 7in
\baselineskip 16pt
\begin{document}
\titlepage
\begin{raggedright}
\parindent 24pt
\parskip 10pt
adsfqdfadfasdfasdfdsaf
\end{raggedright}
\end{document}
----------------------------------------------------------------------
http://www.usq.edu.au/users/leis/notes/latex/ has good latex
diagram instructions.
times Times, Helvetica, Courier
pslatex same as Times, but uses a specially narrowed Courier. This is
preferred
over Times because of the way it handles Courier.
newcent New Century Schoolbook, Avant Garde, Courier
palatino Palatino, Helevetica, Courier
palatcm changes the Roman to Palatino only, but uses CM mathematics
Small Capitals \textsc{words to be in small capitals} puts the words
in the
brackets in small capitals
\textsl{words to be slanted}
http://www.image.ufl.edu/help/latex/fonts.shtml
----------------------------------------------------------------------