Tools and Tips for Writing with LATEX

Rob MacLeod


1 Introduction

This is my own personal take on what tools I have found useful when writing scientific documents using
LaTeX. Please note, this is just my opinion, although it is based on almost 20 years of using these tools and in watching many of my students learn to use LATEX in the ``real world'' of academic research.

I'd love to hear about other tools I have not come across so please feel free to let me know at macleod@cvrti.utah.edu.

2 A Typical Email Exchange

Here is the way I usually get drawn into expressing my onions on this topic>

Sender: Student X (in order to protect the innocent)
To: Rob MacLeod <macleod@cvrti.utah.edu>
Subject: latex

Hi Rob,

I'm putting together a toolkit for managing research information. As I suspect you've been through this process before, I hope you don't mind offering some insight on a couple details: Do you use an editor for latex? More specifically, do you use some kind of word processor that puts tags in the text for you, or do you just type the tags yourself in a text editor?

I've noticed you use latex2html for conversion. Does this usually work for equations? I've read through the latex to html authoring guide, so I'm aware of many ways to get equations into html. Just curious what your success rate is with latex2html.

I was hoping to find something like WordPerfect 5.1 for Latex: text on the top half of the screen, text with codes on the bottom, and an equation editor that more or less renders good equations with almost plain text. I haven't found it yet - hence the questions.

Thanks,
X

Here is a typical reply:

Subject: Re: latex
From: Rob MacLeod <macleod@cvrti.utah.edu>
To: X

Hi X,

On 1/20/03 9:04 PM, "X" wrote:

> Hi Rob,
> 
> I'm putting together a toolkit for managing research information.  As I
> suspect you've been through this process before, I hope you don't mind
> offering some insight on a couple details:
> Do you use an editor for latex?  More specifically, do you use some kind
> of word processor that puts tags in the text for you, or do you just type
> the tags yourself in a text editor?

Yes, I have promised myself and others to write this up many times, but not yet managed. Perhaps this time!

Yes, I use emacs and also, very important, the set of emacs tools that Nelson Beebe wrote and provides on his web site

http://www.math.utah.edu/ beebe/software/emacs-tools.html

Look for the latex.el file and install calls to it in your .emacs file, something like this:

;=====================================================================
; Hooks for the Tex (LaTeX) mode
; The default TeX mode should be LaTeX
(load-library "~/emacs/lisp/latex/latex")
(setq TeX-default-mode 'LaTeX)
(setq LaTeX-mode-hook
      '(lambda()
     (abbrev-mode 1)
     (setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 \
                 52 56 60 64 68 72))
     (setq fill-column 75)
     (setq LaTeX-newline-after-opening-delimiter nil)
     (setq LaTeX-2e t)
     ))

; Load the LaTeX letter mode
;(load (concat "~/emacs/lisp/letter") t t nil)
(load (concat "letter") t t nil)
(setq personal-letter-template "~/text/letters/letter-template.ltr")

;========================================================================
;; My own customization of make-LaTeX-document command to add some useful
;; formatting.
;; Last update: Sun Dec 15 14:27:18 MST 1991

(setq make-LaTeX-document-hook
      '(lambda()
     (turn-on-font-lock)
        (insert "% -*-latex-*-\n")      ;must be lower-case for autoload
        (goto-char (point-max))         ;on find-file to work
        (insert "% Document name: "
                (if (null buffer-file-name)
                    "unknown"
                  buffer-file-name)
                "\n")
        (insert "% Creator: " (user-full-name)
                " [" (user-login-name) "@cvrti.utah.edu]\n")
        (insert "% Creation Date: " (current-time-string))
    (insert"
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\\usepackage{html}
\\textheight 9.5in
\\textwidth 6.5in
\\topmargin -.5in
\\oddsidemargin 0in
\\setlength{\\parskip}{\\smallskipamount}
\\newcommand{\\eg}{{\\em e.g.,}}
\\newcommand{\\ie}{{\\em i.e.,}}
\\newcommand{\\etc}{{\\em etc.,}}
\\newcommand{\\etal}{{\\em et al.}}
\\newcommand{\\degrees}{{$^{\\circ}$}}
\\newcommand{\\splitline}{\\begin{center}\\rule{\\columnwidth}{.7mm}\\end{ce
nter}}
%% Usage:  \\comm{Name}{Remarks}
\\newcommand{\\comm}[2]{\\bigskip
                      \\begin{tabular}{|p{11cm}|}\\\\\\hline
                      \\multicolumn{1}{|c|}{{\\bf Comment by #1}}\\\\
\\hline
                      #2\\\\ \\hline
                      \\end{tabular}
                      \\bigskip }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
)))

;=======================================================================
;;; Add bibtex mode unconditionally; it is already bound to text-mode
;;; and we can do better than that.
(delq (assoc "\\.bib$" auto-mode-alist) auto-mode-alist)
(setq auto-mode-alist
      (cons (cons "\\.bib$" 'bibtex-mode) auto-mode-alist))
(autoload 'bibtex-mode  "~macleod/emacs/lisp/bibtex/bibtex"
;(autoload 'bibtex-mode  "bibtex"
  "Enter BibTeX mode for bibliography editing." t nil)

(setq bibtex-mode-hook '(lambda ()
              (setq comment-end "")
              (setq comment-start "%% ")
              (setq comment-start-skip "%+ *")
              (setq bibtex-include-OPTcrossref nil)
              (setq bibtex-include-OPTkey nil)
              (setq bibtex-include-OPTannote nil)
              (setq bibtex-include-robnote t)
              (load "~macleod/emacs/lisp/bibtex/bibtex-support")
              (load "~macleod/emacs/lisp/bibtex/bibtools")
;              (load "bibtools")
;              (load "bibtex-support")
              ))

Note this also loads bibtex support, which Nelson offers at the same web site and which I thoroughly endorse.

There is also a package called Auxtex that may still be out there and it, too, is cool; kind of a matter of taste. But for god's sake, use one of them!!

http://www.nongnu.org/auctex/

There are other editors for specific platforms that are LaTeX aware and I know them only for the Mac. There is even a website for Mac LaTeX called

http://www.esm.psu.edu/mac-tex/

And there are some other links from my docs web page at

http://www.cvrti.utah.edu/~macleod/docs/

> I've noticed you use latex2html for conversion.  Does this usually work
> for equations?  I've read through the latex to html authoring guide, so
> I'm aware of many ways to get equations into html.  Just curious what your
> success rate is with latex2html.

It is not perfect but at present the only real way to do it. The support for latex2html is also very good with an overactive mailing list and one brave soul who really does listen, respond, and fix the code.

 
> I was hoping to find something like WordPerfect 5.1 for Latex: text on the
> top half of the screen, text with codes on the bottom, and an equation
> editor that more or less renders good equations with almost plain text.
> I haven't found it yet - hence the questions.

There is such a thing for the mac and I used it for a while but ended up very quickly disliking it. And it actually goes against the purpose and philosophy of LaTeX for writing. The idea is that composition and typsetting are completely different processes and one should focus on them separately to get the best results. So composing and editing content in emacs with just the text in front of your is the best way to write. Sitting down with the file, again in emacs, the latex engine, and xdvi (or gs) and iterating is the best way to get layout and look and feel covered. WYSIWYG mixes them and hence can be very distracting. I believe in this idea and find it works very well for me.

A final pointer is to a script I have that handles all steps of the editing and typsetting process. It calls all the required programs and even offers you a list of local printers to send output when you are done. I use it all the time on all platforms and find it worthwhile. It is called texit and points to a script in my  macleod/bin directory. I am never sure how bulletproof it is when others go to use it, but try it and see what happens. I'd be happy to get it working for your particular conditions.

Hope that helps,

Rob.

3 The Tools

3.1 Emacs

3.1.0.1 Editing LATEX

3.1.0.2 Managing BibTeX

3.2 Texit

3.3 BibTeX

4 The Philosophy

About this document ...

Tools and Tips for Writing with LATEX

This document was generated using the LaTeX2HTML translator Version 99.2beta6 (1.42)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html -split 3 -no_white -link 3 -no_navigation -no_math -html_version 3.2,math -show_section_numbers latex-tools

The translation was initiated by Rob MacLeod on 2003-01-20


Rob MacLeod 2003-01-20