Get page-count into the document

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Get page-count into the document

TonK
I'm creating a large document that consists of multiple files (chapters) that are included. This document is a training with text on the left page explaining a picture that is on the right page. When one of the chapters has an odd number of pages the left/right requirements is messed up. So the picture is on the left and explaining text is on the previous pages, that you can't see. So I have to ensure that every chapter has an even number of pages.

I tried:

----
iifeval::[{page-count} / 2 != 0]

<<<

{emty} +
endif::[]
----

But that doesn;t work as the `page-count` is not available in the document.

Is there any way to ensure the number of pages is even?
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

mojavelinux
Administrator
If you want to ensure that each chapter starts on the same side, then you need to set media=prepress (automatic facing pages). See https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#prepress

And no, you cannot access the page count using an AsciiDoc attribute reference. But I wouldn't recommend what you are trying to do anyway since you are mixing content and presentation. It would be better to use an extension like a tree processor if media=prepress doesn't give you what you need.

Best Regards,

-Dan

On Tue, Oct 27, 2020 at 2:59 AM TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm creating a large document that consists of multiple files (chapters) that are included. This document is a training with text on the left page explaining a picture that is on the right page. When one of the chapters has an odd number of pages the left/right requirements is messed up. So the picture is on the left and explaining text is on the previous pages, that you can't see. So I have to ensure that every chapter has an even number of pages.

I tried:

----
iifeval::[{page-count} / 2 != 0]

<<<

{emty} +
endif::[]
----

But that doesn;t work as the `page-count` is not available in the document.

Is there any way to ensure the number of pages is even?


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

TonK
Thank you for your stunningly quiick reply. Much appreciated.

I added "prepress" to the document and that gives the exact opposite result. Descriptions on the right and (previous) picture on the left. But with some rearranging I probably can get away with that.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

mojavelinux
Administrator
If you consult the theming guide, you'll find a way to invert it. See pdf-folio-placement.

If you want me to help further, I'll need a concrete example to draw on.

Best Regards,

-Dan
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

TonK
Thanks for the offer, I'll see it that us needed.

If it is possible to work around it, I'll gladly do that,

Can you tell me if it is possible to have a "== Introduction" chapter, where this is part of the TOC, but not shown on the page where the chapter starts? That way I can define a "chapter page" that contains only the name of the chapter and a '<<<' at the end. That way every chapter's text starts on a left page.

I have added a screenshiot with what I intend to do. The left page is the explanation of the slide on the right,
In a printed version this is a convenient way to attend the training.

 
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

mojavelinux
Administrator
I'll be honest, I'm really confused about what you are trying to accomplish. Now that I see your example, it's not the same thing as facing pages.

Since pages are continuous, there's no real concept of a left page per se. It all depends on which page you start counting on. Any page can be a left page if you just look at it and say the next page is the right page. So I don't understand why that isn't what you already have.

> Can you tell me if it is possible to have a "== Introduction" chapter, where this is part of the TOC, but not shown on the page where the chapter starts? That way I can define a "chapter page" that contains only the name of the chapter and a '<<<' at the end

No, that's not possible.

I'll be honest, it kind of feels like you are using Asciidoctor PDF for something it wasn't intended to do. Asciidoctor PDF was not designed to make slides. If that's what you want, you may want to consider using Asciidoctor Reveal.js instead (which has a PDF export option).

Best Regards,

-Dan

On Tue, Oct 27, 2020 at 10:14 AM TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Thanks for the offer, I'll see it that us needed.

If it is possible to work around it, I'll gladly do that,

Can you tell me if it is possible to have a "== Introduction" chapter, where this is part of the TOC, but not shown on the page where the chapter starts? That way I can define a "chapter page" that contains only the name of the chapter and a '<<<' at the end. That way every chapter's text starts on a left page.

I have added a screenshiot with what I intend to do. The left page is the explanation of the slide on the right,
In a printed version this is a convenient way to attend the training.

 


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8301.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

TonK
Let me try to explain it another wy (and otherwise we just give up :-))

I'm not trying to make slides, these are created with LibreOffice and then converted to svg's and included in my document.

What I'm trying to do is: I create a document to handout to trainees, that contains all the slides in the training with explanatory text, so they can use this document as well. The layout of the document is like a book, and it will be printed. To make this document easy to use I want the left (the even pagenumbers) to contain the explanatory text and the right page (the odd pagenumbers) the slide and maybe extra info. This is so that when the book lays open the text and slide both face up.

But the problem I'm trying to solve is: When I generate a book, the chapter starts at the odd page (right) and then the accompanying slide is on the next left (even page), so they are not together. So, if I, somehow, can print a book with the pages in the postiions I  want them in I am a very happy camper. I would also settle for something like printing the chaptername in white text on a white background and place some picture on the first page of the chapter with the second page staring with the training text.

I hope this explains what I'm trying to achieve. No matter if it's possible or not I want to thank you very muh for your support.
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

David Jencks
I’m confused about the confusion here.

Perhaps using ‘recto’ and ‘verso’ could clarify the situation.

My understanding is that you want chapters to start on verso pages.

The theming guide theming-guide.adoc indicates that with prepress chapters always start on recto pages.  That doesn’t appear to be configurable.

Why not include a short introductory page for each chapter, placed recto, followed by the actual content on verso/recto pairs?  I’d think your “paint it white” idea would also work, although it would end up with 2 blank pages at the start of every chapter.  If I understand correctly, you are considering this already…. I’d wonder if the content would be more comprehensible with a short summary or abstract at the start of each chapter.

David Jencks

On Oct 27, 2020, at 12:21 PM, TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Let me try to explain it another wy (and otherwise we just give up :-))

I'm not trying to make slides, these are created with LibreOffice and then converted to svg's and included in my document.

What I'm trying to do is: I create a document to handout to trainees, that contains all the slides in the training with explanatory text, so they can use this document as well. The layout of the document is like a book, and it will be printed. To make this document easy to use I want the left (the even pagenumbers) to contain the explanatory text and the right page (the odd pagenumbers) the slide and maybe extra info. This is so that when the book lays open the text and slide both face up.

But the problem I'm trying to solve is: When I generate a book, the chapter starts at the odd page (right) and then the accompanying slide is on the next left (even page), so they are not together. So, if I, somehow, can print a book with the pages in the postiions I  want them in I am a very happy camper. I would also settle for something like printing the chaptername in white text on a white background and place some picture on the first page of the chapter with the second page staring with the training text.

I hope this explains what I'm trying to achieve. No matter if it's possible or not I want to thank you very muh for your support.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8303.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

mojavelinux
Administrator
> The theming guide theming-guide.adoc indicates that with prepress chapters always start on recto pages.  That doesn’t appear to be configurable.

That's not true, as I previously pointed out. That's the whole point of the pdf-folio-placement attribute, which allows you to invert the recto/verso designation, and either bind it to physical or virtual page numbers.

In order to shift the numbering (so that the chapters are even numbers), you also need to set page_numbering_start_at to 2. I do see one limitation with that. It's not possible to set the start_at value to 0, which would ensure the first chapter is page 2 (and the blank page before it is page 1). I'll look into that. For now, it will be a roman numeral (since 1 will be the page after the first chapter).

Best Regards,

-Dan

On Tue, Oct 27, 2020 at 1:45 PM David Jencks [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I’m confused about the confusion here.

Perhaps using ‘recto’ and ‘verso’ could clarify the situation.

My understanding is that you want chapters to start on verso pages.

The theming guide theming-guide.adoc indicates that with prepress chapters always start on recto pages.  That doesn’t appear to be configurable.

Why not include a short introductory page for each chapter, placed recto, followed by the actual content on verso/recto pairs?  I’d think your “paint it white” idea would also work, although it would end up with 2 blank pages at the start of every chapter.  If I understand correctly, you are considering this already…. I’d wonder if the content would be more comprehensible with a short summary or abstract at the start of each chapter.

David Jencks

On Oct 27, 2020, at 12:21 PM, TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:

Let me try to explain it another wy (and otherwise we just give up :-))

I'm not trying to make slides, these are created with LibreOffice and then converted to svg's and included in my document.

What I'm trying to do is: I create a document to handout to trainees, that contains all the slides in the training with explanatory text, so they can use this document as well. The layout of the document is like a book, and it will be printed. To make this document easy to use I want the left (the even pagenumbers) to contain the explanatory text and the right page (the odd pagenumbers) the slide and maybe extra info. This is so that when the book lays open the text and slide both face up.

But the problem I'm trying to solve is: When I generate a book, the chapter starts at the odd page (right) and then the accompanying slide is on the next left (even page), so they are not together. So, if I, somehow, can print a book with the pages in the postiions I  want them in I am a very happy camper. I would also settle for something like printing the chaptername in white text on a white background and place some picture on the first page of the chapter with the second page staring with the training text.

I hope this explains what I'm trying to achieve. No matter if it's possible or not I want to thank you very muh for your support.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8303.html
To start a new topic under Asciidoctor :: Discussion, [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8304.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

TonK
I worked around it. :-)

I created a small theme (nochap.yml)
----
---
extends: training.yml
heading:
  h2-font-color: #ffffff
  h2-font-size: 0.1pt
----

Now I just specify `== Chaptername` for a new chapter, that automatically starts at the recto page (but you can;t see it) and this chapter is placed in the TOC as well.

Now I can punt on this page whatever I want and end with `<<<` ensuring the explanatory text is on the verso page and the image of the slide is on recto.

I know it;s not the way it is supposed to be, but if it works, it works

Thanks for your help
Reply | Threaded
Open this post in threaded view
|

Re: Get page-count into the document

mojavelinux
Administrator
> I know it;s not the way it is supposed to be, but if it works, it works

Sometimes, that's what it takes.

In the meantime, I'm exploring a way of allowing the page number to start counting on the page before the first chapter so that chapters can be even pages.

Best Regards,

-Dan

On Fri, Oct 30, 2020 at 8:24 AM TonK [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I worked around it. :-)

I created a small theme (nochap.yml)
----
---
extends: training.yml
heading:
  h2-font-color: #ffffff
  h2-font-size: 0.1pt
----

Now I just specify `== Chaptername` for a new chapter, that automatically starts at the recto page (but you can;t see it) and this chapter is placed in the TOC as well.

Now I can punt on this page whatever I want and end with `<<<` ensuring the explanatory text is on the verso page and the image of the slide is on recto.

I know it;s not the way it is supposed to be, but if it works, it works

Thanks for your help


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Get-page-count-into-the-document-tp8296p8321.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux