LaTeX vs. Word

In an act that I’m sure was designed to throw me into a fit of rage, Markus Knauff and Jelica Nejasmic published An Efficiency Comparison of Document Preparation Systems Used in Academic Research and Development in PLOS ONE. The paper purports to compare the efficiency of Word versus LaTeX in academic document preparation.

Most everyone here knows my feelings about Word but that doesn’t mean I’m not open to a reasoned analysis of the relative merits of Word and LaTeX in producing technical documents. Sadly, this paper is not that analysis. Claus Wilke has an excellent post on the problems with the paper. You should definitely read it.

The thrust of Wilke’s post is that the design of the experiment discussed in the paper is very weak and does not support the rather strong conclusions that the authors reach. Most of the problems stem from the authors’ failure to distinguish between layout and content. For example, one of the tests involved reproducing exactly a page of continuous text (including title, author, and address lines). But, of course, LaTeX users don’t work that way. They download a style sheet from the journal they’re submitting the paper to and let the style sheet worry about the layout.

The most infuriating thing about the paper is their explanation for—what they consider—an anomaly: the fact that LaTeX users express less frustration and enjoy using their system more than Word users. They posit that the poor deluded fools who feel that way must be suffering from cognitive dissonance. Because, after all, it couldn’t be that LaTeX actually was better for it’s users.

Their other conclusion is that journals—at least non-mathematical journals—should stop accepting LaTeX and insist on Word or PDF. This even though they admit that LaTeX is easier for the journals to integrate into their work flow and produces a better product. I find their reason for this conclusion particularly offensive. Since their study concludes that it takes longer to prepare a document with LaTeX than it does with Word, researchers should be forced, forced, to use a document preparation system other than the one they’d like because then they’ll have more time to do research and improve the common weal. As if researchers were slaves. It’s a disgraceful argument.

UPDATE: There’s an interesting discussion of the paper on the Org-Emacs list. In particular, see the post by Christophe Pouzat. He obtained the original data and reanalyzed it. His findings are very revealing.

Posted in General | Tagged , | 2 Comments

A New Emacs Blog

