asciidoctor / asciidoctor-pdf

:page_with_curl: Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
https://docs.asciidoctor.org/pdf-converter/latest/
MIT License
1.14k stars 500 forks source link

Different page margins for pages with no running-content? (e.g. TOC) #1325

Closed lurch closed 2 years ago

lurch commented 5 years ago

I've got a "big" header (because I'm including a logo-image)

header:
  height: 1in

and so I've adjusted my page margins as https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#keys-running-content says to do:

page:
  margin: [1.1in, 0.5in, 0.5in, 0.5in]

However as running-content-start-at defaults to body, this means I also have a big (empty) page-margin on my TOC pages too, which looks a bit odd.

I guess as a workaround I can set

running-content:
  start-at: toc

but perhaps it might be useful if there was a way to specify different page-margins for pages which do and don't display "running content"?

mojavelinux commented 5 years ago

This is not a can of worms I'm interested in opening up. If this is something you want to do, you can extend the converter and add this behavior. It's less complex now that the converter updates the page margins based on the layout (i.e., orientation), but there are likely still a lot of edge cases to consider.

lurch commented 5 years ago

This is not a can of worms I'm interested in opening up.

LOL, feel free to close this issue then :slightly_smiling_face: :snake:

mojavelinux commented 5 years ago

To be clear, this converter is already getting entirely too complicated, and this will just compound the number of permutations that have to be handled and tested. This is where we draw the line and say that it's a goal for the HTML-based converter that will succeed this one.

mojavelinux commented 5 years ago

I'll mark it as future to give someone a chance to come along and put forth a proposal. But it can't introduce too much complexity.

mojavelinux commented 2 years ago

You can now do this using an extended converter. Here's an example:

class PDFConverterNarrowTOC < (Asciidoctor::Converter.for 'pdf')
  register_for 'pdf'

  def ink_toc *_args
    indent 100, 100 do
      super
    end
  end
end

Here's the result:

toc