# Generating and inserting tables

This page explains how to generate, edit, and insert LaTeX tables in Overleaf. In practice, there are four options to create tables:

1. Using the [**Insert Table** button](#using-insert-table-to-generate-a-table) in the **Visual Editor** (or **Code Editor**) toolbar.
2. [pasting-tables-into-your-project](https://docs.overleaf.com/writing-and-editing/generating-and-inserting-tables/pasting-tables-into-your-project "mention") from another document while using **Visual Editor**.
3. Writing the [LaTeX code for the table](https://www.overleaf.com/learn/latex/Tables) in **Code Editor**.
4. Using **Overleaf**’s [LaTeX table generator](https://docs.overleaf.com/writing-and-editing/generating-and-inserting-tables/ai-table-generator).

If you’re a confident LaTeX user you'll likely use option 3, which offers the most flexibility for generating tables. In that case, our detailed guidance on [how to create tables using LaTeX](https://www.overleaf.com/learn/latex/Tables) will serve you well.

If you’re new to LaTeX, both the AI-powered LaTeX table generator and the toolbar in **Visual Editor** (option 1) provide excellent starting points. This page will focus on using the Visual Editor toolbar, from which you can switch between Visual Editor and Code Editor to observe the underlying table code.

## Using Insert Table to generate a table

{% stepper %}
{% step %}
Switch to **Visual Editor** using the toggle above the editor pane (or remain in **Code Editor** if you are comfortable editing LaTeX code).
{% endstep %}

{% step %}
Select the **Insert table** button (![](https://3502988919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVetOkhFZmAC8QCQK0Pi7%2Fuploads%2FJGs0RhCU8pT59HENdGrR%2Fimage.png?alt=media\&token=72b100da-882b-4780-b89c-7a7e4e04fa5e)) on the toolbar:

<figure><img src="https://3502988919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVetOkhFZmAC8QCQK0Pi7%2Fuploads%2FoCtZxcNp3sxTaZOPkDZH%2FScreenshot%202025-12-17%20162213.png?alt=media&#x26;token=77937789-f664-4909-a886-2b58b160865d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
Click on **Select size** (see [ai-table-generator](https://docs.overleaf.com/writing-and-editing/generating-and-inserting-tables/ai-table-generator "mention") to learn how to **Insert from a text prompt or image**).
{% endstep %}

{% step %}
Using the pop-up selector, highlight the required number of rows and columns, then click the bottom-right selected cell to insert an empty table. Here, we insert a blank 3 x 3 table:

<div data-full-width="true"><figure><img src="https://3502988919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVetOkhFZmAC8QCQK0Pi7%2Fuploads%2FLBYjCs3j2e2Hh4ksYDYw%2FInsertTableSelector.png?alt=media&#x26;token=6507bd4a-f2d7-4337-9cbd-6a314ddfc758" alt="The Insert Table pop-up selector"><figcaption></figcaption></figure></div>

This short video clip shows a 3 × 3 table being added to a project.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/7F9YTneTbxZAkAoN5vH3oK/7f157cd637b9aca5827beb52cecbb645/TestingTableGenerator.mp4>" fullWidth="true" %}

{% endstep %}

{% step %}
The empty table is now ready for you to edit. You can do this in **Code Editor** if you’re comfortable with LaTeX table code, or continue with **Visual Editor**, which provides additional table formatting functionality that’s currently unavailable in **Code Editor**.
{% endstep %}
{% endstepper %}

## FAQs about tables

<details>

<summary>What if I want more formatting options?</summary>

There are many ways to configure tables that aren’t yet possible using **Visual Editor** generated tables. For more complex formatting you’ll need to use LaTeX code. Read our detailed guidance on [how to create tables using LaTeX](https://www.overleaf.com/learn/latex/Tables).

</details>

<details>

<summary>Can the Visual Editor preview tables I create using the Code Editor?</summary>

It depends on the table and its code, but the Visual Editor will try to preview as much as possible. Complex tables, such as those created using LaTeX packages, journal article templates, or custom user commands (macros), may be partially, or entirely displayed as LaTeX code when viewed in the Visual Editor.

If the table cannot be previewed, e.g., it contains LaTeX markup errors, you will see the following message:

<div align="left"><figure><img src="https://learn.overleaf.com/learn-scripts/images/4/44/InsertTableCannotPreview.png" alt="&#x22;Sorry, your table can&#x27;t be displayed at the moment&#x22; message" height="111" width="394"><figcaption><p>""</p></figcaption></figure></div>

</details>

<details>

<summary>Does <strong>Visual Editor</strong> support the <code>booktabs</code> package?</summary>

**Visual Editor** has some support for horizontal rules provided by the [`booktabs` package](https://ctan.org/pkg/booktabs?lang=en). The following example uses the `booktabs` package commands `\toprule`, `\midrule`, and `\bottomrule`.

```latex
\documentclass{article}
\usepackage{booktabs}
\usepackage{hologo} % for the XeTeX logo
\begin{document}
\begin{table}
\begin{tabular}{lcc}
\toprule 
    \TeX{} engine&Year released&Native UTF-8\\
\midrule 
    pdf\TeX&1996&No\\ 
    \hologo{XeTeX}&2004&Yes\\ 
    Lua\TeX&2007&Yes\\
    LuaHB\TeX&2019&Yes\\ 
\bottomrule
\end{tabular}
\end{table}
\end{document}
```

[Open this example in Overleaf and switch to Visual Editor.](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Previewing+a+booktabs+table+in+Visual+Editor\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bbooktabs%7D%0A%5Cusepackage%7Bhologo%7D+%25+for+the+XeTeX+logo%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Btable%7D%0A%5Cbegin%7Btabular%7D%7Blcc%7D%0A%5Ctoprule+%0A++++%5CTeX%7B%7D+engine%26Year+released%26Native+UTF-8%5C%5C%0A%5Cmidrule+%0A++++pdf%5CTeX%261996%26No%5C%5C+%0A++++%5Chologo%7BXeTeX%7D%262004%26Yes%5C%5C+%0A++++Lua%5CTeX%262007%26Yes%5C%5C%0A++++LuaHB%5CTeX%262019%26Yes%5C%5C+%0A%5Cbottomrule%0A%5Cend%7Btabular%7D%0A%5Cend%7Btable%7D%0A%5Cend%7Bdocument%7D)

Open the code above, then switch to **Visual Editor** to see the following preview:

<div align="left"><figure><img src="https://www.gitbook.com/cdn-cgi/image/dpr=2,width=760,onerror=redirect,format=auto/https%3A%2F%2Flearn.overleaf.com%2Flearn-scripts%2Fimages%2F3%2F39%2FInsertTableBooktabsDemo.png" alt="Preview for tables" width="375"><figcaption></figcaption></figure></div>

</details>

<details>

<summary>Does <strong>Visual Editor</strong> preview borders applied using <span class="math">\LaTeX</span> code?</summary>

Borders created within the tabular environment using `|` in the table’s specification, or `\hline` in the table body will be previewed in **Visual Editor**, as demonstrated by the next example.

```latex
\documentclass{article}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c|c|c}
         R1C1&R1C2& \\
         \hline
         R2C1&  & \\
         \hline
         R3C1 &R3C2 &R3C3\\
\end{tabular}
    \caption{This is my table caption.}
    \label{tab:mynewtable}
\end{table}
\end{document}
```

[Open this example in Overleaf and switch to Visual Editor.](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Creating+table+borders+with+LaTeX+code\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Btable%7D%0A%5Ccentering%0A%5Cbegin%7Btabular%7D%7Bc%7Cc%7Cc%7D%0A+++++++++R1C1%26R1C2%26+%5C%5C%0A+++++++++%5Chline%0A+++++++++R2C1%26++%26+%5C%5C%0A+++++++++%5Chline%0A+++++++++R3C1+%26R3C2+%26R3C3%5C%5C%0A%5Cend%7Btabular%7D%0A++++%5Ccaption%7BThis+is+my+table+caption.%7D%0A++++%5Clabel%7Btab%3Amynewtable%7D%0A%5Cend%7Btable%7D%0A%5Cend%7Bdocument%7D)

Open the code above, then switch to **Visual Editor** to see the following preview:

<div align="left"><figure><img src="https://www.gitbook.com/cdn-cgi/image/dpr=2,width=760,onerror=redirect,format=auto/https%3A%2F%2Flearn.overleaf.com%2Flearn-scripts%2Fimages%2Fd%2Fd4%2FInsertTableLaTeXDisplayBorders.png" alt="Preview of table" width="375"><figcaption></figcaption></figure></div>

</details>

## Learn More

* [Tables](https://www.overleaf.com/learn/latex/Tables) at Overleaf's [Learn LaTeX](https://www.overleaf.com/learn)
* [Positioning images and tables](https://www.overleaf.com/learn/latex/Positioning_images_and_tables) at Overleaf's [Learn LaTeX](https://www.overleaf.com/learn)
