emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* formatted index entries
@ 2014-06-18  8:00 Nicolas Berthier
  2014-06-18  9:36 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Berthier @ 2014-06-18  8:00 UTC (permalink / raw)
  To: emacs-orgmode


Hello,

In an org file, I would like to add formatted index entries "=word=",
"!word" or similar things, possibly in a hierarchical way as sub entries
(I know it's a very peculiar use case, but it turns out that I would
appreciate having this feature for writing a technical manual). e.g,
something in the spirit of:

# verbatim entry:
#+INDEX: =word=
#+INDEX: category!=word=
#
# verbatim entry with an exclamation mark:
#+INDEX: =!word=
#+INDEX: category!=!word=
#
# or even, let's be audacious: formatted code as an entry:
#+INDEX: src_emacs-list[:exports code](let)

Using the current development branch of Org mode, exporting to HTML
works fine for the verbatim case, yet index entries do not seem to be
treated as Org elements when exporting to LaTeX: index entries are named
"=word=". Also, exclamation marks are category delimiters (as in LaTeX),
hence the cases makes Org insert extra categories named "=", and adds
entries "word=" in them (both in HTML and LaTeX).

This topic has already been discussed on this list before
( http://thread.gmane.org/gmane.emacs.orgmode/41442 ), but apparently
this feature is not (yet?) available in org ≥ 8.0.

Has it already been implemented by somebody somewhere? Any further
thoughts on that point?

Best regards,
  Nicolas

-- 
Nicolas Berthier                                        FSF Member #7975

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: formatted index entries
  2014-06-18  8:00 formatted index entries Nicolas Berthier
@ 2014-06-18  9:36 ` Nicolas Goaziou
  2014-06-18 12:18   ` Nicolas Berthier
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-06-18  9:36 UTC (permalink / raw)
  To: Nicolas Berthier; +Cc: emacs-orgmode

Hello,

Nicolas Berthier <nberth@member.fsf.org> writes:

> In an org file, I would like to add formatted index entries "=word=",
> "!word" or similar things, possibly in a hierarchical way as sub entries
> (I know it's a very peculiar use case, but it turns out that I would
> appreciate having this feature for writing a technical manual). e.g,
> something in the spirit of:
>
> # verbatim entry:
> #+INDEX: =word=
> #+INDEX: category!=word=
> # # verbatim entry with an exclamation mark:
> #+INDEX: =!word=
> #+INDEX: category!=!word=
> # # or even, let's be audacious: formatted code as an entry:
> #+INDEX: src_emacs-list[:exports code](let)
>
> Using the current development branch of Org mode, exporting to HTML
> works fine for the verbatim case, yet index entries do not seem to be
> treated as Org elements when exporting to LaTeX: index entries are named
> "=word=". Also, exclamation marks are category delimiters (as in LaTeX),
> hence the cases makes Org insert extra categories named "=", and adds
> entries "word=" in them (both in HTML and LaTeX).
>
> This topic has already been discussed on this list before
> ( http://thread.gmane.org/gmane.emacs.orgmode/41442 ), but apparently
> this feature is not (yet?) available in org ≥ 8.0.
>
> Has it already been implemented by somebody somewhere? Any further
> thoughts on that point?

LaTeX provides its own processor for index entries, so Org just lets it
handle #+INDEX keywords. Therefore "#+INDEX: something" becomes
"\index{something}" (see `org-latex-keyword'). You could write, e.g.,

  #+INDEX: \texttt{word}

in order to get what you want.

OTOH, every other back-end relies on
`org-publish-index-generate-theindex', which creates a file containing
a list of links. So "#+INDEX: something" becomes

  - [[file:...][something]]

Thus, Org syntax is perfectly allowed, including "src_emacs-lisp{...}",
the only problem being that exclamation marks are separators in
"something".  A workaround could be to make " ! " as a  separator
instead:

  #+INDEX: word ! !word

but that would break #+INDEX keywords currently used.

Note that the current set-up allows to preserve compatibility between
LaTeX and other back-ends in simple cases.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: formatted index entries
  2014-06-18  9:36 ` Nicolas Goaziou
@ 2014-06-18 12:18   ` Nicolas Berthier
  2014-06-18 13:16     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Berthier @ 2014-06-18 12:18 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

You wrote:

> Hello,
>
> Nicolas Berthier <nberth@member.fsf.org> writes:
>
>> In an org file, I would like to add formatted index entries "=word=",
>> "!word" or similar things, possibly in a hierarchical way as sub entries
>> (I know it's a very peculiar use case, but it turns out that I would
>> appreciate having this feature for writing a technical manual). e.g,
>> something in the spirit of:
>>
>> # verbatim entry:
>> #+INDEX: =word=
>> #+INDEX: category!=word=
>> # # verbatim entry with an exclamation mark:
>> #+INDEX: =!word=
>> #+INDEX: category!=!word=
>> # # or even, let's be audacious: formatted code as an entry:
>> #+INDEX: src_emacs-list[:exports code](let)
>>
>> Using the current development branch of Org mode, exporting to HTML
>> works fine for the verbatim case, yet index entries do not seem to be
>> treated as Org elements when exporting to LaTeX: index entries are named
>> "=word=". Also, exclamation marks are category delimiters (as in LaTeX),
>> hence the cases makes Org insert extra categories named "=", and adds
>> entries "word=" in them (both in HTML and LaTeX).
>>
>> This topic has already been discussed on this list before
>> ( http://thread.gmane.org/gmane.emacs.orgmode/41442 ), but apparently
>> this feature is not (yet?) available in org ≥ 8.0.
>>
>> Has it already been implemented by somebody somewhere? Any further
>> thoughts on that point?
>
> LaTeX provides its own processor for index entries, so Org just lets it
> handle #+INDEX keywords. Therefore "#+INDEX: something" becomes
> "\index{something}" (see `org-latex-keyword'). You could write, e.g.,
>
>
>   #+INDEX: \texttt{word}
>
> in order to get what you want.
>
> OTOH, every other back-end relies on
> `org-publish-index-generate-theindex', which creates a file containing
> a list of links. So "#+INDEX: something" becomes
>
>   - [[file:...][something]]
>
> Thus, Org syntax is perfectly allowed, including "src_emacs-lisp{...}",
> the only problem being that exclamation marks are separators in
> "something".  A workaround could be to make " ! " as a  separator
> instead:
>
>
>   #+INDEX: word ! !word
>
> but that would break #+INDEX keywords currently used.

Putting the question of the separator aside, my objective is to be able
to export the same Org document both as HTML and as LaTeX (at least).
I think, as was discussed in the thread I mentioned, that being able to
use Org markups in index entries could be a nice feature to do that.

I understand the contents coming after `#+INDEX:' is used as is in every
case (except in non-LaTeX exports for entries with `!' in them), but are
handled differently: for HTML, they are put in `theindex.inc' to be
handled later when this file is parsed by Org, and for LaTeX they are
passed directly as argument to the `\index' command.

> Note that the current set-up allows to preserve compatibility between
> LaTeX and other back-ends in simple cases.

IMHO, the handling of Org markups (at least) by the LaTeX exporter (and
maybe others) would suffice to implement this feature (with a few tricks
to still allow sorting by makeindex). Am I right?

Regards,

  Nicolas

-- 
Nicolas Berthier                                        FSF Member #7975

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: formatted index entries
  2014-06-18 12:18   ` Nicolas Berthier
@ 2014-06-18 13:16     ` Nicolas Goaziou
  2014-06-18 14:02       ` Nicolas Berthier
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-06-18 13:16 UTC (permalink / raw)
  To: Nicolas Berthier; +Cc: emacs-orgmode

Hello,

Nicolas Berthier <nberth@member.fsf.org> writes:

> IMHO, the handling of Org markups (at least) by the LaTeX exporter (and
> maybe others) would suffice to implement this feature (with a few tricks
> to still allow sorting by makeindex). Am I right?

Handling Org markup in the general case is difficult because INDEX
keywords, as any other keyword, are not parsed. You can force latex
back-end to translate the value of the keyword for a partial support of
Org markup (e.g., no macros besides those defined by default, no noweb
syntax in Babel).

If that sufficient, you can ask `org-latex-keyword' to first split value
at exclamation marks, and send each part through `org-export-string-as'
in order to get valid LaTeX markup.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: formatted index entries
  2014-06-18 13:16     ` Nicolas Goaziou
@ 2014-06-18 14:02       ` Nicolas Berthier
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Berthier @ 2014-06-18 14:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

You wrote:

> Hello,
>
> Nicolas Berthier <nberth@member.fsf.org> writes:
>
>> IMHO, the handling of Org markups (at least) by the LaTeX exporter (and
>> maybe others) would suffice to implement this feature (with a few tricks
>> to still allow sorting by makeindex). Am I right?
>
> Handling Org markup in the general case is difficult because INDEX
> keywords, as any other keyword, are not parsed. You can force latex
> back-end to translate the value of the keyword for a partial support of
> Org markup (e.g., no macros besides those defined by default, no noweb
> syntax in Babel).
>
> If that sufficient, you can ask `org-latex-keyword' to first split value
> at exclamation marks, and send each part through `org-export-string-as'
> in order to get valid LaTeX markup.

Ok thanks for the hints. I will probably hack something soon an send
a patch for support of basic inline markups, in case people are
interested.

Regards,

-- 
Nicolas Berthier                                        FSF Member #7975

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-18 14:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-18  8:00 formatted index entries Nicolas Berthier
2014-06-18  9:36 ` Nicolas Goaziou
2014-06-18 12:18   ` Nicolas Berthier
2014-06-18 13:16     ` Nicolas Goaziou
2014-06-18 14:02       ` Nicolas Berthier

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).