> 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/wen-yu-da/75-inserting-emojis-in-latex-documents-on-overleaf.md).

# 在 Overleaf 的 LaTeX 文件中插入表情符號

*注意： `[twemojis](https://www.ctan.org/pkg/twemojis)` 套件未包含於* [*TeX Live*](/latex/zh-tw/lei-bie-dang/02-overleaf-and-tex-live.md)*，因此無法在 Overleaf 上使用。*

## 表情符號字元與 Overleaf 編輯器

Overleaf 無法儲存包含 [NUL 字元](https://en.wikipedia.org/wiki/Null_character) 或編輯包含超出 Unicode 的字元的檔案 [基本多文種平面（BMP）](https://en.wikipedia.org/wiki/Plane_\(Unicode\)).

Unicode 將許多表情符號字元指派到基本多文種平面以外的碼位：它們編碼於 [第 1 平面](https://en.wikibooks.org/wiki/Unicode/Character_reference/1F000-1FFFF)，這表示它們的碼位範圍是 U+10000–U+1FFFF，特別是 U+1F000–U+1FFFF。這對任何想將表情符號字元複製並貼到 Overleaf 編輯器的人都有重要影響。目前，Overleaf 的文字編輯器只能處理基本多文種平面內的字元，雖然我們希望未來的升級能加入對非 BMP 字元的支援。

如果您將 😀 之類的表情符號，或任何其他非 BMP 字元，貼到 Overleaf 編輯器中，它會被轉換成字元 ��。不過，您可以上傳包含非 BMP UTF-8 序列的文字檔：它們在 Overleaf 編輯器內無法編輯，但您可以使用適當的 LaTeX 檔案包含命令將這些檔案插入文件中。

如下方範例所示，您可以使用 LaTeX 套件提供的適當字型與命令來插入表情符號。

## 單色表情符號

您可以使用 `\symbol` 或 `\char` 命令搭配 `fontspec`, [XƎLaTeX 或 LuaLaTeX](/latex/zh-tw/zhi-shi-ku/026-changing-compiler.md) 以及合適的字型。例如，不使用 [`emoji` 套件](https://ctan.org/pkg/emoji?lang=en)套件，您仍然可以使用 Symbola 字型插入單色表情符號：

```latex
落葉：{\fontspec{Symbola}\symbol{"1F343}}

或

落葉：{\fontspec{Symbola}\char"1F343}
```

[在 Overleaf 中開啟此單色表情符號範例](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Monochrome+emoji\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bfontspec%7D%0A%5Cusepackage%7Bparskip%7D%0A%0A%5Cbegin%7Bdocument%7D%0AFalling+leaves%3A+%7B%5Cfontspec%7BSymbola%7D%5Csymbol%7B%221F343%7D%7D%0A%0Aor%0A%0AFalling+leaves%3A+%7B%5Cfontspec%7BSymbola%7D%5Cchar%221F343%7D%0A%5Cend%7Bdocument%7D)

這將產生以下輸出 ![Symbola-falling-leaves.png](/files/74cb8d20c85336bd6297f4e73d88f50131410084)

您可以在以下網址查詢表情符號的碼位 [此網頁](https://unicode.org/emoji/charts/emoji-list.html).

## 彩色表情符號

如果您想使用彩色表情符號，請看看 `[emoji](https://www.ctan.org/pkg/emoji)` 套件，它使用 LuaLaTeX + HarfBuzz 文本排版引擎來正確存取彩色表情符號字型。您需要 [將您的專案編譯器改為 LuaLaTeX](/latex/zh-tw/zhi-shi-ku/026-changing-compiler.md)。接著您可以載入 `emoji` 套件，並撰寫 `\emoji{leaves}`.

```latex
\documentclass[12pt]{article}
\usepackage{emoji}

\begin{document}

這些是使用 \texttt{emoji} 套件和 LuaLaTeX 的彩色表情符號：
\emoji{leaves}
\emoji{rose}

您可以使用 emoji 修飾符：
\emoji{woman-health-worker-medium-skin-tone}
\emoji{family-man-woman-girl-boy}
\emoji{flag-malaysia}
\emoji{flag-united-kingdom}

\end{document}
```

[在 Overleaf 中查看此即時範例](https://www.overleaf.com/docs?engine=lualatex\&snip_name=colour+emojis+using+LuaLaTeX\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bemoji%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%0AThese+are+colour+emojis+using+the+%5Ctexttt%7Bemoji%7D+package+and+LuaLaTeX%3A%0A%5Cemoji%7Bleaves%7D%0A%5Cemoji%7Brose%7D%0A%0AYou+can+use+emoji-modifiers%3A%0A%5Cemoji%7Bwoman-health-worker-medium-skin-tone%7D%0A%5Cemoji%7Bfamily-man-woman-girl-boy%7D%0A%5Cemoji%7Bflag-malaysia%7D%0A%5Cemoji%7Bflag-united-kingdom%7D%0A%0A%5Cend%7Bdocument%7D)

![NotoEmoji-demo.png](/files/c85ce5b644faf93b86638057e00f25cad4f1e0b9)

您可以查詢 Unicode CLDR（Common Locale Data Repository）名稱 [這裡](https://unicode.org/emoji/charts/emoji-list.html)，但請記得將名稱中的空格替換為連字號。或者，您可以在 [加上 `emoji` 套件文件所述](http://texdoc.net/pkg/emoji) 其本身中查找。

## 選擇不同的表情符號字型

在 Overleaf 中，預設的表情符號字型是 Noto Color Emoji。您可以選擇其他表情符號字型：

```latex
\setemojifont{TwemojiMozilla}
```

![TwemojiMozilla-demo.png](/files/3a3d7d2a97be9fd4978ce5dce11a05c14c65f20d)

```latex
\documentclass[12pt]{article}
\usepackage{emoji}

\begin{document}
\setemojifont{TwemojiMozilla}
這些是使用 \texttt{emoji} 套件和 LuaLaTeX 的彩色表情符號：
\emoji{leaves}
\emoji{rose}

您可以使用 emoji 修飾符：
\emoji{woman-health-worker-medium-skin-tone}
\emoji{family-man-woman-girl-boy}
\emoji{flag-malaysia}
\emoji{flag-united-kingdom}

\end{document}
```

[在 Overleaf 中開啟此 TwemojiMozilla 範例](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Colour+emojis+using+the+TwemojiMozilla+font+and+LuaLaTeX\&snip=%5Cdocumentclass%5B12pt%5D%7Barticle%7D%0A%5Cusepackage%7Bemoji%7D%0A%0A%5Cbegin%7Bdocument%7D%0A%5Csetemojifont%7BTwemojiMozilla%7D%0AThese+are+colour+emojis+using+the+%5Ctexttt%7Bemoji%7D+package+and+LuaLaTeX%3A%0A%5Cemoji%7Bleaves%7D%0A%5Cemoji%7Brose%7D%0A%0AYou+can+use+emoji-modifiers%3A%0A%5Cemoji%7Bwoman-health-worker-medium-skin-tone%7D%0A%5Cemoji%7Bfamily-man-woman-girl-boy%7D%0A%5Cemoji%7Bflag-malaysia%7D%0A%5Cemoji%7Bflag-united-kingdom%7D%0A%0A%5Cend%7Bdocument%7D)

## 延伸閱讀

* [該 `emoji` 套件](https://www.ctan.org/pkg/emoji)
* [表情符號 CLDR 名稱與碼位清單](https://unicode.org/emoji/charts/emoji-list.html)
* [變更您的 Overleaf 專案編譯器](/latex/zh-tw/zhi-shi-ku/026-changing-compiler.md)


---

# 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/wen-yu-da/75-inserting-emojis-in-latex-documents-on-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.
