Latex and Emacs

Posted by:

auctex-logo.png

Builtin Tex Mode in Emacs

I have been using the builtin Mode for a few months until I found out that Auctex is the ultimate Editor for Latex. I do not even know why people will use other Editor such as Lyx.

Emacs build in Tex Mode

Emacs provides special major modes for editing files written in TeX and its related formats. TeX mode has four variants: Plain TeX mode, LaTeX mode, DocTeX mode, and SliTeX mode. LaTeX is a simplified input format for TeX, implemented using TeX macros. DocTeX is a special file format in which the LaTeX sources are written, combining sources with documentation. SliTeX is an obsolete special form of LaTeX.

Latex Preview Panel for Emacs

using xelatex engine instead of latex:

Click the “customize LaTeX Preview Pane” in the menus. You’ll see a box for the TeX command. Set it to “xelatex.”

latex-preview-pane.png

Auctex -the ultimate Tex Editor with with buitlin Preview for Emacs

AUCTeX is an extensible package for writing and formatting TeX files in GNU Emacs and XEmacs. It supports many different TeX macro packages, including AMS-TeX, LaTeX, Texinfo, ConTeXt, and docTeX (dtx files). – from Auctex Official Site.

Installing Auctex

Install as Emacs package

M-x list -package -> search auctex version -> i -> x

Manual install

Emacs configuration

Shamelessly taken from here, another good resource. The Auctex cheatsheet is very useful.

Preview issues due to Ghostscript

The preview-latex subsystem from Auctex is a state of the art Latex preview tool.

preview-latex equips your source buffer with a sophisticated WYSIWYG previewing and folding conglomerate that revolutionalizes the edit-compile-preview cycle. That means, instead of LaTeX constructs, images of their typeset output are placed in the buffer. It is therefore particularly suited for easing the creation of complex content like math formulas, programmed graphics, or text transcriptions.

I have wasted a couple of hours on this issue (reported here and here). Apparently ghostscripe removed the .runandhide operator in version 9.22, so it is likely that this causes the problem.

So what I did is to downgrade Ghostscript to 9.21.3 and everything goes back to normalcy.

Load a tex with some equation and figures etc, press C-c C-c C-p, you will see the beautifully rendered preview, move cursor to a section, it will automagically switch to Latex code for you to edit.

auctex.png

If you want to view PDF file in (Okular or PDF-Tools), press C-c C-c -> View, the PDF frame (or Okular window) will pop up. Make some changes and save your tex file with C-x C-s, you PDF will be updated automagically.

AuctexPreview.gif

Works fine with Chinese too.

auctex-zh.png

Postamble

Following code was used to generate the Auctex logo. It was modified from the original one.

0
  Related Posts

Add a Comment