From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: org-list-allow-alphabetical LaTeX export Date: Fri, 07 Jun 2013 01:01:18 -0400 Message-ID: <871u8ems4h.fsf@pierrot.dokosmarshall.org> References: <93BA1627-D7F6-4E96-9AFC-927A6F6C8C6E@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukonx-0001Lb-3t for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 01:01:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ukonv-0006aO-Ix for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 01:01:37 -0400 Received: from plane.gmane.org ([80.91.229.3]:55635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ukonv-0006aE-98 for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 01:01:35 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ukons-0001KP-Ec for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 07:01:32 +0200 Received: from pool-108-7-96-134.bstnma.fios.verizon.net ([108.7.96.134]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Jun 2013 07:01:32 +0200 Received: from ndokos by pool-108-7-96-134.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 07 Jun 2013 07:01:32 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Josiah Schwab writes: >> On 6 jun. 2013, at 10:20, Michael Bach gmail.com> wrote: >>> The LaTeX exporter does not honor the setting of org-list-allow-alphabetical. > > A week or so ago I asked a similar question about the HTML export and lists. > http://lists.gnu.org/archive/html/emacs-orgmode/2013-05/msg01324.html > So I just wanted to toss in my 2ยข. > > On Jun 6, 2013, at 2:17 AM, Carsten Dominik wrote: >> Conventions about the type of bullet to be used in a document belong >> to the typesetting side, and I rather establish a global setting for >> a document than follow my momentary decisions when I write the >> Org-mode version of it. On a similar vein, we do have lists >> starting with - and * and +, but we still let LaTeX and HTML choose >> what to use as a bullet. To me this feels like the right behavior. > > I think this argument makes sense; and to be honest, that's probably > how I want the exporter to behave most of the time. > > However, there is particular use case where I find this frustrating, > which is writing problem sets. There I like to reference other parts > of the problems by name. For example, > > a) Do something. > b) Use your answer in part a) to do something else. > > Then, if I want to export it to multiple formats (say, html and pdf), > there is no general way to tell orgmode: "my alphabetical bullet > choice was meaningful, please try to preserve it". One ends up > inserting little workarounds for each export format. Which is not a > big deal, but when everything else works so seamlessly it's these > little things that stand out :) > I don't have anything to add to what others have said on the cross-reference question. But I did some investigation into alpha lists and I wanted to expand a bit on that. I looked at your earlier question and the latex question a bit and I have a patch that implements something like what you want. However, I'm not advocating that org actually implement this. In fact, there are good reasons *not* to implement it (at least not in this form). In the patch, there is a change in the parser so that it recognizes an ordered-alpha list (in addition to the ordered, etc. lists it was already recognizing). Then there are minor changes to ox-html.el: basically ordered and ordered-alpha trigger the same response from the exporter, except in one case: the opening of an ordered-alpha list includes the ``type="a"'' thing. NB: the patch does not address any of the other exporters. However, the type="a" thingie in
    is a bad idea: it is deprecated in the HTML spec, so it would be foolish to go chasing after it in org. Here's what the spec says: #+BEGIN_QUOTE For the OL element, possible values for the type attribute are summarized in the table below (they are case-sensitive): Type Numbering style 1 arabic numbers 1, 2, 3, ... a lower alpha a, b, c, ... A upper alpha A, B, C, ... i lower roman i, ii, iii, ... I upper roman I, II, III, ... Note that the type attribute is deprecated and list styles should be handled through style sheets. For example, using CSS, one may specify that the style of numbers for list elements in a numbered list should be lowercase roman numerals. In the excerpt below, every OL element belonging to the class "withroman" will have roman numerals in front of its list items.
    1. Step one ...
    2. Step two ...
    #+END_QUOTE See http://www.w3.org/TR/html4/struct/lists.html#type-values. Even if it were not deprecated, a good implementation would require org to be able to generate all the values, which would probably require YAUO (yet another user option). What org *could* do is to generate some discriminant (the "withroman" thing above) so that the proper CSS could be applied. Right now, there is no such capability I believe. It could be done with YAUO, but I, for one, think org has too many of those: we certainly don't need more unless it is *really* necessary. Here's the patch if you still want it: the only use for it as far as I'm concerned is "educational": --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=alpha-list.patch Content-Description: Alpha lists in the html exporter diff --git a/lisp/org-list.el b/lisp/org-list.el index 86afe11..7a606f0 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1022,7 +1022,8 @@ Possible types are `descriptive', `ordered' and `unordered'. The type is determined by the first item of the list." (let ((first (org-list-get-list-begin item struct prevs))) (cond - ((string-match "[[:alnum:]]" (org-list-get-bullet first struct)) 'ordered) + ((string-match "[[:alpha:]]" (org-list-get-bullet first struct)) 'ordered-alpha) + ((string-match "[[:digit:]]" (org-list-get-bullet first struct)) 'ordered) ((org-list-get-tag first struct) 'descriptive) (t 'unordered)))) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index facd84c..b30c313 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -2387,7 +2387,7 @@ contextual information." (br (org-html-close-tag "br" nil info))) (concat (case type - (ordered + ((ordered ordered-alpha) (let* ((counter term-counter-id) (extra (if counter (format " value=\"%s\"" counter) ""))) (concat @@ -2409,7 +2409,7 @@ contextual information." (unless (eq type 'descriptive) checkbox) contents (case type - (ordered "") + ((ordered ordered-alpha) "") (unordered "") (descriptive ""))))) @@ -2796,13 +2796,16 @@ lists." (ordered (format "
      " (if arg1 (format " start=\"%d\"" arg1) ""))) + (ordered-alpha + (format "
        " + (if arg1 (format " start=\"%s\"" arg1) ""))) (unordered "
          ") (descriptive "
          "))) (defun org-html-end-plain-list (type) "Insert the end of the HTML list depending on TYPE." (case type - (ordered "
      ") + ((ordered ordered-alpha) "
    ") (unordered "") (descriptive ""))) --=-=-= Content-Type: text/plain So much for HTML. For LaTeX, you can do alpha lists as follows (no patch needed): --8<---------------cut here---------------start------------->8--- #+LATEX_HEADER: \usepackage{enumerate} * Letters #+ATTR_LATEX: :options [(a)] a. foo b. bar c. baz This is another list, and the option above does not apply to it - the enumerators are numbers by default: a. foo b. bar c. baz * Numbers 1. foo 2. bar 3. baz This might look like a numbered list, but if you add an option you can turn it into an alpha list: #+ATTR_LATEX: :options [A] 1. foo 2. bar 3. baz --8<---------------cut here---------------end--------------->8--- You can pass any of the options that the enumerate package allows without org having to worry about it. -- Nick --=-=-=--