> 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/zh-tw/shen-ru-wen-zhang/02-a-quick-visual-guide-to-creating-table-cells-with-diagonal-lines-in-latex.md).

# 在 LaTeX 中建立帶斜線的表格儲存格的快速視覺指南

LaTeX 中有許多套件可以協助製作表格－ [booktabs](https://www.ctan.org/pkg/booktabs) 是一個很受歡迎的例子，而且現在線上也有越來越多自動表格產生器可用（例如 [這個](https://www.tablesgenerator.com/)），它們是產生表格的 LaTeX 程式碼而無需手動輸入的好方法。甚至還有一個套件可以幫助你建立 [非常長的表格](https://www.overleaf.com/read/xxwzfxkxxjmc) ，而且可以跨越多頁！但如果你想為表格中的某些儲存格加入額外的樣式或格式呢？

簡單的答案是：通常都會有相對應的套件！在這裡，我們聚焦於某一種特定的儲存格格式——如何建立帶有對角線的表格儲存格。這些對角線通常用在表格的左上角，以便將列標題和欄標題同時放在同一個儲存格中，而有兩個相似的套件可用來達成這個效果： `slashbox` 以及 `diagbox`.

為了幫助你試試看，我們加入了 [一個簡短的範例](https://www.overleaf.com/read/zrnpkbmzvtk) ，示範如何使用那些套件在表格儲存格中產生對角線。有些人偏好使用 `diagbox` ，因為 `slashbox` 所產生的線條可能比較鋸齒狀，而 `diagbox` 的線條則較平滑；不過，我們在範例中同時加入了這兩者的選項，讓你可以自行決定！

此外，我們還錄製了一段動畫 GIF，示範如何將檔案 `slashbox.sty` 直接從 CTAN 儲存庫加入到你的專案中。

![在 Overleaf 上使用 slashbox 與 diagbox LaTeX 套件處理表格](/files/7554cc740b4bb0494d850735b1ba2336f29b3d6e)

我們希望這些內容對你有幫助，如果你想看更多動畫 GIF 教學，請 [告訴我們](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/zh-tw/shen-ru-wen-zhang/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.
