How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal This talk: two tools for...

30
How to type papers How to type papers Jonathan Herzog Jonathan Herzog 11 Sept 2003 11 Sept 2003

description

Introduction to (X)Emacs  Emacs, XEmacs: Really the same thing Both LISP engines + lots of LISP libraries Both LISP engines + lots of LISP libraries Can write/load libraries to change behavior Can write/load libraries to change behavior  This talk: focus on modes Specialize behavior for particular file type Specialize behavior for particular file type LaTeX, c++, prolog, text, etc.LaTeX, c++, prolog, text, etc. Each window has exactly one main mode Each window has exactly one main mode Can toggle on/off arbitrarily many secondary modes Can toggle on/off arbitrarily many secondary modes

Transcript of How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal This talk: two tools for...

Page 1: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

How to type papersHow to type papersJonathan HerzogJonathan Herzog

11 Sept 200311 Sept 2003

Page 2: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Man: tool-using animalMan: tool-using animal This talk: two tools for writing papersThis talk: two tools for writing papers Various (X)Emacs modesVarious (X)Emacs modes

Help you actually write the LaTeXHelp you actually write the LaTeX Concurrent Versions SystemConcurrent Versions System

Help multiple authors collaborate plainlesslyHelp multiple authors collaborate plainlessly

Page 3: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Introduction to (X)EmacsIntroduction to (X)Emacs Emacs, XEmacs: Really the same thingEmacs, XEmacs: Really the same thing

Both LISP engines + lots of LISP librariesBoth LISP engines + lots of LISP libraries Can write/load libraries to change behaviorCan write/load libraries to change behavior

This talk: focus on This talk: focus on modesmodes Specialize behavior for particular file typeSpecialize behavior for particular file type

• LaTeX, c++, prolog, text, etc.LaTeX, c++, prolog, text, etc. Each window has exactly one Each window has exactly one mainmain mode mode Can toggle on/off arbitrarily many Can toggle on/off arbitrarily many secondarysecondary

modesmodes

Page 4: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Font-lock modeFont-lock mode Secondary modeSecondary mode Colors text to indicate syntaxColors text to indicate syntax

Comments one colorComments one color Keywords another, etcKeywords another, etc

Invoke via Invoke via .emacs.emacs (best way) or (best way) orM-x font-lock-modeM-x font-lock-mode

Page 5: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Flyspell modeFlyspell mode Another secondary modeAnother secondary mode Spell-checks each word as typedSpell-checks each word as typed

Highlights unrecognized wordsHighlights unrecognized words Can learn new words Can learn new words

Forever, for session, or file-specificForever, for session, or file-specific Invoke via Invoke via .emacs.emacs (best) or (best) or

M-x flyspell-modeM-x flyspell-mode

Page 6: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Line lengths and word-wrapLine lengths and word-wrap (X)Emacs won’t limit line length on its own(X)Emacs won’t limit line length on its own Auto-fill mode: turns on word-wrapAuto-fill mode: turns on word-wrap

Invoke via Invoke via .emacs.emacs or or M-x auto-fill-modeM-x auto-fill-mode

(By request) balance line-lengths (“fill”) for (By request) balance line-lengths (“fill”) for entire paragraph:entire paragraph:

M-qM-q

Page 7: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

AUCTeXAUCTeX (X)Emacs has main mode for LaTeX(X)Emacs has main mode for LaTeX

Usually automatically invoked for Usually automatically invoked for .tex.tex AUCTeX: extends standard LaTeX modeAUCTeX: extends standard LaTeX mode Best if invoked via Best if invoked via .emacs.emacs Many, many nice featuresMany, many nice features

Page 8: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Text insertionText insertion Section commandsSection commands Environment commandsEnvironment commands \item\item commands commands Font commandsFont commands Any LaTeX commandAny LaTeX command

Provides tab-completion and option-Provides tab-completion and option-prompting for all of aboveprompting for all of above

