> 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/077-how-to-search-in-an-overleaf-project.md).

# 如何在 Overleaf 專案中搜尋

本文說明在您的 Overleaf 專案中搜尋文字的兩種方式。

* [**在目前檔案中搜尋與取代**](#search-and-replace-within-the-current-file) 可讓您在目前於編輯器中開啟的可編輯檔案內尋找並取代文字。
* [**專案範圍搜尋**](#project-wide-search) 可讓您搜尋專案中的所有文字檔。

## 在目前檔案中搜尋與取代

此功能可讓您在編輯器中顯示的可編輯檔案內尋找並取代文字。此功能不適用於以下唯讀檔案，例如：

* 文字檔案 [從外部 URL 上傳](/latex/zh-tw/zhi-shi-ku/081-how-to-upload-a-file-using-an-external-url.md)，包括儲存在 Google 雲端硬碟中的檔案，以及 `.bib` 匯入的檔案（參考文獻庫） [Papers](/latex/zh-tw/zhi-shi-ku/071-how-to-link-papers-to-your-overleaf-account.md), [Mendeley](/latex/zh-tw/zhi-shi-ku/070-how-to-link-mendeley-to-your-overleaf-account.md)、或 [Zotero](/latex/zh-tw/zhi-shi-ku/073-how-to-link-zotero-to-your-overleaf-account.md)
* 大小超過 2MB 的文字檔案，因為編輯器會將它們視為唯讀

### 如何存取搜尋與取代

可使用以下任一方法來存取此功能：

1. 鍵盤快速鍵：

* Windows/Linux：Ctrl+f
* Mac OS：Cmd+f

3. 選擇 **切換搜尋** 位於編輯器上方的圖示：

![顯示檔案搜尋位置的圖片](/files/1c4b64216333c045d0343a5ad9a6382711102428)

這兩種方法都會顯示位於編輯器底部的搜尋面板。

![顯示檔案搜尋面板位置的圖片](/files/d3067f47aaef6e01c945fce83c55b00a689ad7e8)

搜尋面板提供以下控制項。

![顯示檔案搜尋面板上提供之控制項的圖片](/files/768664e0f76b0eda81843ecb0b600d1910c840ee)

### 如何使用搜尋或搜尋與取代

1. 您可以透過選取以下一或多個選項來設定搜尋，或是不選擇任何選項直接搜尋。

* ![Icon for case sensitive search](/files/556c5e0a3217d6ab207b8ddb81eb0b94facc5407)：使用區分大小寫的搜尋
* ![Icon for searching using regular expressions](/files/7aab23f4c36dc3bb75e48a69f36160ba6730da77)：使用正則表示式
* ![Icon for whole word search](/files/3218c6e772ca09ef9fbcbaef2f4bc10a4f4a5b9f)：只搜尋完整單字
* ![Icon for searching within selected text](/files/e7b331375eb794dc6d1ff381b2d6a7ec1d0c631b)：只在編輯器中反白顯示的文字內搜尋

3. 選取搜尋選項後，請在標示為以下內容的方塊中輸入搜尋詞： **搜尋**。Overleaf 會在您輸入時開始搜尋，並反白顯示第一個成功結果。
4. 使用「下一個」與「上一個」按鈕來尋找其他搜尋結果。

![顯示上一個與下一個搜尋結果控制項的圖片](/files/15ce48e4fe5f13158fe325826f2406aa66fed051)

6. 若要取代搜尋結果中的文字，請在以下欄位中輸入取代文字 **取代為** ，並使用以下其中一種方法：

* *手動取代*：選取 **取代** 以更新單一符合項目，並使 Overleaf 反白顯示下一個符合項目。繼續使用上一個／下一個按鈕瀏覽結果，並按一下 **取代** 以更新其他符合項目。
* *自動取代*：選取 **全部取代** 以一次取代所有符合項目。

8. **注意**：選取搜尋按鈕（![A button to access project-wide search](/files/8e003b79eb9898963fb5f271b183b890ac2ac58c)）可切換至專案範圍搜尋。

## 專案範圍搜尋

此功能可讓您在專案中的所有檔案內搜尋文字，只要檔案大小低於 2MB 即可。大小超過 2MB 的檔案會從搜尋結果中排除（請參閱 [影片](#video-demonstrating-project-wide-search) 作為其範例）。

### 如何存取專案範圍搜尋

可使用以下任一方法存取此功能：

1. 鍵盤快速鍵：

* Windows/Linux：Ctrl+Shift+f
* Mac OS：Cmd+Shift+f

3. 選擇 **搜尋** 位於檔案樹上方的圖示：

![顯示專案範圍搜尋圖示位置的圖片](/files/de04b6ccda658a62866beea66c02e6f419d4d72a)

5. 選取搜尋按鈕（![A button to access project-wide search](/files/8e003b79eb9898963fb5f271b183b890ac2ac58c)）位於 [搜尋面板](#how-to-access-search-and-replace).

這些方法都會顯示一個搜尋方塊，暫時隱藏檔案樹。

![顯示專案範圍搜尋方塊的圖片](/files/9c8f61ed5ae74c2e16ebfb459a25b15d1c55bce9)

### 如何使用專案範圍搜尋

1. 您可以透過選取以下一或多個選項來設定搜尋，或是不選擇任何選項直接搜尋。

![顯示用於設定專案範圍搜尋的控制項圖片](/files/d877283ab9f38b22fc5a9a5f404889f4b9bc1b19)

* ![Icon for case sensitive search](/files/556c5e0a3217d6ab207b8ddb81eb0b94facc5407)：使用區分大小寫的搜尋
* ![Icon for searching using regular expressions](/files/7aab23f4c36dc3bb75e48a69f36160ba6730da77)：使用正則表示式
* ![Icon for whole word search](/files/3218c6e772ca09ef9fbcbaef2f4bc10a4f4a5b9f)：只搜尋完整單字

4. 請在提供的方塊中輸入搜尋詞並選取搜尋圖示（![Image showing project-wide search icon](/files/360451f3fdbc5357aebdf370f49f75068cc3b146)），或按下 Enter。
5. 任何搜尋結果都會依檔案列出並分組。
6. 選取搜尋結果即可跳至對應的檔案位置。

### 示範專案範圍搜尋的影片

以下影片示範使用 Overleaf 專案進行專案範圍搜尋 [Typeset，TeX、e-TeX 或 pdfTeX 的原始碼文件](https://www.overleaf.com/latex/examples/typeset-the-source-code-documentation-for-tex-e-tex-or-pdftex/qkgfgyspnhcv)。選取該專案是因為它包含大型 `.tex` 檔案，包括 `pdftex.tex`，其大小超過 2MB 上限，因此會從搜尋結果中排除。

{% embed url="<https://videos.ctfassets.net/nrgyaltdicpt/21dsGfzi4yynX5beA2eBz3/4bd76333ece5ae522e09bb9745b8d6ca/NewSearch.mp4>" %}


---

# 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/077-how-to-search-in-an-overleaf-project.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.
