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

Content in table head cell isn't considered when determining width of column #599

Closed mojavelinux closed 5 years ago

mojavelinux commented 8 years ago

The content in the table head cell (i.e. the cell in the table head row) isn't considered when determining the (automatic) width of the column. As a result, if the content in this cell needs more space than the body cells in the same column, the content in the head cell gets hard wrapped by char.

mojavelinux commented 8 years ago

Consider the following AsciiDoc:

[%header%autowidth]
|===
|Operation |Operator

|multiply
|*

|divide
|/

|add
|+

|subtract
|-
|===

Here's how it is rendered:

issue-599

mojavelinux commented 8 years ago

This problem has been resolved prawn-table and the fix will be available in the next release of that library (perhaps 0.2.3). If it's released before alpha.14, I'll upgrade the version in the gemspec. If not, I'll loosen the version range to ~> 0.2.2 so the release gets picked up once available.

As described in the linked issue, the problem was the the width calculation was not being performed on the formatted (i.e., bold) text. Therefore, the calculation was off by enough to cause the content in the head cell to not fix on the line.

owenh000 commented 7 years ago

Until a new prawn-table release, possible workarounds for this problem include:

mojavelinux commented 5 years ago

Another way to solve this problem is to add the following to your Gemfile:

gem 'prawn-table', github: 'prawnpdf/prawn-table'

Since this is solved by upgrading prawn-table, and it's possible to use the development version of prawn-table with Asciidoctor PDF, I'm going to mark this as closed (with workaround).

mojavelinux commented 2 years ago

It's no longer necessary to use the unreleased version of prawn-table with Asciidoctor PDF. Please use the latest release of prawn-table from rubygems.org. That's the only version that is tested with Asciidoctor PDF.