Last modified: October 2002
Why & What
I keep learning new keyboard shortcuts and other ways of making the
emacs lifestyle sweeter. This is an attempt to share.. :-)
Some of the tricks are not precisely about "latexing_with_emacs", but
might be for general latexing, general editing with emacs, or even
general unix/linux.
In general, the tips are ordered starting with simpler and moving on
to the more arcane.
Tricks & Tips: Basic
-
While typing, run latex early, run latex often, after every
couple of lines of typing. It is much easier to spot latex mistakes
this way, and saves the time needed to wade through large amounts of
latex trying to weed out the mismatch or other mistake.
- The Most Useful Shortcut!!
For those people who run latex by going to a shell, and running a
"latex myfile.tex" command, I am going to make your life much
faster... learn the sequence
C-x C-s
C-c C-f
C-x 1
C-x C-s saves the file, C-c C-f runs latex on it, opening a split
window in the process, and C-x 1 unsplits back to a single window
hiding the "tex-shell" buffer.
- Viewing the document: dvi & postscript.
I recently found a colleague running dvips after each latexing, and
then opening the postscript file. Waste of time!
Instead, keep the dvi file open using xdvi. Each time you re-latex the
latex file, the dvi display updates itself!
Almost WYSIWYG!!
- Switching between windows.
Even if you did away with the need to go to a shell/terminal using the
habits mentioned in the last two tips, you still have to switch back
and forth between the xdvi window and the emacs window. Do you use
the mouse for switching between windows?
On most modern window managers, ALT-TAB will cycle between windows.
This works in KDE, Gnome, and also for many of the simpler no-frills
window mangers, like icewm, my personal favorite for the last year or
so.
Why waste energy moving your hand away from the keyboard? :-)
- The AMS-LaTeX packages.
If you latex a fair amount of mathematical stuff, but are not
using the AMS math packages, something is definitely wrong.
The AMS "short math guide" needs to be handy; you can get it at the
AMS
short-guide page.
It might also be worthwhile to browse through the more general
AMS latex pages .
Being a thoroughly modern person in terms of typesetting :-) I now
always have \usepackage{amsmath,amssymb} immediately after my
beginning \documentclass{}.
- Still using \begin{eqnarray} ... \end{eqnarray}?
The AMS-LaTeX guide discourages using the eqnarray environment, because it
is so ugly and unwieldy! Times have changed!!
Instead, use one of the AMS environments: multline, split,
gather, align. Whichever is suitable to your multiline equation(s). And any
of these will look much better than whatever you were going to produce
with eqnarray!
- MULTILINE or MULTLINE?
Common mistake when you first start using the AMS packages. For some
reason their environment is called multline, without an "i" after the "t".
- Justifying text.
In most major modes of emacs, the paragraph (on which your cursor is)
can be justified using
M-q
-
-
-
-
Tricks & Tips: Intermediate
- Do shortcut definitions for \begin{equation}, \end{equation},
make sense any more?
- Bored at having to type \end{*%*}?
If you've already typed \begin{*%*}, where *%* is any environment, use
C-c C-e
and emacs will put in the \end{*%*} for you. Isn't that brilliant?
- Tired of \begin{*%*} also?
Check out
C-c C-o
-
GNU Emacs Reference Card. [Emacs.]
If you don't have the GNU Emacs Reference Card printed and pasted on
the wall next to your terminal/machine, maybe you should. It's a
great way to learn one more new keyboard shortcut each month, when you
have last month's shortcut already internalized into a habit.
- Tired of .aux, .tex~, and .log files?
- Syntax highlighting.
You might find that you like your latex syntax highlighted in color.
(I don't personally find it very useful, but you might, in catching
syntax mistakes or as eye-candy.)
For some perverse reason, the syntax-highlighted mode in emacs is
known as "global-font-lock-mode". You can do
M-x global-font-lock-mode
to toggle between syntax hilite & non-hilite modes.
(I hope you know to tab for command completion rather than type in all
of global-f... :-)
For mouse-lovers, Help -> Options -> Global-Font-Lock, on the menu.
- Switching Between Buffers. [Emacs.]
-
LaTeX-Specific
- Including eps files Inline
Like all sensible people, I usually use the graphicx package for
including eps files, but there was one case I had to use the epsfig
package. This was to include eps files inline to form one equation having
several graphics elements. Maybe there is some way to do this using
graphicx also, but I don't know it.
-
-
Personal home page: Masudul Haque (torun).
Email (replace ATT by @ and remove spaces):
haque ATT phys.uu.nl