org-mode-ox-odt icon indicating copy to clipboard operation
org-mode-ox-odt copied to clipboard

lanscape documents (default) with toc seems to fail

Open ouboub opened this issue 2 years ago • 13 comments

Hi I thought it might be better to open a new issue. Please feel free to close it, if you don't agree. I just took your example and tried to add a toc, by changing the line

#+options: timestamp:t title:nil toc:nil todo:t |:t

to

#+options: timestamp:t title:nil toc:t todo:t |:t

but then the exporter failed. I attach a zip file that includes both org files and the file bug.txt landscape-default.zip

ouboub avatar Jul 17 '22 06:07 ouboub

Move TOC manually after the first landscape page.

See line 41 https://github.com/kjambunathan/org-mode-ox-odt/blame/master/testing/examples/odt/pagebreak.org.

The above file can be used to create a book with TitlePage, Copyright Page, etc. Do an M-s o for :page-style in that file for how the pages shift. In LibreOffice, the mode line will tell you page style in use.

kjambunathan avatar Jul 17 '22 07:07 kjambunathan

Move TOC manually after the first landscape page.

See line 41 https://github.com/kjambunathan/org-mode-ox-odt/blame/master/testing/examples/odt/pagebreak.org.

The above file can be used to create a book with TitlePage, Copyright Page, etc. Do an M-s o for :page-style in that file for how the pages shift. In LibreOffice, the mode line will tell you page style in use.

thanks, but I seem to be unable to follow your instructions I tried to place the magic

#+toc: headlines 1
* Toc 
:PROPERTIES:
:ATTR_ODT: :page-style "OrgFirstPage" :page-number 1
:END:

in various places of the file, without any result. I thought it should be easy but it is not I attach some of my experiments. sorry, really sorry landscape-default.zip

ouboub avatar Jul 18 '22 15:07 ouboub

These questions will help you get a mental model of what is happening ....

  1. What is the leading content in my document?
  2. What style--paragraph or otherwise--does that leading content use?
  3. What is the page style that is associated with that style? Can I change it to what I want which is Landscape or whatever.

landscape-default.zip

Start with the *.diff file in that zip.

kjambunathan avatar Jul 19 '22 03:07 kjambunathan

That zip does not contain any diff file, it seems to be the same zip I sent, or do I misunderstand your proposal?

ouboub avatar Jul 20 '22 12:07 ouboub

@ouboub I can export your files without any error. I think what kjambunathan is suggesting is:

  1. some styles has page-style set by "master-page-name"
  2. some page style has setting for the following page with "next-style-name"

So if you want a page to be landscape, first you need to look at the "master-page-name" for the entity on that page, or you might to check the previous page entity that has a page style with a "next-style-name".

QiangF avatar Jul 20 '22 13:07 QiangF

That zip does not contain any diff file, it seems to be the same zip I sent, or do I misunderstand your proposal?

I attached the wrong file.

Next time we are exchanging zip files, we should add what version we are talking about. Look at this one

landscape-default-20220720.zip

I suggest you

  • unzip the .odt file (just press RET when on dired), and
    • examine the .xml content, and track the various styles in content.xml and styles.xml,
    • open LibreOffice stylist and see various page styles etc., and what page style appears in modeline

kjambunathan avatar Jul 20 '22 14:07 kjambunathan

Maybe add toc page-style support, page-style is a property of any text:

#+toc: headlines 1 :page-style "Landscape"

It's not so user friendly if all these entity needs special care. The odt exporter has a lot of features, we might need more coherency, and put less distracting code inside the document, instead add more help functions or more keywords to generate things such as extra ad-hoc styles.

My preferred way of insert toc is:

#+attr_odt: :transclude t :page-break t
[[file:./toc.odt]]

Toc has many format options, it is far easier to transclude another file designed in libreoffice gui. toc.odt

I think we also need good looking default, the above toc file is better to be the default in my opinion.

QiangF avatar Jul 21 '22 01:07 QiangF

It's seems the :page-break setting is not in effect:

#+attr_odt: :transclude t :page-break t
[[file:./toc.odt]]

#+attr_odt: :transclude t :page-break "before"
[[file:./toc.odt]]

#+attr_odt: :transclude t :page-break "after"
[[file:./toc.odt]]

QiangF avatar Jul 21 '22 02:07 QiangF

"Q" == QiangF @.***> writes:

Maybe add toc page-style support, page-style is a property of any text: #+toc: headlines 1 :page-style "Landscape"

It's not so user freindly if all these entity needs special care. The odt exporter has a lot of features, we might need more coherency, and put less distracting code inside the document, instead add more help functions or more keywords to generate things such as extra ad-hoc styles.

I second that. I have to admit that I still had not the time to investigate in more detail what is wrong with my file (that is of course entirely my fault) and therefore would appreciate and enhancement in convenience.

ouboub avatar Jul 21 '22 05:07 ouboub

It's seems the :page-break setting is not in effect:

#+attr_odt: :transclude t :page-break t
[[file:./toc.odt]]

#+attr_odt: :transclude t :page-break "before"
[[file:./toc.odt]]

#+attr_odt: :transclude t :page-break "after"
[[file:./toc.odt]]

I have noted this, I will add this.

kjambunathan avatar Jul 21 '22 12:07 kjambunathan

This is how your produce Landscape documents.

Snippet below has settings for producing the following types of documents

  • A4 (Landscape)
  • A5 (Portrait)
  • A non-standard 10cm x 10cm document
  • US (Portrait)

Remember to execute the corresponding elisp snippet before exporting.

* A4 Landscape

