Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title problems when using doctype book #329

Closed
mbartelsm opened this issue Oct 5, 2015 · 16 comments
Closed

Title problems when using doctype book #329

mbartelsm opened this issue Oct 5, 2015 · 16 comments

Comments

@mbartelsm
Copy link

When I use the doctype book attribute in a document, book parts (level 0 title) render on the same page as lower attributes (ie: immediately after). But level 1 titles have page breaks before them.

The problem causes book parts (level 0 sections) to be rendered on the same page as text from previous parts, but any following lower level titles are rendered on following pages. Also, chapter numbering completely ignores book parts, not resetting after them

But when the doctype is not set everything renders continuously and correctly, chapter numbers are reset after book parts and no weird page breaks are added, the only problem is that the "chapter" prefix is removed and the command prompt outputs an error reading "only book doctypes can contain level 0 sections", even though the PDF renders them correctly and correctly adds them to the TOC.

@mojavelinux
Copy link
Member

The page-break behavior you are observing is because the doctype book setting is literally attempting to layout the content as a book (where chapters start on a new page). This was done to fill a requirement of Asciidoctor PDF when it was created. There is an open issue to make this behavior configurable via the theme. See #74.

Just so you are aware, it is possible to override the layout_chapter method if you are using the Asciidoctor PDF API. But that's a fairly advanced usage.

chapter numbering completely ignores book parts, not resetting after them

This is just how AsciiDoc / Asciidoctor works. This is a change that would need to happen in core and is being discussed there. See asciidoctor/asciidoctor#979.

@mojavelinux
Copy link
Member

As a workaround for the page break issue, I recommend using the article doctype and ignoring the warning. The warning is actually harmless.

@mbartelsm
Copy link
Author

Well, the issue is not really that chapters have pagebreaks, but the fact that parts do not, resulting in the following:
untitled

Ignore the naming of chapters, I did it manually and messed up

@mojavelinux
Copy link
Member

Ah, I see. Thanks for the clarification.

Parts were not in the original requirements for Asciidoctor PDF, so they didn't get implemented properly. But this still traces back to #74 that we need the correct page breaks and they need to be configurable. These issues are now linked, so it should be clear that we need to check all the levels.

@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Oct 5, 2015
@nathany
Copy link

nathany commented Feb 15, 2016

Just ran into this issue today when generating a PDF with :doctype: book.

I wouldn't need it to be configurable (#74) if it just does what's expected for a given doctype.

@nathany
Copy link

nathany commented Jul 22, 2016

Bountysource

@vogella
Copy link
Contributor

vogella commented Aug 29, 2016

I'm currently putting in manually <<< but it would be nice if "=" puts in automatically a page break.

@mojavelinux
Copy link
Member

I'm going to move this issue up to 1.5.0.alpha.13 and just add the page break for parts when the doctype is book. That way, we get sane behavior right away, and pursue configurability via the theme in #74.

@mojavelinux mojavelinux self-assigned this Aug 31, 2016
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 31, 2016
- add part? method to Section
- add part_or_chapter? method to Section
- call start_new_part at the start of each part
- call layout_part_title to layout part title
- comments
@mojavelinux
Copy link
Member

Let me know what you think of the implementation. See #527.

@vogella
Copy link
Contributor

vogella commented Aug 31, 2016

From what I can understand from reading the implementation: +2

@mojavelinux
Copy link
Member

@nathany Is this the behavior you were hoping to have?

@nathany
Copy link

nathany commented Sep 1, 2016

I can't tell by looking at the code -- and I'm not totally sure how to test it.

@mojavelinux
Copy link
Member

@nathany I'm asking more about what your expectations are. As described above, I'm simply starting a new page at the beginning of a part (in addition to starting a new page at the beginning of a chapter). Does that match your expectations?

Btw, if you wanted to test the gem, you'd need to follow the steps described in: https://github.com/asciidoctor/asciidoctor-pdf#development. You can download the zip of the PR from https://github.com/mojavelinux/asciidoctor-pdf/tree/issue-329.

@nathany
Copy link

nathany commented Sep 1, 2016

Yes, that's what I'm looking for.

I also changed my Gemfile and tested it out. Works great! Thanks.

- gem 'asciidoctor-pdf', '~> 1.5.0.alpha.12'
+ gem 'asciidoctor-pdf', github: 'mojavelinux/asciidoctor-pdf', branch: 'issue-329'

@mojavelinux
Copy link
Member

Yes, that's what I'm looking for.

👍 Then I'll proceed with merging.

I also changed my Gemfile and tested it out.

Ah yes, that works too. I've noted down to document these steps more clearly in the README.

@nathany
Copy link

nathany commented Sep 2, 2016

Thank you Dan.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Sep 2, 2016
- add part? method to Section
- add part_or_chapter? method to Section
- call start_new_part at the start of each part
- call layout_part_title to layout part title
- comments
@mojavelinux mojavelinux removed the next label Sep 6, 2016
fapdash pushed a commit to vogellacompany/asciidoctor-pdf that referenced this issue Dec 13, 2016
…tor#527)

- add part? method to Section
- add part_or_chapter? method to Section
- call start_new_part at the start of each part
- call layout_part_title to layout part title
- comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants