emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: "Alan E. Davis" <lngndvs@gmail.com>
Cc: Marius Hofert <marius.hofert@math.ethz.ch>,
	Emacs help <emacs-orgmode@gnu.org>,
	nicholas.dokos@hp.com
Subject: Re: How to get numbered lists (1), (2), … ?
Date: Thu, 13 Oct 2011 16:44:56 -0400	[thread overview]
Message-ID: <8172.1318538696@alphaville.americas.hpqcorp.net> (raw)
In-Reply-To: Message from "Alan E. Davis" <lngndvs@gmail.com> of "Thu\, 13 Oct 2011 13\:02\:50 PDT." <CAF-1L2RzU9GO-k6oq8cGmd2TzSjp8suGDyDGrT3+BmrPMGXv=g@mail.gmail.com>

Alan E. Davis <lngndvs@gmail.com> wrote:

> Without diving into how to set it up in org-mode, the paralist package for LaTeX enables inline numbered lists, as in
> 
> %% In preamble
> \usepackage{paralist}
> 
> %% In document
> \begin{inparaenum}
>    \item first element
>   \item second element
> \end{inparaenum}
> 
> As to how to organize this to be an option for org-mode without incorporating above into the setup, I would also be interested.  
> 

The method described below can of course accomplish this: you need to
change the :ostart and :oend settings. It's also fairly easy to define
customizable variables for all of this, but that is left as an exercise
to the interested reader... Nicolas might be interested in anything you
come up with.

Nick

Hint (entirely untested):

(defcustom o-e-l-l-s-ostart "\begin{enumerate}\n" ...)
(defcustom o-e-l-l-s-oend ...)
...

(setq org-export-latex-list-settings `(:splice nil :ostart ,o-e-l-l-s-ostart :oend ,o-e-l-l-s-oend
                                                   :ustart .....)

...[ some way to reevaluate the above variable if any of its components change - does custom provide anything like that?? ]...

(defun org-list-to-latex (...)
   ...
   (org-combine-plists
        org-export-latex-list-settings
        params)
   ...


> Alan
> 
> On Thu, Oct 13, 2011 at 12:10 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> 
>     [ I started this earlier but I guess I didn't send it out. Suvayu has
>      replied in the meantime with a pointer to a better solution than this
>      one, but this might be of some minor interest to some people as well -
>      besides, I spent a whole 20 minutes on it, half of it trying to figure
>      out why my mail was not working :-( : why let that effort go to
>      waste?:-) ]
> 
>     Marius Hofert <marius.hofert@math.ethz.ch> wrote:
>    
>     > Dear Suvayu,
>     >
>     > thanks.
>     > It would be good to know how latex export can be customized to achieve this.
>     >
>    
>     Depends on how much customization you are willing to go through: there is an
>     enumerate.sty package in LaTeX that can do that:
>    
>     --8<---------------cut here---------------start------------->8---
>     ...
>     \usepackage{enumerate}
>     ...
>     \begin{enumerate}[(1)]
>     \item foo
>     \item bar
>     \end{enumerate}
>     ...
>     --8<---------------cut here---------------start------------->8---
>    
>     Inserting the \usepackage from the org file is no problem:
>    
>     --8<---------------cut here---------------end--------------->8---
>     #+LATEX_HEADER: \usepackage{enumerate}
>     ...
>     --8<---------------cut here---------------end--------------->8---
> 
>     Getting the argument to the enumerate environment in the right place is
>     another matter. I think the only way is to redefine org-list-generic-to-latex
>     like this (add this to your initialization file, .emacs or whatever, after you
>     load org):
>    
>     --8<---------------cut here---------------start------------->8---
>     (require 'org-list)
>    
>     (defun org-list-to-latex (list &optional params)
>      "Convert LIST into a LaTeX list.
>     LIST is as returned by `org-list-parse-list'.  PARAMS is a property list
>     with overruling parameters for `org-list-to-generic'."
>      (org-list-to-generic
>       list
>       (org-combine-plists
>        '(:splice nil :ostart "\\begin{enumerate}[(1)]\n" :oend "\\end{enumerate}"
>                   :ustart "\\begin{itemize}\n" :uend "\\end{itemize}"
>                   :dstart "\\begin{description}\n" :dend "\\end{description}"
>                   :dtstart "[" :dtend "] "
>                   :istart "\\item " :iend "\n"
>                   :icount (let ((enum (nth depth '("i" "ii" "iii" "iv"))))
>                             (if enum
>                                 ;; LaTeX increments counter just before
>                                 ;; using it, so set it to the desired
>                                 ;; value, minus one.
>                                 (format "\\setcounter{enum%s}{%s}\n\\item "
>                                         enum (1- counter))
>                               "\\item "))
>                   :csep "\n"
>                   :cbon "\\texttt{[X]}" :cboff "\\texttt{[ ]}"
>                   :cbtrans "$\\boxminus$")
>        params)))
>     --8<---------------cut here---------------end--------------->8---
>    
>     The only change is the definition of :ostart. Not a very flexible method,
>     but it will serve in a pinch. ngz et al. might have better ideas.
>    
>     I should say that there are other ways to customize enumeration labels
>     in LaTeX - see e.g. http://www.tex.ac.uk/cgi-bin/texfaq2html?label=enumerate -
>     but afaict they would all require some rewiring of the above function, similar
>     to the above.
>    
>     Nick
>    
>     > Cheers,
>     >
>     > Marius
>     >
>     > On 2011-10-13, at 11:37 , suvayu ali wrote:
>     >
>     > > On Thu, Oct 13, 2011 at 11:11 AM, Marius Hofert
>     > > <marius.hofert@math.ethz.ch> wrote:
>     > >> Dear all,
>     > >>
>     > >> In the manual, I found that numbered lists can be created with 1), 2), ... or 1., 2., ...
>     > >> How can I get numbered lists like this: (1), (2),...?
>     > >> I found org-list-demote-modify-bullet, but the help (and a google search) did not help me in finding a solution to this.
>     > >>
>     > >
>     > > I don't think you can. But you can customise latex export (maybe even
>     > > html export, but I don't know) to show lists like that in the exported
>     > > file.
>     > >
>     > > I hope this helps.
>     > >
>     > >> Cheers,
>     > >>
>     > >> Marius
>     > >>
>     > >
>     > >
>     > >
>     > > --
>     > > Suvayu
>     > >
>     > > Open source is the future. It sets us free.
>     >
>     >
>     >
> 
> 
> ----------------------------------------------------
> Alternatives:
> 
> ----------------------------------------------------

  reply	other threads:[~2011-10-13 20:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 19:10 Nick Dokos
2011-10-13 20:00 ` Marius Hofert
2011-10-13 20:28   ` Nick Dokos
2011-10-14 11:31     ` Nicolas Goaziou
2011-10-14 12:05       ` Jambunathan K
2011-10-14 12:24         ` suvayu ali
2011-10-14 12:37         ` Marius Hofert
2011-10-14 12:14       ` Carsten Dominik
2011-10-15 14:14         ` Eric S Fraga
2011-10-15 14:21           ` Marius Hofert
2011-10-15 15:35           ` Bernt Hansen
2011-10-15 15:56           ` Carsten Dominik
2011-10-16 15:16             ` Eric S Fraga
2011-10-13 20:02 ` Alan E. Davis
2011-10-13 20:44   ` Nick Dokos [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-13  9:11 Marius Hofert
2011-10-13  9:37 ` suvayu ali
2011-10-13 15:26   ` Marius Hofert
2011-10-13 18:31     ` suvayu ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8172.1318538696@alphaville.americas.hpqcorp.net \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=lngndvs@gmail.com \
    --cc=marius.hofert@math.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).