emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH]Optional argument to LaTeX caption command


From: Thomas S. Dye
Subject: [O] [PATCH]Optional argument to LaTeX caption command
Date: Sat, 5 Mar 2011 08:34:34 -1000

Aloha all,

I proposed a similar patch a few weeks ago, but it seems to have slipped through the cracks or was ignored. I'm proposing it again because Org-mode's handling of captions during LaTeX export is inconsistent and limiting.

The optional argument to the LaTeX caption command is used to set the caption in the List of Figures, List of Tables, and similar lists at the beginning of an article or the front matter of a book. Nowadays, the caption under a figure is often quite long, and frequently includes the caption proper and the legend. The optional argument to the LaTeX caption command is typically used to pass the caption proper to the List of Figures, etc., without the legend. One goal of the typesetter here is to keep each entry in the List of Figures, etc. to one line, even when the corresponding caption (plus legend) under the figure spans many lines. Even with captions that fit on a single line, it is often the case that the optional argument to the caption command is used to pass a version of the caption that doesn't end in a period. Many LaTeX List of Figure, etc. styles run a line of dots from the caption to the page number. If the caption ends in a period, then the line of dots is irregular, which looks inelegant.

Now, currently Org-mode correctly parses a caption command of the form:
#+CAPTION: [Caption to list]{Caption to figure.}
The part in square brackets is put in a variable =shortn= and the part in curly braces is put in a variable =cap= in the source file org- exp.el.

During export to LaTeX, the =shortn= variable is recognized if the figure is wrapped by text, but not if it is set as a float in either a single or multicolumn layout. There is no logical reason for this to be so. The optional argument to the caption command is needed in all three cases.

The attached patch corrects a bug in org-exp.el and makes the =shortn= variable available to captions of floats in single and multicolumn layouts in org-latex.el. In org-exp.el, the =shortn= variable was not being initialized with the other variables having to do with captions and labels. This meant that the optional argument used in one figure would be used for a subsequent figure that lacked an optional argument.

I believe this qualifies as a minor patch; it is only 3 lines. I have signed the FSF papers needed to contribute to Org-mode, but for many months have waited in vain for a response from FSF. At any rate, I don't believe there are any legal barriers to applying the patch.

I've been using the patch for a while now and haven't discovered any ill side effects.

All the best,
Tom

Attachment: 0001-lisp-org-exp.el-initialize-shortn.patch
Description: Binary data



reply via email to

[Prev in Thread] Current Thread [Next in Thread]