Oleh Krehel (abo-abo) has a new blog, (or emacs. There’s only a few posts so far but they’re really excellent. For example, his initial post discusses his packaging of ace-window into a library so that other packages can use the ace-window technology to pick windows to operate on.

I really like ace-window and use it all the time. I didn’t know, though, that with 【Ctrl+u】 it will swap the current window with the selected one and with 【Ctrl+u Ctrl+u】 it will delete the selected window. So I learned something useful from his very first post.

Abo-abo has made many contributions to Emacs other than ace-window so he has interesting things to say. Welcome, abo-abo. We’ll be looking forward to many more posts.

Posted in General | Tagged | 5 Comments

Quicklisp Client Update

Xach has an updated quicklisp client available. Just call

(ql:update-client)

to get it.

Posted in Programming | Tagged , | Leave a comment

Going to the Top and Bottom of iBuffer

I use iBuffer a lot. That’s probably because I get a little OCD about stray buffers eating up memory for no reason. With my new 16 GB laptop, buffers eating up memory isn’t much of a problem but it’s too late for me to reform my ways.

I especially like to clean up after I upgrade my packages. That process always leaves a Compile-Log buffer at the top of the iBuffer list and a Packages buffer at the bottom. Of course, when I navigate to the head or tail of the buffer I end up in the wrong place—not at the head or tail of the list.

If that seems a little familiar it’s probably because Magnar Sveen had similar problem with dired and solved it with a bit of Elisp. So I shamelessly ripped off Sveen’s code and made a few trivial changes so it does the same thing for iBuffer that Sveen’s did for dired. If you’re having the same problem, the code is below. It’s almost embarrassing to post it because it’s such a rip off but Emacsers who don’t have the wherewithal to figure out which key map to use or who don’t know Elisp may find it useful.

;; Stolen from Magnar's code to do the same thing for dired
;; http://whattheemacsd.com/setup-dired.el-02.html
(defun ibuffer-back-to-top ()
  (interactive)
  (beginning-of-buffer)
  (next-line 3))

(defun ibuffer-jump-to-bottom ()
  (interactive)
  (end-of-buffer)
  (next-line -2))

(eval-after-load 'ibuffer
  '(progn
     (define-key ibuffer-mode-map
       (vector 'remap 'end-of-buffer) 'ibuffer-jump-to-bottom)
     (define-key ibuffer-mode-map
       (vector 'remap 'beginning-of-buffer) 'ibuffer-back-to-top)))
Posted in General | Tagged | 2 Comments

Sorting by IP Addresses 2

Yesterday, I told you about my difficulties in trying to sort an Org mode table. I came up with a solution that was, um, less than optimal but at least I got the table sorted. It bugged me that Org mode couldn’t sort by IP address so I wrote a patch to add a “sort by IP address” option to org-table-sort-lines and submitted it.

Nicolas Goaziou pushed me to make a more general patch that would allow a user to specify any sorting method. The idea was to duplicate the ?f ?F functionality of org-sort-list. After some back and forth, the patch was accepted and is now on the master branch. If you’re tracking the Org repository, it’s available now. If you’re getting Org from ELPA or just updating with major releases it should be along shortly.

Org mode still doesn’t have an IP sort option but now I can write my own. First, I need a comparison function:

(defun jcs-ip-lessp (ip1 ip2 &optional op)
  "Compare two IP addresses.
Unless the optional argument OP is provided, this function will return T
if IP1 is less than IP2 or NIL otherwise. The optional argument OP is
intended to be #'> to support reverse sorting."
  (setq cmp (or op #'<))
  (cl-labels ((compare (l1 l2)
                       (if (or (null l1) (null l2))
                           nil
                         (let ((n1 (string-to-number (car l1)))
                               (n2 (string-to-number (car l2))))
                           (cond
                            ((funcall cmp n1 n2) t)
                            ((= n1 n2) (compare (cdr l1) (cdr l2)))
                            (t nil))))))
    (compare (split-string ip1 "\\.") (split-string ip2 "\\."))))

The rest is easy. I just need to call org-table-sort-lines with jcs-ip-lessp and the appropriate key extraction function:

(defun jcs-ip-sort ()
  (interactive)
  (org-table-sort-lines nil ?f #'org-sort-remove-invisible #'jcs-ip-lessp))

(defun jcs-ip-sort-reverse ()
  (interactive)
  (org-table-sort-lines nil ?F #'org-sort-remove-invisible
                        (lambda (ip1 ip2) (jcs-ip-lessp ip1 ip2 #'>))))

I just add this to my init.el and then call jcs-ip-sort or jcs-ip-sort-reverse to sort a table by IP address.

You can also specify the key extraction function interactively and org-table-sort-lines will choose either a string or numeric sort depending on the type of the first extracted key.

Posted in General | Tagged , | 3 Comments

Maintenance

Irreal’s hosting provider is planning some server maintenace from [2014-12-26 Fri] to [2014-12-29 Mon]. Somewhere in that interval, the server that Irreal runs on will be upgraded.

The hosting provider does not expect any outages during this process but warns that if a reboot is necessary the site may be down for a few minutes. If you try to connect and nothing happens, just wait a few minutes.

Posted in Blogging | Tagged | Leave a comment

Sorting by IP Addresses

Recently, I needed to sort an Org mode table by a column having IP addresses. For example, given the table

|            IP | 11/01 | 11/02 | 11/03 |
|---------------+-------+-------+-------|
|    10.1.213.5 |     2 |     1 |     0 |
|  172.25.100.1 |     4 |     1 |     1 |
|   10.234.4.55 |     1 |     1 |     5 |
|  192.168.7.11 |     2 |     1 |     3 |
| 10.25.215.200 |     1 |     3 |     1 |
|    172.35.0.1 |     2 |     5 |     1 |

I want to sort on the IP column to get

|            IP | 11/01 | 11/02 | 11/03 |
|---------------+-------+-------+-------|
|    10.1.213.5 |     2 |     1 |     0 |
| 10.25.215.200 |     1 |     3 |     1 |
|   10.234.4.55 |     1 |     1 |     5 |
|  172.25.100.1 |     4 |     1 |     1 |
|    172.35.0.1 |     2 |     5 |     1 |
|  192.168.7.11 |     2 |     1 |     3 |

That turns out to be surprisingly difficult. There’s no built-in method and I couldn’t find an appropriate sort routine that exposed the comparison function so that I could write my own.

The normal Unix sort can sort IP addresses with

sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4

Not easy or pretty but at least it gets the job done. My first attempt to get this to work was to mark the whole table except for the header line and the following rule line and then pipe it into sort with 【Ctrl+u Meta+|】. Sadly, this didn’t work because of the | that begins each line.

Next, I tried marking the rectangle comprising the data of the table with 【Ctrl+x Space】 and then piping it into sort as before. That didn’t work either.

Finally I remembered that I have cua-selection-mode enabled to mark rectangular regions. I marked the data with that and piped it into sort. Happily, that worked. If you haven’t already enabled cua-selection-mode, you should. It’s really useful.

I wouldn’t think sorting IP addresses would be that unusual but there’s no support for it all in Emacs. Most utilities do no better. Even sort only manages with some trickery. It’s probably just that IP addresses weren’t as ubiquitous as they are now when Emacs and those utilities were written. Or maybe I’m the only one who wants to sort by IP address.

So I solved the problem, sort of, but, really, it’s a terrible solution. After a bit of thought, I ginned up a patch and sent it off to the Org mailing list. Tomorrow, I’ll tell you the rest of the story.

Posted in General | Tagged | 2 Comments

PDF Animations

Edgar Aroutiounian has a nice post about adding animations to PDF files with Emacs, Org, and LaTeX. If you’re an OS X user, he also explains how to load a minimal TeX distribution rather than the huge MacTeX distribution.

The real magic is putting an animated graph into a PDF file. It’s surprisingly easy to do and doesn’t require much more than Emacs, Org, and LaTeX. Definitely worth reading if you think you might want to do this someday.

Posted in General | Tagged | Leave a comment

Emacs Function Frequency

Xah Lee has an interesting post of the frequency of Emacs functions in the Emacs code base. It’s easy to write such a thing off with a shrug but I found the chart fascinating. The first five most frequently used functions are setq, if, defun, let, and and. That’s not too surprising, of course, but I would have expected car and cdr to be in the first five.

As Lee says, it’s an interesting exercise to read down the list and find the first command you don’t already know. In my case that was oref, which is an eieio function. My excuse for not knowing it is that I’ve never used eieio. More to the point, though, is that now I do know it so I’ve learned something new.

Take a look at the list and see how far you get. Like me, you’ll probably know almost all of them but there may be a few that are new and then you’ll have learned something.

UPDATE: Fixed link.

Posted in Programming | Tagged | 4 Comments

Yosemite Autocorrect

This is a note for users of OS X Yosemite. With the new OS, spelling autocorrect is on by default. For me, at least, this was most evident in the mail app (almost all my other writing occurs in Emacs). When writing function names such as getkey-function, autocorrect would helpfully correct that to get key-function. It happens so quickly that half the time I didn’t even notice it.

I finally got fed up enough to try to fix it. The obvious place to look was in mail preferences but all you could do there was to turn off spell checking completely or just do it when you press send. I asked Duck Duck Go about it and found this helpful page. The TL;DR is that you can turn off autocorrect in the keyboard preferences; just uncheck the autocorrect box and you’re done.

Posted in General | Tagged , | Leave a comment