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

Footnotes are not positioned correctly #85

Closed
gAmUssA opened this issue Jan 12, 2015 · 68 comments
Closed

Footnotes are not positioned correctly #85

gAmUssA opened this issue Jan 12, 2015 · 68 comments

Comments

@gAmUssA
Copy link

gAmUssA commented Jan 12, 2015

I trying to use footnotes with pdf like

image

in pdf it doesn't display correctly

image

Thanks

@gAmUssA
Copy link
Author

gAmUssA commented Jan 12, 2015

Not sure but maybe it relates to #83

@mojavelinux
Copy link
Member

You should be able to use cross references inside a footnote (keep in mind that footnotes display inline currently). Thus, you can do something like:

SPI footnote:[More information about the SPI can be found in <<chapter_13#,Chapter 13>>

I recommend using an explicit title in the xref as I have done, though the implicit title should work when creating the PDF.

@jmini
Copy link

jmini commented May 6, 2015

In my opinion this has nothing to do with references but with the fact that footnotes display inline currently:

Example:

Just the Java code.footnote:[
With the exception of the [filename]+plugin.xml+ and [filename]+MANIFEST.MF+ files required for Eclipse plugins.
]. 
Developers preferring to write the necessary code manually, may do so. 

PDF:

pdf output

HTML:

html output

Footnotes looks much better in the HTML output because they are not inlined.

@mojavelinux
Copy link
Member

mojavelinux commented May 6, 2015 via email

@mojavelinux
Copy link
Member

mojavelinux commented May 6, 2015 via email

@mojavelinux
Copy link
Member

The way Prawn works, it makes it very difficult to figure out how to reserve space for the footnotes at the bottom of the page. First, we have to know if there are any footnotes on the current page. Then, we have to calculate how many lines we need to render those footnotes. If we need a lot of lines, there's a chance that it pushes a paragraph off the page. If that paragraph was the source of a footnote, then we have less footnotes and we need less space. It gets pretty complicated pretty quickly.

@graphitefriction suggested that once we have at least one footnote on a page, we reserve a fixed amount of space and reduce the font size of the footnotes to fit in that space. I think this is how the DocBook toolchain works (but we should double check).

The easiest solution is to put the footnotes at the end of the chapter (which is a standard place for them to go, just not always the most convenient).

@mojavelinux
Copy link
Member

If that paragraph was the source of a footnote, then we have less footnotes and we need less space.

We may just let this be an edge case where we end up with more space for footnotes than needed. At least we are able to fit the footnotes.

@mojavelinux
Copy link
Member

Related to #73.

@rlopez133
Copy link

@mojavelinux Definitely a difficult task to fix indeed. What about instead of trying to automatically figure out spacing, statically add space to the footer as the # of footnotes are added to page by X up to only Y # of footnotes. If additional footnotes reside on page, move footnotes to following page. For example, say I have 6 footnotes on a page. However, you have decided that per page the most footnote space I'll allocate to a page is X which would only fit 5 footnotes. The 6th footnote would just be moved to the following page. Also the edge case where it pushes a paragraph containing footnotes to following pg, then the footnotes should reside on that new page not the previous page.

In the end, all I'm trying to say is maybe its better to have the user help define how many footnotes they need versus trying to automagically render all the info. :) It at least would be way better than inline footnotes IMO.

@mojavelinux
Copy link
Member

mojavelinux commented Jun 11, 2015 via email

@rlopez133
Copy link

Let me know if you need someone to test it out :)

@mojavelinux
Copy link
Member

Count on it!

@nathany
Copy link

nathany commented Oct 2, 2015

I just added footnotes and ran into this issue with them rendering inline in PDFs.

They appear at the end of the document (a chapter) when using the AsciiDoctor Chrome extension.

@mojavelinux
Copy link
Member

