htmlasciidocasciidoctor

Auto-width columns (or TeX-like tabular) in AsciiDoc?


I want to document linguistic data using AsciiDoc, converting the document into HTML. For that I need to have a word-by-word translation that pretty much looks like a table but with columns of unequal width.

For example:

hakuna     matata
exist-NEG  PL-problem

I would like the columns to be of minimal width but not equal to each other; "minimal" as in no line breaks are needed within a cell. If it was pure HTML I would simply not specify the width of any cell and would work just fine.

Is there a way of telling asciidoctor not to set any widths of table columns? I couldn’t find a way of turning equal sizing off.

Alternatively, I could imagine chaining inline blocks with two lines each for a similar looking result. But I couldn’t find anything like this in the docs. Inline blocks would also solve the issue of lines with glosses that span wider than the page and therefore need breaking—as tables don’t break, but inline blocks would.

Is there anything to achieve inline blocks in asciisoc? Could I implement something that would turn a certain block type into inline blocks?


Solution

  • You can use the autowidth option:

    = Document
    
    [%autowidth, cols="a,a"]
    |===
    | hakuna
    | matata
    
    | exist-NEG
    | PL-problem
    |===
    

    enter image description here