Re: [O] tricky odt export needs
Jambunathan K kjambunat...@gmail.com writes: In the pdf version of Emacs info manuals one typically sees all three of a Section number AND a Description AND a Page number, something like: See Section 3.1 [Tropical Storms], page 24. In Org context, I am wondering whether there is such a need. I have added support for generating page nos. See attachments for sample test file. --8---cut here---start-8--- #+OPTIONS: ':nil *:t -:nil ::t :t H:3 \n:nil ^:t arch:headline #+OPTIONS: author:t c:nil creator:comment d:(not LOGBOOK) date:t #+OPTIONS: e:t email:nil f:t inline:t num:3 p:nil pri:nil prop:nil #+OPTIONS: stat:t tags:t tasks:t tex:t timestamp:t toc:t todo:t |:t #+TITLE: headline #+DATE: 2014-02-12 Wed #+AUTHOR: Jambunathan K #+EMAIL: kjambunat...@gmail.com #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+SELECT_TAGS: export #+EXCLUDE_TAGS: noexport #+CREATOR: Emacs 24.3.50.20 (Org mode 8.2.5h) #+TOC: headlines * Headline 1 Some text. See [[Headline 2]]. #+PAGEBREAK: * Headline 2 Some more text. --8---cut here---end---8--- Page nos are disabled by default. To enable pagenos, you need to M-x customize-variable org-odt-caption-and-xref-settings and choose a setting as below. [X] Key: :TARGET: Plist: [X] Key: :xref-format Choice: Value Menu TexInfo style INS The TexInfo style is provided more for trial run. A variety of different format strings can be chosen. You can pull my changes from the following ELPA archive: http://repo.or.cz/w/org-mode/org-kjn.git/blob_plain/master:/ See instructions at http://cauvery.nfshost.com/wiki.pl/ODT_Exporter pagenos-after-upate.odt Description: application/vnd.oasis.opendocument.text pagenos.odt Description: application/vnd.oasis.opendocument.text #+OPTIONS: ':nil *:t -:nil ::t :t H:3 \n:nil ^:t arch:headline #+OPTIONS: author:t c:nil creator:comment d:(not LOGBOOK) date:t #+OPTIONS: e:t email:nil f:t inline:t num:3 p:nil pri:nil prop:nil #+OPTIONS: stat:t tags:t tasks:t tex:t timestamp:t toc:t todo:t |:t #+TITLE: headline #+DATE: 2014-02-12 Wed #+AUTHOR: Jambunathan K #+EMAIL: kjambunat...@gmail.com #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+SELECT_TAGS: export #+EXCLUDE_TAGS: noexport #+CREATOR: Emacs 24.3.50.20 (Org mode 8.2.5h) #+TOC: headlines * Headline 1 Some text. See [[Headline 2]]. #+PAGEBREAK: * Headline 2 Some more text.
Re: [O] tricky odt export needs
Jambunathan K writes: When we are typesetting a xref in a backend - I can authoritatively speak for the ODT backend - we need not be resticted to ONE-OF but can have ANY-COMBINATION-OF descriptors. What I mean is this: In the pdf version of Emacs info manuals one typically sees all three of a Section number AND a Description AND a Page number, something like: See Section 3.1 [Tropical Storms], page 24. In Org context, I am wondering whether there is such a need. Two thoughts: 1. Assuming my suggestion for dedicated links to be typeset as page number references, one partly achieve this by multiple links. e.g. See Section [[*Tropical Storms]], page [[tropstorms]]. * Tropical Storms Bla bla bla... tropstorms Bla bla bla.. -- 2. Maybe, instead of trying to make simple cross-reference links do everything for everyone, it would be better to think in terms of creating several link types? e.g. something like See Section [[*Tropical Storms]], [[textref:*Tropical Storms]], [[pageref:tropstorms]]. Yours, Christian Moe
Re: [O] tricky odt export needs
Jambunathan K writes: The following message is a courtesy copy of an article that has been posted to gmane.emacs.orgmode as well. Christian Moe m...@christianmoe.com writes: You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. I am interested in rolling out support for xref by pagenumbers. I would like to know what the standard or recommended practice is like. So, when one says I want pagenumbers for xref, what xref-es they have in mind. Do they mean ONE-or-SOME-or-ALL of a xref to outline headings, figure, table, source listings, formula etc. I don't know what recommended practice is would be. My own take on this is that all objects you mention are probably best left as xrefs to the section, figure etc. concerned, exported as section title, section number, figure number etc. as appropriate. On a different thread, however, I have suggested that xrefs to *dedicated link targets* should export as page numbers in ODT. (Or this should be made an option.) http://article.gmane.org/gmane.emacs.orgmode/79096 Nicolas Goaziou raised a couple of objections on that thread, as did you. I forgot to copy my reply to the list, and I think I partly misunderstood what Nicolas was saying, anyway. Nicolas raised a use case I'd forgotten about: Dedicated link targets in list items are currently exported as the item number. Nicolas suggested that item numbers are more useful than page numbers here, and he's probably right. But keeping this behavior would make my proposal more complex to implement and maintain. Nicolas also raised concerns over backend compatibility. However, I don't think this is a strong argument against introducing page number references. A page reference solution makes sense for paged media (ODT, LaTeX backends) but not for screen (HTML). Finally, it should also be considered to make page numbers the default for *non-numbered* headings: When headings are not numbered in export (#+options: num:nil), current ODT export outputs a cross-reference with a descriptive text equal to the heading text of the item the dedicated target is in. However, this seems to be fragile; as soon as you Update Fields in LibreOffice, the cross-reference collapses to an empty space. The other backends also seem to struggle with the case of xrefs to headings without heading numbering. Yours, Christian
Re: [O] tricky odt export needs
I will respond to other items as I visit them. Meanwhile, I would like to add the following note for discussion. Christian Moe m...@christianmoe.com writes: When headings are not numbered in export (#+options: num:nil), current ODT export outputs a cross-reference with a descriptive text equal to the heading text of the item the dedicated target is in. When we are typesetting a xref in a backend - I can authoritatively speak for the ODT backend - we need not be resticted to ONE-OF but can have ANY-COMBINATION-OF descriptors. What I mean is this: In the pdf version of Emacs info manuals one typically sees all three of a Section number AND a Description AND a Page number, something like: See Section 3.1 [Tropical Storms], page 24. In Org context, I am wondering whether there is such a need. http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Reference-Syntax.html#Reference-Syntax (There are some variations on the xref markup to restrict whether te See is present or not, capitalized or not) http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Cross-Reference-Commands.html#Cross-Reference-Commands
Re: [O] tricky odt export needs
Christian Moe m...@christianmoe.com writes: You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. I am interested in rolling out support for xref by pagenumbers. I would like to know what the standard or recommended practice is like. So, when one says I want pagenumbers for xref, what xref-es they have in mind. Do they mean ONE-or-SOME-or-ALL of a xref to outline headings, figure, table, source listings, formula etc. Personally I wouldn't recommend use of filters to end users. Filters are useful for programmers not for the layman.
Re: [O] tricky odt export needs
Hi, Dan, Is this the message you get? No such file: /[path]/OpenDocument export failed: FIXME? Does the error always occur when you have my filter set, and never when you don't? Does it matter whether you're restricting export to subtrees? After some more testing, I'm seeing the above error message myself in a limited set of circumstances (only during subtree export, and only when the target/bookmark/label is at a higher heading level than the reference). But whether I use the filter or not does not seem to matter. I enclose a working version of the filter again, on the off chance that there was a typo in my previous message. #+begin_src emacs-lisp (defun my-odt-filter-pagerefs (text backend info) Make page-number references rather than textual references in ODT export. (when (org-export-derived-backend-p backend 'odt) (replace-regexp-in-string text:reference-format=\text\ text:reference-format=\page\ text))) (add-to-list 'org-export-filter-link-functions 'my-odt-filter-pagerefs) #+end_src Yours, Christian Dan Griswold writes: On Thu, Nov 21, 2013 at 11:38 AM, Suvayu Ali fatkasuvayu+li...@gmail.comwrote: First I would check the Output buffer. That should have more information on why the export failed. Thanks Suvayu. There was no Output buffer, only a few error messages in the *Messages* buffer (and these are of dubious relevance.) But it seems that the problem occurs only when I have org-odt-preferred-output-format set to odt rather than doc or nil. Dan
Re: [O] tricky odt export needs
On Thu, Nov 21, 2013 at 11:34:55AM -0500, Dan Griswold wrote: On Wed, Nov 20, 2013 at 4:33 PM, Christian Moe m...@christianmoe.comwrote: Well, here's one way to get those page references, using filters: (defun my-odt-filter-pagerefs (text backend info) Make page references, not textual references in ODT export. (when (org-export-derived-backend-p backend 'odt) (replace-regexp-in-string text:reference-format=\text\ text:reference-format=\page\ text))) (add-to-list 'org-export-filter-link-functions 'my-odt-filter-pagerefs) (Whee! I just wrote my first export filter.) That sounds pretty neat, Christian. But I get an export failed error, and it doesn't complete creating the odt file. Any suggestions? First I would check the Output buffer. That should have more information on why the export failed. Hope this helps, -- Suvayu Open source is the future. It sets us free.
Re: [O] tricky odt export needs
Well, as you can see with my exchange with Suvayu I got past the error. Yet I still have a strange problem. Your solution works on a small test file, but not on my large (~ 13k words) document. The conversion of text to page just doesn't happen. I do have a special style file, so I thought that might be the issue. But even when I remove the line #+ODT_STYLES_FILE: book.ott from the head of the file, there still seems to be no conversion. Puzzled, Dan On Wed, Nov 20, 2013 at 4:33 PM, Christian Moe m...@christianmoe.comwrote: I said: You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. Well, here's one way to get those page references, using filters: (defun my-odt-filter-pagerefs (text backend info) Make page references, not textual references in ODT export. (when (org-export-derived-backend-p backend 'odt) (replace-regexp-in-string text:reference-format=\text\ text:reference-format=\page\ text))) (add-to-list 'org-export-filter-link-functions 'my-odt-filter-pagerefs) (Whee! I just wrote my first export filter.) Org doesn't know what the page number will be, so when you open the document in e.g. LibreOffice, you still have to update fields (Tools Update) before you see page numbers. Yours, Christian
Re: [O] tricky odt export needs
Dan Griswold writes: Well, as you can see with my exchange with Suvayu I got past the error. Yet I still have a strange problem. Your solution works on a small test file, but not on my large (~ 13k words) document. The conversion of text to page just doesn't happen. Odd. The document I tested on yesterday was not much smaller. I do have a special style file, so I thought that might be the issue. But even when I remove the line #+ODT_STYLES_FILE: book.ott from the head of the file, there still seems to be no conversion. No, I can't think of any reason why a style file would interfere. Puzzled, too. Christian
Re: [O] tricky odt export needs
On Thu, Nov 21, 2013 at 11:38 AM, Suvayu Ali fatkasuvayu+li...@gmail.comwrote: First I would check the Output buffer. That should have more information on why the export failed. Thanks Suvayu. There was no Output buffer, only a few error messages in the *Messages* buffer (and these are of dubious relevance.) But it seems that the problem occurs only when I have org-odt-preferred-output-format set to odt rather than doc or nil. Dan
Re: [O] tricky odt export needs
On Wed, Nov 20, 2013 at 4:33 PM, Christian Moe m...@christianmoe.comwrote: Well, here's one way to get those page references, using filters: (defun my-odt-filter-pagerefs (text backend info) Make page references, not textual references in ODT export. (when (org-export-derived-backend-p backend 'odt) (replace-regexp-in-string text:reference-format=\text\ text:reference-format=\page\ text))) (add-to-list 'org-export-filter-link-functions 'my-odt-filter-pagerefs) (Whee! I just wrote my first export filter.) That sounds pretty neat, Christian. But I get an export failed error, and it doesn't complete creating the odt file. Any suggestions? Thanks, Dan
Re: [O] tricky odt export needs
Hello, Dan Griswold dgris...@rochester.rr.com writes: @text:span text:style-name=HighlightThis is a highlighted text@/text:span. But this is a regular text. doesn't work. That is, the resulting .odt file shows the text above with the @ symbols. Am I missing something? Syntax for Org 8.0 is: @@odt:text:span text:style-name=Highlight@@ Regards, -- Nicolas Goaziou
Re: [O] tricky odt export needs
Hi, @text:span text:style-name=HighlightThis is a highlighted text@/text:span. But this is a regular text. doesn't work. That is, the resulting .odt file shows the text above with the @ symbols. Am I missing something? No, the manual is. My bad, sort of; I meant to fix it a week ago but never got around to it. With the new exporter, the syntax is: @@odt:text:span text:style-name=Highlight@@This is a highlighted text@@odt:/text:span@@. But this is a regular text. The raw ODT is now wrapped in double @@'s, not preceded by a single @, and you need to specify the backend after the leading @@'s. It would be nice to know how I can get embedded odt tags to work as described in the manual. But what's more important, and may make the odt tag question moot, is to be able to mark places in the document as labels and page references. Even if I could get just the first part of that going (marking certain places as labels or cross reference sources) then I'd be further along. You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. Yours, Christian
Re: [O] tricky odt export needs
Thank you, Nicolas! This is just what I need. It seems that my installation of org mode (from orgmode.org/elpa) does not have its info file updated to reflect that change of syntax. Dan On Wed, Nov 20, 2013 at 3:24 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Hello, Dan Griswold dgris...@rochester.rr.com writes: @text:span text:style-name=HighlightThis is a highlighted text@/text:span. But this is a regular text. doesn't work. That is, the resulting .odt file shows the text above with the @ symbols. Am I missing something? Syntax for Org 8.0 is: @@odt:text:span text:style-name=Highlight@@ Regards, -- Nicolas Goaziou
Re: [O] tricky odt export needs
Thank you Christian, This is very helpful. I'll do some comparing of the standard way of doing links with the workaround I've stumbled into. Cheers, Dan On Wed, Nov 20, 2013 at 3:34 PM, Christian Moe m...@christianmoe.comwrote: Hi, @text:span text:style-name=HighlightThis is a highlighted text@/text:span. But this is a regular text. doesn't work. That is, the resulting .odt file shows the text above with the @ symbols. Am I missing something? No, the manual is. My bad, sort of; I meant to fix it a week ago but never got around to it. With the new exporter, the syntax is: @@odt:text:span text:style-name=Highlight@@This is a highlighted text@@odt:/text:span@@. But this is a regular text. The raw ODT is now wrapped in double @@'s, not preceded by a single @, and you need to specify the backend after the leading @@'s. It would be nice to know how I can get embedded odt tags to work as described in the manual. But what's more important, and may make the odt tag question moot, is to be able to mark places in the document as labels and page references. Even if I could get just the first part of that going (marking certain places as labels or cross reference sources) then I'd be further along. You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. Yours, Christian
Re: [O] tricky odt export needs
Dan Griswold dgris...@rochester.rr.com writes: It seems that my installation of org mode (from orgmode.org/elpa) does not have its info file updated to reflect that change of syntax. I updated the manual. Thank you. Regards, -- Nicolas Goaziou
Re: [O] tricky odt export needs
I said: You can do cross-references with ordinary links. Have a look at the manual section 4.2, Internal links. However, what you get out of the box is textual references to e.g. section headings, not page references. You can change that for each reference individually by right-clicking on them in LibreOffice. There should be a way to get page references by default, but off the cuff, I'm not sure how. Well, here's one way to get those page references, using filters: (defun my-odt-filter-pagerefs (text backend info) Make page references, not textual references in ODT export. (when (org-export-derived-backend-p backend 'odt) (replace-regexp-in-string text:reference-format=\text\ text:reference-format=\page\ text))) (add-to-list 'org-export-filter-link-functions 'my-odt-filter-pagerefs) (Whee! I just wrote my first export filter.) Org doesn't know what the page number will be, so when you open the document in e.g. LibreOffice, you still have to update fields (Tools Update) before you see page numbers. Yours, Christian
Re: [O] tricky odt export needs
Thank you! On Wed, Nov 20, 2013 at 4:10 PM, Nicolas Goaziou n.goaz...@gmail.comwrote: Dan Griswold dgris...@rochester.rr.com writes: It seems that my installation of org mode (from orgmode.org/elpa) does not have its info file updated to reflect that change of syntax. I updated the manual. Thank you. Regards, -- Nicolas Goaziou