#+name: A4Landscape
#+begin_src emacs-lisp :exports results :results none
(setq org-odt-master-styles
      (org-odt-define-page-style "Standard"
                                 :layout-style "A4LandscapeLayout"
                                 :footer-template t))
(setq org-odt-extra-automatic-styles nil)
#+end_src

* COMMENT A5 Portrait

#+name: A5Portrait
#+begin_src emacs-lisp :exports results :results none
(setq org-odt-extra-automatic-styles
      (org-odt-define-page-layout "A5PortraitLayout"
                                  :page-dimensions "a5"))

(setq org-odt-master-styles
      (org-odt-define-page-style "Standard"
                                 :layout-style "A5PortraitLayout"
                                 :footer-template t))
#+end_src

* COMMENT Non-standard 10cm x 10cm Layout

#+name: CustomSquareLayout
#+begin_src emacs-lisp :exports results :results none
(setq org-odt-extra-automatic-styles
      (org-odt-define-page-layout "MyCustomSquareLayout"
                                  :page-dimensions '(10 . 10)))

(setq org-odt-master-styles
      (org-odt-define-page-style "Standard"
                                 :layout-style "MyCustomSquareLayout"
                                 :footer-template t))
#+end_src

* COMMENT US Letter Portrait Layout

#+name USLetterPortrait
#+begin_src emacs-lisp :exports results :results none
(setq org-odt-extra-automatic-styles
      (org-odt-define-page-layout "LetterPortraitLayout"
                                  :page-dimensions "letter"
                                  :print-orientation 'portrait))

(setq org-odt-master-styles
      (org-odt-define-page-style "Standard"
                                 :layout-style "LetterPortraitLayout"
                                 :footer-template t))
#+end_src

* Anim esse incididunt anim et quis pariatur

Aliquip dolor do aute magna culpa nulla sed tempor fugiat.

Velit id duis ea ex nostrud labore eiusmod.  Et voluptate pariatur ut
aute esse labore proident, eu sed occaecat nostrud.  Non cillum
incididunt ut est sed nostrud adipiscing culpa duis qui.  Deserunt non
est lorem veniam, laborum eiusmod occaecat velit est tempor
reprehenderit nisi aliquip aliquip sint incididunt deserunt cupidatat
qui.

Anim sint minim enim nulla sunt in ut et pariatur quis culpa velit qui
quis nisi  duis.  Non lorem  est laborum incididunt  cillum adipiscing
minim aute consequat.

Culpa nostrud ea ea commodo sunt laboris aliqua pariatur commodo nulla
reprehenderit enim.   Cillum ea  duis pariatur amet,  occaecat ullamco
est  veniam,  commodo  nostrud   ipsum.   Proident,  non  exercitation
consectetur id eu labore eiusmod  qui sit ullamco do incididunt labore
et magna  anim occaecat occaecat  occaecat.  Dolore dolore  nostrud et
anim tempor ullamco proident,.  Amet,  duis adipiscing labore amet, do
nisi aliqua sit non id laborum  ea.  Elit, enim tempor duis aliquip in
consectetur laboris.

Duis do est eiusmod adipiscing dolore aute aute.  Duis ut laboris
elit, lorem excepteur ea excepteur tempor cillum voluptate mollit.
Nisi tempor sed commodo duis occaecat ullamco ad in do ipsum cupidatat
labore.  Lorem anim esse dolore pariatur ea exercitation id
exercitation.  Dolore aute veniam, consequat cupidatat et duis anim
lorem mollit do consectetur est magna nostrud cillum in.  Aliqua id
consectetur nisi id magna pariatur excepteur sed esse in pariatur ut
dolore.  Excepteur cillum sed amet, et fugiat dolore duis.

Ea consectetur qui consequat laboris duis tempor laborum.  Laboris eu
ad velit consectetur ad enim adipiscing culpa velit nisi consectetur
anim nisi voluptate ullamco.  Minim eu dolor non id reprehenderit do
in.

Exercitation culpa quis id aliquip elit, id ut occaecat ex culpa ipsum
anim dolore enim deserunt.  Ea culpa sunt adipiscing velit id aliqua
exercitation.  Aute qui veniam, sed aliquip sit laboris lorem.  Aliqua
aliquip velit sint exercitation laboris officia anim elit, sit
reprehenderit est deserunt ad sit labore amet,.  Sit consequat
occaecat pariatur lorem eiusmod et cupidatat.

kjambunathan avatar Oct 09 '22 15:10 kjambunathan

"JK" == Jambunathan K @.***> writes:

This is how your produce Landscape documents. Snippet below has settings for producing the following types of documents

Thanks very much, I presume I have to pull first?

Commit 25349:bb36992b8909c7fd3ccf4a4798eccd2505b5bb6b Now produce Landscape and other documents with ease

Seems the important one.

  • A4 (Landscape)
  • A5 (Portrait)
  • A non-standard 10cm x 10cm document
  • US (Portrait)

I will try out and report back, thanks again

ouboub avatar Oct 09 '22 16:10 ouboub

This is how your produce Landscape documents.

Snippet below has settings for producing the following types of documents

  • A4 (Landscape)
  • A5 (Portrait)
  • A non-standard 10cm x 10cm document
  • US (Portrait)

Remember to execute the corresponding elisp snippet before exporting.

* A4 Landscape

#+name: A4Landscape
#+begin_src emacs-lisp :exports results :results none
(setq org-odt-master-styles
      (org-odt-define-page-style "Standard"
                                 :layout-style "A4LandscapeLayout"
                                 :footer-template t))
(setq org-odt-extra-automatic-styles nil)
#+end_src

* COMMENT A5 Portrait

I pulled compiled loaded and tested your example! works like charm, thanks very much indeed!

ouboub avatar Oct 09 '22 17:10 ouboub