For AI agents: a documentation index is available at https://idratherbewriting.com/llms.txt. Markdown versions of all pages are available by appending .md to any page URL.

Search results

DITA: Tables

You can insert two kinds of tables in dita: a simple table and a more formal cals table. However, there doesn't seem much point to using the simple table, as it's not really much simpler. The cals table gives you more options and seems to use more straightforward tagging.

To insert a table, either click the Table button in the Author view and select your options, or in the Text view, type t, wait for the "table" prompt, and then press Enter. In the cols="" field, type the number of columns you want. Put your cursor right after tgroup element and type < and select thead at the prompt, then press Enter.

The table code looks like this:

 <table>
  <title>Table title</title>
  <tgroup cols="2">
   <thead>
    <row>
     <entry>Button</entry>
     <entry>Description</entry>
    </row>
   </thead>
   <tbody>
    <row>
     <entry>Print</entry>
     <entry>Prints the document.</entry>
    </row>

    <row>
     <entry>Open</entry>
     <entry>Opens the file.</entry>
    </row>
   </tbody>
  </tgroup>
 </table>

The title ends up being set as the caption on the top of the table. You can actually set the column widths using the table properties. Switch to the Author mode to view your table. Grab the middle column divider and drag it a bit. You'll be prompted whether you want proportional or fixed columns. Choose proportional, since it will render better on different devices. Now drag the middle column divider to the width appropriate for your content.

Sponsored

Once you set the column widths, switch back to the text view to see the values assigned to the colspec element that was added to your table.

You can also add the proportions directly in the colspec element. If you choose proportional widths, the values might look like the following:
<tgroup cols="2">
    <colspec colnum="1" colname="c1" colwidth="1*"/>
    <colspec colnum="2" colname="c2" colwidth="2*"/>

Here, the first second column will be twice as wide as the first column.

About Tom Johnson

Tom Johnson

I'm an API technical writer based in the Seattle area. On this blog, I write about topics related to technical writing and communication — such as software documentation, API documentation, AI, information architecture, content strategy, writing processes, agent skills, tech comm careers, and more. Check out my AI courses for more on the latest in AI and tech comm. If you're looking for info about documenting APIs, see my API documentation course.

If you're a technical writer and want to keep on top of the latest trends in tech comm, be sure to subscribe to email updates below. You can also learn more about me or contact me.

Finally, I want to note a couple of things. I usually write the first drafts of my posts myself and then use AI to improve accuracy, clarity, and detail in places, so my writing is a mix of human and AI. (Hopefully that's not too off-putting.) Also, the opinions I express on my blog are my own perspectives, not those of my employer.