> 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/zhi-shi-ku/075-how-to-paste-formatted-content-into-overleaf.md).

# 如何將格式化內容貼到 Overleaf

*請注意：貼上格式化內容是一項新功能，我們持續進行改進，以確保它能在各種情境下良好運作。我們也非常希望收到您對此功能的意見回饋，您可以在以下位置提供：* [*這份問卷*](https://docs.google.com/forms/d/e/1FAIpQLSc7WcHrwz9fnCkUP5hXyvkG3LkSYZiR3lVJWZ0o6uqNQYrV7Q/viewform)*.*

您可以貼上格式化內容，包括 [表格](#pasting-tables-into-your-overleaf-project), [images](#pasting-images-into-your-overleaf-project), [樣式化文字](#pasting-styled-text-into-your-overleaf-project)、以及 [清單](#pasting-lists-into-your-overleaf-project) 到我們的 **視覺編輯器** ，並使用 Ctrl+V（Windows/Linux）或 Cmd+V（MacOS）保留格式。

您貼上的內容將會以格式化方式顯示於 **視覺編輯器** 而在 **程式碼編輯器** 中，您將能看到 Overleaf 為您產生的 LaTeX 程式碼。（不過，請勿嘗試將格式化文字貼到 **程式碼編輯器** 中！）

您可以將內容貼到 **視覺編輯器** ，來源包括 Google 文件、 [Microsoft 365](https://www.microsoft.com/en-us/microsoft-365) （原 Microsoft Office）、 [LibreOffice](https://www.libreoffice.org/)及網站。目前不支援從 PDF 文件貼上格式化內容。若要透過 Microsoft 工具獲得最佳結果，請使用線上版本，不過也支援桌面應用程式。

將格式化內容貼到 **視覺編輯器**後，您會看到一個下拉式選單，可讓您將貼上的（格式化）內容還原為純文字（不含格式）：

![顯示將格式化文字貼到 Overleaf 時所出現選單的圖片"](/files/69ce29a19e0d2a48b568a737ae7557a42207a915)

* **貼上時不保留格式** 將格式化文字轉換為純文字。
* **貼上時保留格式** 切換回格式化文字。

## 貼上純文字

您可以貼上 *未格式化的純文字* 匯入 **視覺編輯器** 或 **程式碼編輯器** ，方法是使用以下按鍵組合：

* Windows/Linux：Ctrl+Shift+V
* MacOS：Cmd+Shift+V

## 必要的 LaTeX 套件

若要支援將圖片及其他內容貼到 Overleaf，您需要將下列套件加入您的 [LaTeX 文件前言區](/latex/zh-tw/latex-ji-chu/01-learn-latex-in-30-minutes.md#the-preamble-of-a-document):

* [`hyperref`](https://ctan.org/pkg/hyperref?lang=en)：以支援 [超連結](/latex/zh-tw/wen-jian-jie-gou/09-hyperlinks.md) ，其包含於貼上的內容中。
* [`graphicx`](https://ctan.org/pkg/graphicx)：提供 [`\includegraphics` 指令](/latex/zh-tw/latex-ji-chu/01-learn-latex-in-30-minutes.md#adding-images) ，以便使用貼到您專案中的圖形所需。

## 將表格貼到您的 Overleaf 專案

**視覺編輯器** 無法完全保留貼到您專案中的每個表格的形式與樣式，但您仍可透過貼上在其他應用程式中建立的各種表格來節省時間與精力。

**視覺編輯器** 會嘗試保留並預覽下列表格元素：

* 水平合併的儲存格（跨越多個欄）
* 套用至儲存格的框線
* 表格儲存格內文字的格式
* 表格標題與標頭

**視覺編輯器** 也能讓您 [修改貼上的表格](/latex/zh-tw/zhi-shi-ku/067-how-to-generate-and-insert-latex-tables-in-overleaf.md#editable)，例如編輯儲存格內容或新增列與欄。您也可以切換至 **程式碼編輯器** 以進行變更，包括設定控制表格 [在排版文件中位置](https://learn.overleaf.com/learn/Inserting_Images#Positioning).

### 貼上表格的範例

以下影片示範從 Wikipedia 貼上表格——請注意超連結與文字樣式如何被保留。

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/2ENPw4QceCpzglQafnkFWU/f7be441c53822a37aa9d9d192fd43410/PastedTable.mp4>" %}

## 將圖片貼到您的 Overleaf 專案

您可以將單張圖片貼到 **視覺編輯器** 和 **程式碼編輯器** （但只有 **視覺編輯器** 會提供圖片預覽）。 [貼上多張圖片](#can-i-paste-multiple-images) 目前尚不支援。

![顯示「從電腦上傳」互動視窗的圖片](/files/0903f8c1baaf394eb1c0b9af1016d8ccec261f1c)

您可以：

* 為用來儲存貼上圖片的檔案命名。
* 選擇要儲存該檔案的專案資料夾。
* 決定是否使用圖說。
* 決定是否包含標籤（用於參照表格）。
* 設定圖片寬度（以 `\linewidth`).

您貼上的任何圖片都會在您的 Overleaf 專案中儲存為 .png 檔案。接著會使用自動產生的 LaTeX 程式碼將其納入您的文件。 **視覺編輯器** 會提供貼上圖片的預覽，但 **程式碼編輯器** 只會顯示 LaTeX 程式碼。

### 貼上圖片的範例

圖片可從許多來源複製，包括網頁，但這段影片示範從 [gimp](https://www.gimp.org/) 複製圖片並將其貼到 **視覺編輯器**。請注意使用 **程式碼編輯器** 來設定自訂圖片寬度為 `0.85\linewidth`.

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/3v01l6iGqXyAD4zaSosGbN/be53d9dad5fa4cb95b8177ec69c01cf3/PastingAnImage.mp4>" %}

影片示範中使用的圖片，是從一篇 [關於人口密度的 Wikipedia 文章](https://en.wikipedia.org/wiki/World_population#/media/File:Population_Density,_v4.11,_2020_\(48009093621\).jpg).

## 將樣式化文字貼到您的 Overleaf 專案

若要保留下列項目的格式，請使用 Ctrl+V（Windows/Linux）或 Cmd+V（MacOS）將它們貼到 Overleaf 的 **視覺編輯器** 中：

* 標題
* **粗體文字**
* *斜體文字*
* [超連結](http://www.google.com)
* 程式碼區塊（例如以 `HTML 標籤包住）`
* `符號，例如 &, %, …, $50.00`

` 貼上格式化文字的範例下一段影片示範貼上從 Google 文件複製的格式化文字。將清單貼到您的 Overleaf 專案項目符號清單和編號清單可貼到 Overleaf 的`` `` `**`視覺編輯器`**` `` ``中，使用 Ctrl+V（Windows/Linux）或 Cmd+V（MacOS）。貼上清單的範例下一段影片示範貼上從瀏覽器頁面及 LibreWriter 文件複製的多層項目符號與編號清單。請注意粗體與斜體文字也會被保留。描述清單Visual Editor 也支援建立和編輯描述清單。關於貼上格式化內容的常見問題我可以使用拖放嗎？ `**`視覺編輯器`**` ``支援使用拖放功能上傳 .png、.jpg 或 .pdf 格式的圖片，但不支援用於新增格式化內容；格式化內容必須透過貼上方式加入。我可以貼上多張圖片嗎？目前無法同時將多張圖片貼到`` `**`視覺編輯器`**` ``或`` `**`程式碼編輯器`**`。若您貼上的內容包含多張圖片，將只會貼上文字部分。圖片必須逐一貼上，如此的優點是您可以分別設定每一張圖片。`


---

# 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/zhi-shi-ku/075-how-to-paste-formatted-content-into-overleaf.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.
