Boost logo

Boost :

Subject: Re: [boost] How to center an element in Boost QuickBook?
From: Niall Douglas (ndouglas_at_[hidden])
Date: 2013-08-07 11:26:09


> > The DocBook documentation suggests one can do a '''<entry
> > align="center">'''__tick__'''</entry>''' (the triple single ticks
> > escape from QuickBook into BoostBook). However unfortunately BoostBook
> > defines CSS which overrides the per-cell alignment :(
>
> How about trying <colspec align="center"> instead?
> If I understand the documentation right, you should put that in the table
> heading.

I actually stumbled across an answer to this quite by accident, and at the
same time I solved how to do coloured text in Boost Quickbook.

Witness the beauty of coloured and centered Quickbook text in the table at
https://ci.nedprod.com/view/All/job/Boost.AFIO%20Build%20Documentation/Boost
.AFIO_Documentation/doc/html/afio/design/acid_write_ordering/write_ordering_
data.html.

Here's how I did it in Quickbook:

[table:power_loss_safety Power loss safety matrix: What can you lose if
power is suddenly lost?
  [[][[role aligncenter Metadata no longer matches data[footnote This
doesn't mean that metadata is corrupted,
  this means for example that a file is said to have 100Kb but is in fact
partially garbage because metadata was updated before data was fully changed
on storage.]]][[role aligncenter Newly created file content
corrupted]][[role aligncenter File data content rewrite corrupted]][[role
aligncenter Max seconds of writes reordered without using `fsync()`]][[role
aligncenter Max seconds of writes lost]]]
  [[[role alignright FAT32]][__tick__][__tick__][__tick__][][]]
  [[[role alignright ext2]][__tick__][__tick__][__tick__][[role aligncenter
5]][[role aligncenter 5]]]
  [[[role alignright ext3/4
`data=writeback`]][__tick__][__tick__][__tick__][[role aligncenter
5/60]][[role aligncenter 60]]]
  [[[role alignright ext3/4 `data=ordered`
(default)]][__cross__][__cross__][__tick__][[role aligncenter 5/60]][[role
aligncenter 60]]]
  [[[role alignright UFS + soft
updates]][__cross__][__cross__][__tick__][][]]
  [[[role alignright HFS+]][__cross__][__cross__][__tick__][][]]
  [[[role alignright NTFS]][__cross__][__cross__][__tick__][][]]
  [[[role alignright ext3/4
`data=journal`]][__cross__][__cross__][__cross__][[role aligncenter
60]][[role aligncenter 60]]]
  [[[role alignright BTRFS]][__cross__][__cross__][__cross__][][]]
  [[[role alignright ZFS]][__cross__][__cross__][__cross__][[role
aligncenter 5]][[role aligncenter 30]]]
]

The key here is the [role styleclass text] modifier: this just happens to
spit out <span class="styleclass">text</span>. By adding suitable extra CSS
to the main CSS file, one can make coloured text, or in my case, turn a span
into a display:inline-block; and therefore can do text-align:center.

I hope this is useful to someone someday. If [role] will continue to always
do this, and it's not just by accident, it might be worth adding to the
Quickbook FAQ. That said, a proper formally specified typesetting mechanism
would be a lot better again.

Niall

---
Opinions expressed here are my own and do not necessarily represent those of
BlackBerry Inc.



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk