CONTENTS DELETED
The author has deleted this message.
|
Administrator
|
This is not something that's going to be easy, or even possible. We're able to do this in the table of contents because the table of contents and the index because both are written last. We don't have a way to go back and add page numbers into the prose using Prawn. We can refer to section numbers, but not page numbers. If I could design a PDF rendering library, I would definitely do it using a 2 pass model. Unfortunately, Prawn is implemented as a single pass, so we don't know where elements will fall until they are written. It just so happens we can refer to references that occur earlier in the text (for reasons I just mentioned), but that isn't really a complete solution. -Dan On Sat, Nov 12, 2016 at 12:59 PM, handy [via Asciidoctor :: Discussion] <[hidden email]> wrote: For example: Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
A possible solutionThe Latex typesetting system has this feature. A solution to your problem would be to use the Asciidoctor-latex extension to use latex to typeset the PDF. However I am not sure how you would instruct Latex to do this using Asciidoctor syntax. I think this would be quite useful to know how to do.How Latex implements page numbered cross referencesIt's interesting that the Tex typesetting system is also not a 2 pass system. Latex gets around this by requiring at least two runs of the Tex processor. In the first run it records all the locations of the labels and fills in all page references with "??". In the second run the location of the labels are known from the previous run and so all the page references are filled in with the appropriate page numbers. You may suspect that this may not guarantee correct page number references, and it does not. There are some latex documents whose references numbers never converge to a solution, but apparently these are rarely encountered.Source If page numbered references were to be implemented using the Prawn processor, this may be a method to consider. RantI usually use the Latex processor instead of the asciidoctor pdf processor because of it's beautiful typesetting. The typesetting system has mostly stood the test of time and this is being improved upon. IMO, the only problem is that the latex markup system is so closely intertwined with the tex typesetting system markup that it is not suitable for producing anything other than statically typeset media. And so we end up with tons of great articles on the internet (e.g. arXiv.org) which cannot be viewed in a web friendly format. I understand there are some good reasons for sticking with pdf only. |
Administrator
|
Thanks for the insight! It's interesting that the Tex typesetting system is also not a 2 pass system. Latex gets around this by requiring at least two runs of the Tex processor. I'd call that a 2 pass system. How the two passes are done is secondary. IMO, the only problem is that the latex markup system is so closely intertwined with the tex typesetting system markup that it is not suitable for producing anything other than statically typeset media. That's primarily why I view a shift away from LaTeX (as an authoring format) to be an improvement. Web is publishing nowadays and if you can't publish on the web, you aren't really reaching the principal audience. I usually use the Latex processor instead of the asciidoctor pdf processor because of it's beautiful typesetting I'd argue that the goal of Asciidoctor PDF is quite different from that of LaTeX. Asciidoctor PDF doesn't try or pretend to be an ideal typesetting solution. It's aimed to produce a quality looking PDF within minimal effort using a CSS-inspired theming system. If you do need custom behavior, you can jump right into the Ruby code and get direct access to the PDF object builder. If you want to write in AsciiDoc but still take advantage of LaTeX typesetting, then I strongly recommend using the Asciidoctor LaTeX converter. There's no reason not to use LaTeX if you're already familiar with it. AsciiDoc affords you that choice. Cheers, -Dan Dan Allen | @mojavelinux | https://twitter.com/mojavelinux |
I was trying to draw parallels to the limitation of Prawn that you described. Just as Latex has to get around the 1 pass nature of Tex, Asciidoctor PDF has a similar problem with Prawn. I concede, that is interesting! I'll keep that in mind for future use cases. Thanks! |
Administrator
|
I was trying to draw parallels to the limitation of Prawn that you described. Just as Latex has to get around the 1 pass nature of Tex, Asciidoctor PDF has a similar problem with Prawn. I see what you're saying. The problem is, while TeX/LaTeX can manipulate its own output, Prawn can't easily. I guess if I got creative and really dug in, I could figure out how to manipulate the object tree before the render/write step, but navigating that internal object tree is tricky. Adding page numbers in the content isn't necessarily impossible (I mean, with enough creativity, nothing is really impossible), but I haven't yet thought of the strategy to make it happen. I'm certainly open to ideas, so keep them coming as you think of them. Where there's a will, there's a way. Cheers, |
Hello and thank you for your great job.
Why would the prawn single pass limitation not prevent to put the page number in header and footer using a variable where it would prevent it in Cross reference labels or in any role based themed attribute ? Wouldn't it be possible to use a similar methodology ? |
Free forum by Nabble | Edit this page |