Friday, September 26, 2008

PGF and TikZ

I guess I'm just completely out of touch, but there's an excellent package that allows you to draw sophisticated graphics within LaTeX (using a graphics programming language) I hadn't heard of till recently.

It's called PGF, and the component you use in your LaTeX/TeX source code is called TikZ. You enter simple LaTeX-style commands to tell it what to draw, in an environment right in your (La)TeX code, and it does the job for you. The excellent user manual can be found here, including instructions for installing and a tutorial. (If you're a Ubuntu user, of course, there's already a package you can install with a few clicks.) Great examples can be found here. Wow! What a package.

Saturday, August 9, 2008

Emacs Word Wrap

Real word wrapping in emacs isn't automatic, but here's how it can be done. I found these instructions at http://lispy.wordpress.com/2007/07/12/dark-secrets-of-emacs-word-wrapping/. It's not perfect; despite the comments on that website, I don't yet know how to make word-wrap work after vertical splitting. First, get longlines.el and put it somewhere. Then, add the following lines to your .emacs:

(load "/path/to/longlines.el" t t)
(autoload 'longlines-mode "longlines.el" "Minor mode for editing long lines." t)
;; Uncomment the next line to wrap by default in text mode
;;(add-hook 'text-mode-hook 'longlines-mode)

To activate manually, do M-x longlines. More info at http://www.emacswiki.org/cgi-bin/wiki/LongLines.

Adding An Emacs Menu

Here's some template code for adding a menu item to the main emacs menu bar. I don't know hos this works; I just use it as a template!

;;;;;;; Add items to menu bar
(modify-frame-parameters (selected-frame) '((menu-bar-lines . 2)))
;; Make a menu keymap (with a prompt string)
;; and make it the menu bar item's definition.
(define-key global-map [menu-bar MyMenu] (cons "MyMenu" (make-sparse-keymap "MyMenu")))
;; Define specific subcommands in this menu.
(defun MyMenu-linkify() (interactive) (replace-regexp "^\\(.*\\)$" "\\1
"))
(define-key global-map
[menu-bar MyMenu linkify]
'("Linkify" . MyMenu-linkify))
(define-key global-map
[menu-bar MyMenu truncate]
'("Truncate em" . toggle-truncate-lines))

Sunday, August 3, 2008

Linux Brain Games

These involve the mind in some way... I like to do Blinken and Gnomine.

Chess. These engines are way too hard for me.
  1. Gnuchess
  2. Crafty
Memory
  1. Blinken
Quick Thinking
  1. Gnomine
  2. KSirtet
  3. Tetravex
  4. Gnome Sudoku
Uncategorized
  1. gtans (Tangrams)
  2. Code Breaker / Gnomermind (Mastermind clones)
  3. Klotski/Gnome Klotski
Free Online
  1. Happy Neuron free games
  2. MyBrainTrainer has a test and one free puzzle every month
Commercial
  1. The Amazing Brain Train (has a demo)

Wednesday, July 30, 2008

I Love Evince!

Evince, the Gnome document viewer under Ubuntu 7.10 and up, is simply a great piece of software. It has some simple features which enhance its usefulness for academic work.

Incremental search instead of boring-old-search make evince my favourite viewer for almost any type of document it supports.

The extra feature I use most often is "Open a Copy" in the File menu. This opens up another instance of evince displaying the same file, very useful when you need several different pages of the document open at the same time.

Another useful related feature is, if you click using the middle button while following a PDF link, the link opens up in a new window (just like in Firefox). That way you don't lose the original page.

Of course, evince could be made better. Here's my wish-list:
  1. Add a cycle-through-bookmarks feature for the cases when I want quick browsing in one window instead of many
  2. Add an "Open a Copy" toolbar button
  3. The version of evince I'm using on Ubuntu 7.10 doesn't work at all with the print server CUPS; maybe this is already fixed in the newer versions
  4. DVI files are blurred (or maybe over-antialiased)
  5. We need browser-style back and forward buttons in addition to the page back and page forward buttons, so we can follow links more easily
  6. Would be nice to be able to place two arbitrary (not just adjacent) pages side-by-side.
  7. Alternatively, allow left-right split window with synchronized scrolling made possible (i.e. scrolling one scrolls the other by the same amount)
  8. Add a "search for full word only" option to the incremental search
  9. More when I think of it!

Monday, July 28, 2008

Whizzytex on Ubuntu 7.10

Whizzytex is a pretty nifty application that updates a compiled TeX pane in real-time as you type into emacs. Under Ubuntu 7.10 it comes as a package in the repositories.

With my installation (on a Thinkpad t61) I've had an annoying problem: every few seconds, emacs will freeze completely for a 1-5 seconds (presumably doing a slice compilation or some such thing for whizzytex). This can happen right in the middle of a yank, and it can happen ten times a minute.

Here's my solution, though I can't explain why it works: put the line

(setq whizzy-load-factor 10)

in your .emacs file. The problem still occurs but very occasionally (once in 5-6 minutes, which I can live with). Whizzy is a lot more responsive now as well.

There is one downside: this really increases processor usage. My laptop runs hot and the battery doesn't last long when I have the load factor set high this way.

Wednesday, June 11, 2008

Backup (Part II)

I listed some requirements that I have for backup software for a single workstation in an earlier post. I seem to have found a solution that has many of those properties, though not all. It is called SBackup (for Simple Backup) and I am running it on Ubuntu 7.10. (I won't be shifting to 8.04 until all the kinks are worked out, or they invent hibernate for Linux.) It really is simple and runs very well in my situation.

Here's how SBackup satisfies my requirements:

  1. SBackup has a modicum of network awareness; it can backup over an SSH or FTP connection in addition to a local directory.
  2. SBackup can do incremental and full backups. By default every backup (except the first) in SBackup is an incremental backup. The administrator can specify a schedule for full backups, such as a full backup every 21 days.
  3. SBackup has pretty good scheduling. The frequency of full and incremental backups can be controlled. A purging schedule can also be set up, for example: keep all backups for the last week, keep one backup a month for the last year, keep one backup every 6 months for years before that.
  4. SBackup's backups are software independent. This was a major problem I had with DAR, which I was using before SBackup: DAR archives couldn't be read without DAR. SBackup just uses tarred, gzipped files. So I have no worries about how I'm going to access the files in backup if SBackup is discontinued or unavailable in the future.
  5. SBackup doesn't have encryption, but right now this is not crucially important to me.
In addition, SBackup really is very simple to configure, and it works silently behind the scenes.