I need to have left-aligned text in running_header_right but currently it is right-aligned by default and there is no way to change it.
provide something like:
header:
height: 1.5in
recto_content:
center: {document-title}
right: |
ISSUE: {issue} +
DATE: {date} +
PAGE: {page-number} of {page-count}
right_align: left
Why not allowing to have a custom asciidoc content for the whole header and whole footer?
Would be much better than these left/center/right.
I see the problem. However, you're thinking that there are 3 columns when in fact there are not. The alignment is also the placement. In other words, the reason the content is on the right is because it is aligned to the right. If you set the alignment to left, then the content would be on the left.
In order to achieve what you are asking, each position would also have to represent a column (or at least a left edge). Then, we could align within that column.
One way to express this would be to have a "columns" option (like in AsciiDoc) that could set the relative widths and alignments. For example:
header:
recto_content:
columns: <25%, ^50%, <25%
You could specify 2 or 3 column specs (1 being the default). This would effectively configure the a) left edge of each column and b) the horizontal alignment. In the future, we may be able to support vertical alignment as well.
wdyt? It's a little esoteric, but it would give you what you want.
Why not allowing to have a custom asciidoc content for the whole header and whole footer?
In short, because Prawn makes doing that very difficult. The purpose of the position is to give you more ways to place content.
Well, these columns would work, I think. So it is the same as we had a 3 column table in the header.
Sounds ok.
Also, is it somehow possible to have normal tab character in header and footer? It would make aligning text more easier. I tried but it didn't give good result.
Basically, my proposal will give you the control you are requesting.
Also, is it somehow possible to have normal tab character in header and footer?
No. Asciidoctor PDF treats text in prose just like in HTML. Repeating whitespace and tabs are collapsed to a single space. Like with HTML, it's necessary to use styles to achieve the layout you want (as my proposal offers).
Actually, repeating whitespaces are not collapsed to single space, at least in header. This is how I make formatting in the header now... What about specifying tab as ?
I meant as & # 0009 ;
Then that needs to be fixed because those are the rules we chose. I don't want to get into fixed layouts with tabs and spaces. I think it doesn't fit the philosophy of the project. Plus, it's really complicated to calculate tab columns. That's not something Prawn does for us. We had to do it in the verbatim blocks and it was quite a hassle.
Ok.
The alignment with 3 columns will improve things a lot. But also would be great to align the right hand strings as well, like:
ISSUE: 1
DATE: 19.10.2016
PAGE: 3 of 45
Actually, repeating whitespaces are not collapsed to single space, at least in header.
In fact, I'm pretty sure I've already fixed that. You can put hard line breaks, but all whitespace beyond that is collapsed.
Aha! Now that much is possible. You must use non-breaking spaces. That's the alignment character you want to use. And that is permitted.
In fact, any significant unicode space character is permitted, so long as the font supports it.
For example:
footer:
verso_content:
left: |
ISSUE:{nbsp}{nbsp}1 +
PAGE:{nbsp}{nbsp}{nbsp}{page-number} +
DATE:{nbsp}{nbsp}{nbsp}{revdate}
You can also use the character reference of  . This would be excellent to mention in the theming guide.
Ok, I think then with left alignment, non-breaking spaces and monospace font I can manage to make acceptable formatting.
I've scheduled the alignment fix for the upcoming alpha. I'll try to get it done soon. I think I have it in my head how to do it.
I managed to figure out how to do this. If the recto_columns or verso_columns is specified (aka colspecs) under the header or footer key, the layout switches to a 3 column-based layout (using absolute positioning).
Here's an example:
footer:
recto_columns: <25% =50% >25%
(< means align left, = means align center, > means align right)
The column widths are 25% for the left column, 50% for the center column and 25% for the right column. The content is aligned to the left for the left column, to the center for the center column, and to the right for the right column. If you wanted to align the right column to the left, use the value <25%.
TIP: It's possible to achieve 1 and 2 columns by setting the columns you aren't using to a width of 0%.
If the colspecs is not specified, the converter reverts to the old behavior.
There's one open question that remains. Should we allow the columns to overlap? Currently, I'm enforcing that each column occupy its own space. wdyt?
On a side note, it's definitely time to start thinking about refactoring the layout_running_content method. It's getting rather unwieldy.
In my opinion, the columns should not overlap
I decide to go ahead and flip the column placement (left, center, right) and content segments in the theme keys to make room for #454.
footer:
verso:
columns: "<25%,=50%,>25%"
left:
content: PAGE: {page-number}
I remapped the old keys, if found, for backwards compatibility.
Most helpful comment
For example:
You can also use the character reference of
 . This would be excellent to mention in the theming guide.