> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/in-depth-articles/02-a-quick-visual-guide-to-creating-table-cells-with-diagonal-lines-in-latex.md).

# A quick visual guide to creating table cells with diagonal lines in LaTeX

There are many packages in LaTeX that help with table creation – [booktabs](https://www.ctan.org/pkg/booktabs) is a popular example—and there are also a growing number of automatic table generators now available online (such as [this one](https://www.tablesgenerator.com/)) which are a great way to create the LaTeX code for a table without having to type it out manually. There's even a package to help you create [really long tables](https://www.overleaf.com/read/xxwzfxkxxjmc) that span multiple pages! But what if you want to add some additional styling or formatting to certain cells within your tables?

The simple answer is that there's usually a package for it! Here we focus on one particular piece of cell formatting—how to create table cells with diagonal lines. These diagonal lines often used in the upper-left corner of a table to allow both row and column headers to be placed in that same cell, and there are two similar packages that can be used to achieve this: `slashbox` and `diagbox`.

To help you try this out, we've added [a short example](https://www.overleaf.com/read/zrnpkbmzvtk) which demonstrates how to produce diagonal lines in table cells using those packages. Some people prefer to use `diagbox` because the lines produced by `slashbox` can be more jagged, while the `diagbox` lines are smoother; however, we've included options for both in the example so you can decide for yourself!

In addition, we've recorded an animated GIF showing how to add the file `slashbox.sty` to your project directly from the CTAN repository.

![Using the slashbox and diagbox LaTeX packages for tables on Overleaf](/files/bWmnAdnqc76DFnyE0YHW)

We hope this helps, and if you'd like to see more animated GIF tutorials please [let us know](https://www.overleaf.com/contact).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/in-depth-articles/02-a-quick-visual-guide-to-creating-table-cells-with-diagonal-lines-in-latex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
