Ads by Google

Showing posts with label auctex. Show all posts
Showing posts with label auctex. Show all posts

Wednesday, December 4, 2013

A few unrelated Emacs tips

I used to prefer installing things by hand but now I'm not so sure after using Emacs package manager.  Add this to your .emacs and do a M-x list-packages to see the list of packages that are available for Emacs.

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

Yes, not all packages are there; yes, the sites go down sometime, yes it's goes into .emacs.d folder in your relevant OS.   It works smoothly and it saves you a lot of hassle in scouring the net for stuff which overrides the minor inconveniences.

Use outline-mode in your AucTeX mode when editing LaTeX files as outline-minor-mode and while you're at it, do install OutlineMagic to handle the not-so-easy-keychord issue of outline-mode.  I've mapped mine to PF12 key.
 (eval-after-load 'outline
  '(progn
    (require 'outline-magic)
    (define-key outline-minor-mode-map (kbd "<\f12>") 'outline-cycle)))

If you ever had the need to copy your gcc messages to different folders at the same time when sending out emails in gnus, then this thread might be of use to you. Currently doesn't work with group names with spaces in their names especially IMAP folders.

Friday, November 29, 2013

Updated Instructions for Installng AucTeX on Windows and Cygwin

I had written about installing AucTeX earlier and it seems to work most of the time for people based on the emails to me.  Since then AucTeX has been developed further and there's a git repository too for it.  Here's a new set of instructions for the combination of Emacs 24.3, Cygwin and AucTeX.  Now you need git too to clone the repository and follow the instructions by Tassilo Horn here.

It's missing only one bit of instruction; you need to run
$./autogen.sh
before you start the ./configure script like
 $ ./configure --prefix=c:/gnu/ --with-emacs=c:/gnu/emacs-24.3/bin/emacs --with-texmf-dir=c:/MiKTeX2.9/

I prefer the in situ use of AucTeX and so you'd definitely need to follow Tassilo's instructions on the directory customisations especially

;; AUC TeX
;;;lines below are needed as we are calling auctex in situ inside the
;;;git repo instead of installing it.  See
;;; http://permalink.gmane.org/gmane.emacs.auctex.general/5127
(setq TeX-data-directory "C:/gnu/elisp/auctex/")
(setq TeX-lisp-directory "C:/gnu/elisp/auctex/")
(setq preview-datadir (expand-file-name "preview" TeX-data-directory)
      preview-lispdir preview-datadir)
(add-to-list 'load-path "C:/gnu/elisp/auctex/")
(add-to-list 'load-path "C:/gnu/elisp/auctex/preview/")
(setq Info-default-directory-list 
      (cons "c:/gnu/elisp/auctex/doc" Info-default-directory-list))

So, there you have it,using the git version of AucTeX.  And a big thanks to Tassilo for helping me sort out my installation woes.

Wednesday, February 1, 2012

Installing AucTeX and Preview LaTeX on Windows

So, I upgraded my Emacs to the latest version and went through the steps of compiling my elisp packages on my Windows XP laptop and promptly struggled a bit on getting Auctex and Preview LaTeX to work.  I've decided on documenting it; well, only the key steps with a lot of hand waving and assumptions thrown in.

Namely,

Cygwin toolchains are installed(that's what I have)
MiKTeX is installed(whatever version)
Win32 Emacs from the official GNU site (I used 23.4)
Ghostscript is installed too (I used the cygwin based one)

In the cygwin terminal, either checkout the cvs version of Auctex or download the tarballs and untar it somewhere.  Presumably you have MiKTeX and Emacs installed already somewhere; preferably in a folder path that doesn't contain spaces in it's name(It should work with spaces in the path name but I haven't and daren't try that; I really don't need that aggravation).

First you run configure to generate the Makefile

./configure --with-emacs=c:/gnu/emacs-23.4/bin/emacs --prefix=c:/gnu --with-texmf-dir=c:/MiKTeX2.9

If you haven't got all the build tools needed (make, install, latex,perl..) it will stop.  Fix each one of them by installing the necessary packages by using the cygwin package manager setup.exe. Of course, you need to adjust the paths above.

By default, the preview build is enabled by default, which, you can disable by adding the option --disable-preview to configure above, if you don't want to preview your latex document that's got figures and maths.

When the Makefile is generated, run make.  Do not do a make install.  You can use the files in situ by following the instructions of Tassilo Horn here.   You'd probably need to add the following to get the correct info files of Auctex.

;; AUC TeX
(add-to-list 'load-path "C:/gnu/elisp/auctexcvs/auctex/")
(load "auctex.el" nil t t)
(add-to-list 'load-path "C:/gnu/elisp/auctexcvs/auctex/preview/")
(load "preview-latex.el" nil t t)
;;set the path to info files of auctex
(setq Info-default-directory-list
      (cons "c:/gnu/elisp/auctexcvs/auctex/doc" Info-default-directory-list))
I prefer it this way as this does not change the directory structure of a stock install of Emacs on Windows.  Easier to share the folders for someone to copy without borking something.

Navigate to the preview folder and load the circ.tex and compile it.  It should hopefully do so.

For preview you need the png or jpeg image support with Emacs. I've used the dlls mentioned in the Emacs README.w32 that are hosted on the GTK website. Specifically, the png and zlib ones that I downloaded and just dumped  in the Emacs bin directory.  Added the following to my .emacs

(setq preview-image-type 'png)

Ran the preview command on the circ.tex buffer and it showed the equations and images inline which is what it's supposed to do.  If you want jpeg support you'd have to get the jpeg dlls for win32 somewhere(the install files mentions gnuwin32 site)

Which is where I stop now as it all works fine and dandy for me.  The various install files tell you not to mix the cygwin paths and normal DOS paths and other such warnings.  But I haven't seen anything that has knackered my installation or borked my usage of them with different bits of win32 and cygwin tied together with AucTeX

So far.

Monday, May 30, 2011

AucTeX Tip: Automatically save file before compiling

It used to be irritating for me that I had to save the file when I hit C-C C-C when compiling the file.  It tends to break my flow of work when I had to hit 'y' when Emacs queries me to save the file before compiling.

No  more.

Asking on the Auctex mailing list, the answer turned out to be a simple
(setq TeX-save-query nil) ;;autosave before compiling

customisation to my .emacs file.
It saves me a few keystrokes of C-x C-s too in the event I forget to regularly save my file.  Hopefully, this is worth it for you too.

Wednesday, February 24, 2010

AUCTeX 11.86 released

From the AUCTeX mailing list, a new version of AUCTeX, one of the best LaTeX editing modes for Emacs is now available.  The release mail is here.

Lots more packages are now supported, PSTricks support and a newer framework for viewers seems to be the new features apart from bug fixes.

AUCTeX can be downloaded here.




Sunday, November 1, 2009

A quick way of looking up colours in LaTeX

While making beamer presentations, I generally use dvipsnames or svgnames as an option to beamer. This allows me to use named colours instead of giving some RGB numbers to get the colour I want.

Well, sort of.

I mean you still have to figure out what HoneyDew looks like. I used to google it up and check how the colours actually looked. Now, I've got a simpler way to do it. Just do, M-x list-colors-display in Emacs and it shows about the same list as that of svgnam.def with the visual colours. Saves you a few keystrokes and clickies.


You of course, are using Emacs and AucTeX aren't you? :-)



Sunday, August 9, 2009

RefTeX 4.34 released

Just got an email stating that a new version of RefTeX has been released.  You may want to upgrade depending on your needs.


Thursday, June 5, 2008

PDF autorefresh with AucTeX and Sumatra PDF

For users of Emacs on windows, Acrobat Reader does not play well with AucTeX. If the PDF file is open, while compiling the .tex file, Emacs will throw a write error because the reader locks the file for it's own use.

Sumatra PDF seems to have sorted this issue out in it's latest release of the viewer. At least that's what the release notes claim. I haven't tried it so far. But the announcement on the comp.text.tex newsgroup caught my eye and I think it's worth noting.


If it really works as advertised in the release notes, then one does not have to close and reopen the PDF file when generating it through AucTeX. With the autorefresh feature, it should be possible to iteratively add text and compile in a smooth workflow.

I shall have to try this feature and switch the reader if all goes well. The last time I tried the Sumatra PDF viewer I had problems rendering pgf rendered drawings. Maybe things are better this time as I did not fully check what was and was not supported in the earlier releases.

Tuesday, April 15, 2008

Cleaning up or Deleting LaTeX intermediate files using AucTeX

Anyone using LaTeX knows that there are a number of intermediate files that are generated in the course of compiling the document. After the final file is generated, there is no need to keep those files around. But one has to delete them manually or plug the extensions in a shell script to delete them.

Fortunately AucTeX provides a simple interface to clean the files. Hitting C-c C-c and typing 'Clean' or 'Clean All' deletes the intermediate files associated with the current .tex in the buffer.

That's right, it ONLY deletes the intermediate files with respect to the current buffer where C-c C-c is called.

The difference between 'Clean' and 'Clean All' is that, in the latter case, the output files are also deleted. And the files can also be deleted by calling M-x TeX-clean.

So, what intermediate files are deleted? Depending on the type of file being edited, it varies. For example, for LaTeX files, it's

LaTeX-clean-intermediate-suffixes is a variable defined in `latex.el'.
Its value is ("\\.aux" "\\.bbl" "\\.blg" "\\.brf" "\\.fot" "\\.glo"
"\\.gls" "\\.idx" "\\.ilg" "\\.ind" "\\.lof" "\\.log" "\\.lot"
"\\.nav" "\\.out" "\\.snm" "\\.toc" "\\.url")


To know the exact way things can be customised, see the AucTeX manual, especially Cleaning.

Monday, April 14, 2008

In my previous post, I outlined how to get Auctex to launch Acrobat Reader. Here's a minor change based on the same poster's advice. If the reader is the default application to view pdf files in Windows, you don't even need the acrord32 in the configuration. Just


TeX-output-view-style is a variable defined in `tex.el'.
Its value is
(("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "dvips %d -o && start \"\" %f")
("^dvi$" "." "yap -1 %dS %d")
("^pdf$" "." "cygstart %o")
("^html?$" "." "start \"\" %o"))

is enough.

Sunday, April 13, 2008

Making AucTeX launch the Windows Acrobat Reader

When I compile documents using AucTeX, I used to manually open and close the generated pdf by navigating to the file location and opening the file using Windows based Acrobat reader.

The Reader locks the file when in use, so if you recompile the document when the pdf is still open by the Reader, you'd get the "can't write to output file" error.

One workaround I used was, the cygwin based xpdf viewer which doesn't lock the file. But you'd have to refresh the file every time something changed, by hitting 'r' in the xpdf application.

The problem with the default AucTeX install was that it had the start "" %o as the entry for View which didn't do anything. Even though I don't use that feature, I thought, let's get this to point to Acrobat Reader and save it.

Turned out, you need to customise TeX-output-view-style. Setting it to


start "acrord32" %o
acrord32 %o


didn't work. Finally, one poster on the AucTeX mailing list give the answer which made it self evident. Since I was using cygwin, he suggested I use cygstart instead of start.

That worked like a charm and now my TeX-output-view-style looks like

Its value is
(("^dvi$" "^pstricks$\\|^pst-\\|^psfrag$" "dvips %d -o && start \"\" %f")
("^dvi$" "." "yap -1 %dS %d")
("^pdf$" "." "cygstart acrord32 %o")
("^html?$" "." "start \"\" %o"))

Friday, March 28, 2008

Switching to MikTeX

I use the cygwin based TeTeX TeX system. The problem is, it's no longer maintained and the focus is on TeXLive a newer TeX system. TeXLive has gone through several iterations and is released yearly. This year's release is sometime in July 2008 apparently.

I asked on the cygwin list whether there is going be a port of the TexLive TeX tree to cygwin. I got a short answer whether I'd like to volunteer.

ummm....Don't know anything about TeX sources and cygwin ports building and I'm not sure whether I want to.

So, I'm stuck using TeTeX and no cygwin port of the latest TeX system i.e. no upgrade path. And this is seriously showing it's age. pdfTeX version on the cygwin system is at 1.21x while the latest version is 1.40x.

Now, that leaves only one option, MikTeX.

Bit apprehensive of how this is going to pan out. Plus there's this thing of Emacs, AucTeX, cygwin and MikTeX. Windows, fake Unix, Windows port of TeX...

Combination of the good and the kludgy.

So, the plan is, I'll use the Emacs 22.1 version compiled with Auctex and MikTeX and see how it goes. If all goes, redo the same with Emacs 22.2.

Downloading the MikTeX installer and installing the additional packages now. Let's see how this works out.