# Exercise 10: Create tables In this exercise, you will learn how to create and format tables in your TeachBook using Markdown and reStructuredText. ::::::{topic} Exercise objective Can you correctly format tables and reference them within your book? :::::: ```{tip} Tables help organize and present structured data clearly. JupyterBook supports Markdown tables and reStructuredText list-tables. ``` ## Writing Tables with Markdown 1. Open a new or existing Markdown file where you want to insert a table. 2. Add a simple table using the `|` separator and `---` for column alignment. Try the following example: ```md | Column 1 | Column 2 | Column 3 | |---|---|---| | Data 1 | Data 2 | Data 3 | | Data 4 | Data 5 | Data 6 | ``` ## Creating Tables with reStructuredText 3. You can also create tables using the `list-table` directive. The advantage of this method is that it allows referencing (refer to [Exercise 11](011.md)). Try the following example: ````md ```{list-table} Sample Data Table :header-rows: 1 * - Category - Value 1 - Value 2 * - Item A - 10 - 20 * - Item B - 15 - 30 ``` ```` 5. To test your understanding, try and create a new table from scratch with at least three columns, ensuring proper alignment and formatting, using both methods described above. 6. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button. 7. Add a commit message. 8. To see your changes, go to {octicon}`play;1em` `Actions` - The most recent workflow run `overview.md / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting). 9. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page. ```{admonition} Check your understanding :class: note Before moving on to the next exercise, make sure you understand the following: - How do you create a basic table using Markdown? - When would you choose to use a `list-table` instead of a Markdown table? - What syntax is required to define a `list-table`? - How do you specify column headers in a `list-table`? ```