Creating Tables in Markua

Keywords: table, tables, Markua, plain text, data

Leanpub Support avatar
Written by Leanpub Support
Updated over a week ago

In this article we're going to show you how to write tables in Markua.

The technical specification for how this works can be found here. (Please note that not all of the table formatting specifications have not been implemented yet, but that is the complete roadmap.)

Creating a Table in Markua

A table is an arrangement of data with rows and columns.
​

In Markua, you create rows and columns using the pipe character on your keyboard:
​

|
​

Under the top header row, you need to add delimiter row separating the header row from the data rows below. You do this using the hyphen character:

-

Here's a simple table you might write in Markua to show whether or not a professional sports team won or lost a game in a season:
​

| Game Number | Win/Loss |
| --- | --- |
| 1 | Win |
| 2 | Loss |

Here's what that table will look like in the PDF:

Setting the Table Width

You can set the table width by writing a width attribute above the table like this:

{width: 100%}
| Game Number | Win/Loss |
| --- | --- |
| 1 | Win |
| 2 | Loss |

Here's what that table will look like in the PDF:

Setting the Column Widths

You can set the column width percentages using the column-widths attribute above the table like this:

{column-widths: "10% 90%"}
| Game Number | Win/Loss |
| --- | --- |
| 1 | Win |
| 2 | Loss |

Here's what that table will look like in the PDF:

Adding a Caption to a Table

You can add a caption to a table using the title attribute like this:

{title: "Win/Loss Record"}
| Game Number | Win/Loss |
| --- | --- |
| 1 | Win |
| 2 | Loss |

Here's what that table will look like in the PDF:

Adding More Than One Attribute to a Table

You can add more than one of these instructions to a table by separating them with commas.

For example, here is how you would set both the column widths and the caption:

{column-widths: "10% 90%", title: "Win/Loss Record"}
| Game Number | Win/Loss |
| --- | --- |
| 1 | Win |
| 2 | Loss |

Here's what that table will look like in the PDF:


If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!

If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!

Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book

Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!

To learn about amazing new books and authors, subscribe to our YouTube channel here: https://www.youtube.com/leanpub.

You can also follow Leanpub in lots of other places!

Did this answer your question?