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

How to render document header at top of first main page (like a journal article) #95

Closed
kastork opened this issue Feb 25, 2015 · 15 comments
Assignees

Comments

@kastork
Copy link

kastork commented Feb 25, 2015

I've searched, but I can't find a way to get the document's title and author data to just be at the top of the first page. PDF backend always renders the title info as a cover page, even for the article doc type -- is there a way? Not finding one, I submit this as an enhancement.

I know I can just skip the document header and use the level one section as the title of the doc, but then numbering is strange because all my first level headings look like second level headings.

@mojavelinux
Copy link
Member

This is a limitation to how Asciidoctor PDF is currently implemented. It always creates a title page.

There is one hack, though. You can disable the title (which also disabled the title page), and then you can add a discrete h1 heading that only shows for the PDF backend. This gives you to open to create a mini title bar at the top of the first page.

= Document Title
Author Name
// other attributes
ifdef::backend-pdf[:notitle:]

ifdef::backend-pdf[]
[discrete]
= {doctitle}
endif::[]

content of document

Let me know if that works for you. We should probably still consider having a way to display the document title on the same page as the content. How do you think we should specify that behavior?

@mojavelinux mojavelinux added this to the v1.6.0 milestone Apr 1, 2015
@kastork
Copy link
Author

kastork commented Apr 2, 2015

I'll give your workaround a try when I return to work next week. I think it will be satisfactory for many cases. Having your notes here in the docs is probably good enough. Thanks.

I'll have to look into what you do in latex when you want this -- the back of my mind is saying that an article type does this by default, and it is only the book type that has a title page. but the back of my mind is unreliable.

A journal article is usually all of this in-line

  • title, author and abstract
  • one or two column content
  • bibliography (in the same column layout as the content)

Abstract and two-column support and in-line bibliography may be asking more than the system is intended to provide. And, it may not be worth the effort since journals all have specific requirements that would require you to tweak things.

@mojavelinux
Copy link
Member

the back of my mind is saying that an article type does this by default (in LaTeX), and it is only the book type that has a title page. but the back of my mind is unreliable.

Very likely.

This is probably what we should be doing in Asciidoctor PDF. It is the way it is right now because I developed Asciidoctor PDF with a magazine output in mind...so I may not have thought the article scenario through properly. I also need to check what the DocBook output does, because we're trying to be consistent with that for people migrating. Again, I'll need to refresh my memory.

two-column support

I think two-column support belongs in the AsciiDoc -> LaTeX -> PDF chain. I'd like to avoid going down that road in Asciidoctor PDF because it's already hard enough to manage the layouts with Prawn :)

in-line bibliography

This I want to see supported consistently throughout the Asciidoctor toolchain because it's critical behavior.

@kastork
Copy link
Author

kastork commented Apr 29, 2015

Sorry it took me so long to get back to you on this. The workaround you suggested in your original response to this issue doesn't seem to work for me (asciidoctorj-pdf 1.5.0-alpha.6). I'll look at the related issue #105.

@kastork
Copy link
Author

kastork commented Apr 29, 2015

Okay... poked at this a little more, and after correcting some erroneous blank lines it basically works.

I can't get the :toc: to render the way I want, but for a PDF, the outline view provided by most PDF viewers makes this a small issue.

Two problems

  • the title appears twice in the PDF's outline view.
  • the author info is not rendered.

Here's an example:

= Document Title
author name
:icons: font
ifdef::backend-pdf[:notitle:]
ifdef::backend-pdf[]
[discrete]
== {doctitle}
endif::[]

== Section

_Hello_ there.

== Another Section

Foo

Which turns out a pdf that looks like: http://kas.d.pr/iZsX

@mojavelinux
Copy link
Member

That perfectly describes the state of things at the moment. It's clear what we need to do now to remove the need for these workarounds.

@mojavelinux
Copy link
Member

Depending on how things go for 1.5.0, we can consider making this part of that release or perhaps a micro release following it.

@MaWiMa
Copy link

MaWiMa commented May 1, 2015

The hack from mojavelinux works fine, if you do use this:

// :doctype: article
:authors: Name, Firstname
:doctitle: Document Title
ifdef::backend-pdf[:notitle:]
ifdef::backend-pdf[]
[discrete]
= {doctitle}
endif::[]

{authors}

== First Section
_Hello_ there.

== Second Section
Once upon a time...

Your two problems are solved.
If you use :authors: instead of :author: the author(s) also appear(s) in pdf-metadata (look at pdfmarks if you test both).

@kastork
Copy link
Author

kastork commented May 16, 2015

@MaWiMa That gets my immediate problem solved. Thanks!

@mojavelinux mojavelinux modified the milestones: v1.5.0, v1.6.0 May 25, 2015
@mojavelinux mojavelinux modified the milestones: v1.5.0.beta.1, v1.5.0 Aug 3, 2015
@mojavelinux
Copy link
Member

For the record, this is the same issue as #105.

@marco-m
Copy link

marco-m commented Oct 16, 2017

Hello, any news? :-)

@oliviercailloux
Copy link

oliviercailloux commented Feb 12, 2018

This issue also affects me. I’d like to show the main title and the subtitle on two different lines. Therefore, I adapted the workaround proposed here as follows.

= PhD proposal: Elicitation and explanation for voting rules
//Disables the title page
ifdef::backend-pdf[:notitle:]

ifdef::backend-pdf[]
[discrete]
= PhD proposal:
[discrete]
= Elicitation and explanation for voting rules
endif::[]

I have copied the main title and subtitle because I ignore how to access those as variables.

It would be more elegant to be able to customize this using a theme or in-document variables.

@ogmios-voice
Copy link

A more sleek solution:

:doctitle: <YOUR TITLE>
// other header attributes
ifdef::backend-pdf[:notitle:]
ifdef::backend-pdf[[discrete]]
= {doctitle}

// document content

And some remarks:

  1. set title with doctitle instead of =, or the TOC of the pdf will duplicate the text of the first heading (instead of using the title) (an asciidoctor-pdf bug?)
  2. you cannot define header attributes after a [discrete] line (as it is already considered document content)

(Still the proper solution would be #105)

@mojavelinux
Copy link
Member

Please see the proposed solution attached to #105. (PR #975)

@mojavelinux
Copy link
Member

This has been solved by PR #975. There is still some follow-up work to do, but the basic functionality is now in place.

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

6 participants