Putting them at the end of the document / chapter would be the easiest way, and probably the first step. But in a page-oriented layout like PDF, the correct place to put them is at the bottom of the page. That requires some tricks, but as I mentioned above, I think I sorted out a creative solution. Prawn is a bit stiff in this area, so it requires that we be creative. (It would be nice if Prawn had flexible regions, but it doesn't really abstract to that level).

@nathany
Copy link

nathany commented Oct 2, 2015

Either would be an improvement over having the footnotes inline, though the bottom of the page makes sense. For now I'm going to comment them out, because this just doesn't look good.

footnotes

Thanks.

@nathany
Copy link

nathany commented Oct 2, 2015

How easy would it be to have the footnotes appear at the end of the chapter?

I only have a few footnotes right now, so it's probably easiest if I emulate that behaviour by hand. I can just do some superscript numbers and regular text at the end.

@mojavelinux
Copy link
Member

Easy enough that I'm going to split this issue into two parts. First I'm going to implement the end of the chapter approach. I'll commit that as a short-term workaround. Then I'll dig into getting them at the bottom of the page (perhaps using an option to control the placement).

@mojavelinux
Copy link
Member

This is one of the next things I'll work on.

Putting footnotes inline wasn't really intended for production output. That was more to remind us that they weren't being handled and so we didn't drop content. More like debugging output.

@nathany
Copy link

nathany commented Oct 8, 2015

Thanks Dan. I can also help test it out.

@mojavelinux mojavelinux modified the milestones: v1.5.0.beta.1, v1.5.0 Oct 14, 2015
@getreu
Copy link

getreu commented Oct 16, 2015

For scientific use of asciidoctor-pdf bottom footnotes are indispensable. As this feature is not yet available in asciidoctor-pdf-1.5.0.alpha.9 another workaround could be using asciidoctor-latex <file>.adoc or asciidoctor -b docbook <file>.adoc.

@rasusmilch
Copy link

Noticed this myself trying to write an archival document. I figure that plain ASCII is the way to go, and seems ASCIIDoc is a nice implementation. I agree that footnotes at the bottom of the page is indispensable. This PDF renderer is much nicer than the others, so I appreciate the work done.

I look forward to at least the end-of-chapter workaround. How can I help?

@mojavelinux
Copy link
Member

I pretty much know what I have to do, so it's just a matter of doing it. I'll try to prototype soon so that I can see what help is needed. Usually, I discover stuff in the first few minutes of hacking.

@rasusmilch
Copy link

@mojavelinux You know what you need to do for end notes or bottom-of-page footnotes? Obviously I'm more excited about the later, but that's good news regardless.

@mojavelinux
Copy link
Member

If someone wants to try to solve this problem, I'd be happy to assist. I just have too many things on my plate to dedicated time to it right now.

@Cellebyte
Copy link

@mojavelinux, how far is your progress at putting endnotes on the last page of a chapter?

@bcourtine
Copy link

Hello.

I opened a PR for a partial fix to this footnotes problem: #1010

@mojavelinux
Copy link
Member

@bcourtine Thanks for submitting that PR! That provided me with the raw materials for a full solution. Stay tuned for a revised proposal.

@mojavelinux
Copy link
Member

So the logic will be that the footnotes will go at the end of the chapter for a book (or the end of the document if there are any remaining) and the end of the document for an article.

One open question is whether the footnote definition should be duplicated if the reference to the footnote appears in multiple chapters. For now, I think we'll just link to where the footnote was original defined. If that feels to unnatural, we can think about how to duplicate it.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 7, 2019
…ocument (article)

- place list of footnotes at end of chapter (when doctype is book) or document (when doctype is article)
- add footnotes category to theme to style footnote list
- add additional footnotes to example documents
- honor footnotes-title attribute to control title of footnote list (unset by default)
@mojavelinux
Copy link
Member

Please test PR #1016. I believe you will be pleased. Thanks again to @bcourtine for getting the ball rolling on this!

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 7, 2019
…ocument (article)

- place list of footnotes at end of chapter (when doctype is book) or document (when doctype is article)
- add footnotes category to theme to style footnote list
- add additional footnotes to example documents
- honor footnotes-title attribute to control title of footnote list (unset by default)
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 13, 2019
…ocument (article)

- place list of footnotes at end of chapter (when doctype is book) or document (when doctype is article)
- add footnotes category to theme to style footnote list
- add additional footnotes to example documents
- honor footnotes-title attribute to control title of footnote list (unset by default)
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Apr 13, 2019
…ocument (article)

- place list of footnotes at end of chapter (when doctype is book) or document (when doctype is article)
- add footnotes category to theme to style footnote list
- add additional footnotes to example documents
- honor footnotes-title attribute to control title of footnote list (unset by default)
@mojavelinux
Copy link
Member

This is solved in master in so far as we made the end notes.

I've though long and hard about whether it's possible to make bottom-of-the-page footnotes. While I have better ideas now about how it might work, I simply don't have the time it would take to implement a solution. Regardless, that will need to be tracked in a separate issue.

@rv0
Copy link

rv0 commented Jul 12, 2019

Did any "bottom-of-the-page footnote" efforts happen after this?

@mojavelinux
Copy link
Member

No, it's not possible (unless someone can prove me wrong). We'll be sticking with the current solution (unless someone comes forward to show that it's possible to do it another way).

@arjantijms
Copy link

No, it's not possible (unless someone can prove me wrong).

Just wondering, but if it's not possible, how do tools like FrameMaker and LaTeX accomplish this? Would it not be possible to study the LaTeX source code?

@mojavelinux
Copy link
Member

mojavelinux commented Jan 22, 2020

It's not possible because of how Prawn is implemented. It writes directly to the PDF stream with no way to rollback. Tools like FrameMaker and LaTeX use multiple passes of trial and error until all the content fits. Prawn just can't do that. It would require implementing Prawn (and pdf-core) from scratch with a different architecture.

@mojavelinux
Copy link
Member

We will not be implementing footnotes in this converter. That will be a key requirement for the browser-based PDF converter, currently called asciidoctor-pdf.js.

@arjantijms
Copy link

Interesting. I can't see that it isn't possible with the current engine, I thought you meant it wasn't possible in general (for PDF).

How will the browser-based PDF converter work? Render everything into HTML first, and then generate PDF from that?

@mojavelinux
Copy link
Member

I can't see that it isn't possible with the current engine, I thought you meant it wasn't possible in general (for PDF).

Exactly. Thanks for pointing that out. I'm specifically talking about a limitation of the tech stack in this converter.

Render everything into HTML first, and then generate PDF from that?

Correct, though it's all in memory / via an API. We're using browser tech as the layout engine. I'll post more details once the 1.5.0 and 2.0.0 releases are out. Though you can read up on it here: https://github.com/Mogztter/asciidoctor-pdf.js/

@mishka88ru
Copy link

Hi @mojavelinux
May be it will be easier if a long footnote(s) will be allowed to overflow to the next page?
Like here, note arrows >>>

изображение

@mojavelinux
Copy link
Member

We're sticking with putting footnotes at the end of chapter or article. The PDF generator we use simply cannot easily accommodate more advanced layouts.

@radekosmulski
Copy link

@mojavelinux is there a way to put the footnotes at the end of the chapter at the bottom of the page? Right now they immediately follow the text and it does not look great, not sure what would be a good solution to go about this.

@vog
Copy link

vog commented Nov 23, 2020

As this issue is closed, I assume it would be better to open a separate issue for this new problem.

@mojavelinux
Copy link
Member

mojavelinux commented Nov 23, 2020 via email

@radekosmulski
Copy link

Thank you very much for your replies @vog and @mojavelinux! Opened a new issue #1833

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