Page 9: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Symbol insertionSymbol insertion Optional math mode (secondary)Optional math mode (secondary) Insert common symbols, greek letters via Insert common symbols, greek letters via `̀-prefix-prefix `-b`-b inserts inserts \beta\beta,, `-G`-G inserts inserts \Gamma\Gamma,, `-i`-i inserts inserts \in\in, etc., etc.

Page 10: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Editing assistanceEditing assistance Highlights matching Highlights matching $$

Automatically doubles Automatically doubles $$ when needed when needed Highlights matching parenthesisHighlights matching parenthesis Comment/uncomment regionsComment/uncomment regions Can automatically Can automatically \end\end current environment current environment Maps Maps ““ to to ```` or or ’ ’’ ’ (LaTeX quote) (LaTeX quote)

Etc. Etc.

Page 11: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

CompilingCompiling C-c C-cC-c C-c will Do The Right Thing will Do The Right Thing

Calls Calls latexlatex, , bibtexbibtex, , printprint,, etc.etc. Can override if it guesses wrong (rare)Can override if it guesses wrong (rare) Works even for multi-file documentsWorks even for multi-file documents

In event of LaTeX errors:In event of LaTeX errors: C-c `C-c ` will display error will display error andand error locationerror location Speeds up debugging considerablySpeeds up debugging considerably

Page 12: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Automatic customizationAutomatic customization If you want it to, it can adapt to your definitionsIf you want it to, it can adapt to your definitions

Parse your filesParse your files Find all instances of Find all instances of \newcommand\newcommand, , \\newenvironmentnewenvironment, etc., etc.

Make them available for automatic insertion, tab-Make them available for automatic insertion, tab-completion, etccompletion, etc

Can also have it automatically do same for your Can also have it automatically do same for your standard macro filestandard macro file

For more information, read AUCTeX manualFor more information, read AUCTeX manual

Page 13: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Reftex modeReftex mode Secondary mode that works well with Secondary mode that works well with

AUCTeXAUCTeX Also best started from Also best started from .emacs.emacs Handles all referencesHandles all references

\ref\ref, , \label\label, , \cite\cite, etc, etc Example: can make interactive table of Example: can make interactive table of

contents!contents! Useful for jumping to specific sectionsUseful for jumping to specific sections

Page 14: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

More Reftex modeMore Reftex mode Automatically labels sections when inserted via Automatically labels sections when inserted via

AUCTeXAUCTeX Automatically inserts Automatically inserts \ref\ref commands commands

Pick label via tab-completionPick label via tab-completion Or pick from context-sensitive list (“Section”, “Table”, Or pick from context-sensitive list (“Section”, “Table”,

etc.)etc.) Automatically inserts citationsAutomatically inserts citations

Prompts for stringPrompts for string Parses .bib filesParses .bib files Makes list of all matching bibtex entriesMakes list of all matching bibtex entries

Page 15: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

More informationMore information All packages installed on theory systemsAll packages installed on theory systems

Caveat: AUCTeX installed for Caveat: AUCTeX installed for \usr\local\bin\\usr\local\bin\emacsemacs

Not the default emacsNot the default emacs

Sample Sample .emacs.emacs, demo available on my web , demo available on my web pagepage

Emacs’ internal documentation system helpfulEmacs’ internal documentation system helpful Google usually does the right thingGoogle usually does the right thing

Page 16: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Concurrent Versions Concurrent Versions SystemSystem

Page 17: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Why use CVS?Why use CVS? Imagine two people write a paper togetherImagine two people write a paper together What do they do?What do they do?

Both edit same file, save over each otherBoth edit same file, save over each other Edit different copies, lose changes, screw up Edit different copies, lose changes, screw up

mergingmerging Make one person wait while other edits.Make one person wait while other edits. Or use CVSOr use CVS

Page 18: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

What CVS doesWhat CVS does Holds master copy Holds master copy Gives working copy to each authorGives working copy to each author Receives all changesReceives all changes

Merges changes into master copyMerges changes into master copy Distributes changes to other authorsDistributes changes to other authors Authors do no merging themselvesAuthors do no merging themselves

All authors can work simultaneouslyAll authors can work simultaneously Never lose editsNever lose edits

Page 19: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

VocabularyVocabulary Master copy exists in “repository”Master copy exists in “repository” Repository can hold multiple projects Repository can hold multiple projects

(“modules”)(“modules”) Authors “check out” modules, get local “working” Authors “check out” modules, get local “working”

copiescopies Changes are “committed” back to repositoryChanges are “committed” back to repository

Must provide “log” message describing changesMust provide “log” message describing changes Working copies can be “updated” to receive Working copies can be “updated” to receive

changes made by otherschanges made by others

Page 20: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Simple exampleSimple example Moses and I have up-to-date copiesMoses and I have up-to-date copies We both make We both make non-conflictingnon-conflicting changes changes I commitI commit

Moses no longer up-to-dateMoses no longer up-to-date Moses tries to commit, CVS refusesMoses tries to commit, CVS refuses Moses updates, receives my changesMoses updates, receives my changes

Moses now up to dateMoses now up to date Moses commitsMoses commits I updateI update

Get Moses’ changesGet Moses’ changes

Page 21: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

ConflictsConflicts What if Moses and I make conflicting What if Moses and I make conflicting

changes?changes? Human must sort it outHuman must sort it out

Responsibility of Responsibility of secondsecond committer committer Example: I make change, commit.Example: I make change, commit.

Moses makes conflicting changeMoses makes conflicting change Updates in order to commitUpdates in order to commit CVS marks conflictCVS marks conflict Moses resolves change, commitsMoses resolves change, commits

Page 22: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

TaggingTagging Suppose paper is ready to submitSuppose paper is ready to submit Module can be ‘tagged’Module can be ‘tagged’

Name given to that point in developmentName given to that point in development ‘‘Tag’ refers to both act of tagging and names Tag’ refers to both act of tagging and names

givengiven Module tagged as Module tagged as submissionsubmission

Can check out module at point of Can check out module at point of submissionsubmission at any later time at any later time

Page 23: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Common problemCommon problem Paper accepted, camera-ready conference Paper accepted, camera-ready conference

version completedversion completed Tagged as Tagged as camera-readycamera-ready Copy on your websiteCopy on your website

Development continues for journal versionDevelopment continues for journal version Error found in conference version!Error found in conference version! What to do?What to do?

Page 24: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Branches & mergingBranches & merging Create “branch” at Create “branch” at camera-readycamera-ready

Get copy of module at Get copy of module at camera-readycamera-ready Can develop new branch (website version) Can develop new branch (website version)

independently of main branch (journal independently of main branch (journal version)version)

Can merge edits from website branch into Can merge edits from website branch into main branch, if desiredmain branch, if desired Does not destroy website branchDoes not destroy website branch

Page 25: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Sub-modulesSub-modules I use the same I use the same .bib.bib file for all my papers file for all my papers Option 1: Put copy of file in every moduleOption 1: Put copy of file in every module

Problem: corrections in one module not Problem: corrections in one module not reflected in other modulesreflected in other modules

Page 26: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

Sub-modules (cont.)Sub-modules (cont.) Option 2: Put in its own Option 2: Put in its own bibliobiblio module module Make that a sub-module to Make that a sub-module to paperpaper module module Checking out Checking out paperpaper module gets module gets bibliobiblio

module also, automatically module also, automatically Changes to Changes to .bib.bib file committed to file committed to bibliobiblio

modulemodule Spread to every other copy of Spread to every other copy of bibliobiblio

module via updatesmodule via updates

Page 27: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

MiscMisc Can tell CVS to ignore filesCan tell CVS to ignore files

E.g., all E.g., all .log.log or or .aux.aux files files At each commit, CVS can mail log message to At each commit, CVS can mail log message to

all other authorsall other authors Can include version number, log, etc in file itselfCan include version number, log, etc in file itself

Many other useful featuresMany other useful features

Page 28: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

CVS and EmacsCVS and Emacs There exists an Emacs interface to CVS There exists an Emacs interface to CVS

(of course)(of course) PCL-CVS helps manage modules, once PCL-CVS helps manage modules, once

they’ve been checked outthey’ve been checked out Invoke viaInvoke via

M-x cvs-statusM-x cvs-statusand give it path to working copyand give it path to working copy

Page 29: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

RepositoriesRepositories All authors on theory system?All authors on theory system?

Repository = directoryRepository = directory All authors have theory accounts?All authors have theory accounts?

Repository = directory in theory file spaceRepository = directory in theory file space Remote authors access through Remote authors access through sshssh

Some authors lack theory accounts?Some authors lack theory accounts? Find system where all authors have accountsFind system where all authors have accounts Set up CVS server Set up CVS server

• Go ask Go ask admin@theoryadmin@theory

Page 30: How to type papers Jonathan Herzog 11 Sept 2003. Man: tool-using animal  This talk: two tools for writing papers  Various (X)Emacs modes Help you actually.

For more informationFor more information Cheat sheet lists many commandsCheat sheet lists many commands CVS manual at CVS manual at www.cvshome.orgwww.cvshome.org Google does right thingGoogle does right thing