> 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/vi/bai-viet-chuyen-sau/46-testing-display-and-link-template.md).

# Mẫu kiểm tra hiển thị và liên kết

## Kiểm tra mẫu hiển thị và liên kết

LƯU Ý: ĐANG KIỂM TRA LIÊN TỤC NÊN KẾT QUẢ CÓ THỂ "DAO ĐỘNG"

## Mẫu MediaWiki để hiển thị một phần hoặc toàn bộ tài liệu LaTeX

Mẫu được đề xuất [Template:OpenLaTeXInOverleaf](https://github.com/ayaka-notes/overleaf-learn-wiki/tree/main/learn/Template:OpenLaTeXInOverleaf/README.md) cho phép bạn hiển thị mã LaTeX nội dòng *và*, sử dụng công trình của Alf, tự động tạo ra một `Mở trong Overleaf` liên kết từ mã LaTeX nội dòng—bạn chỉ cần viết mã *một lần*. Nó cũng cho phép bạn chỉ hiển thị `thân` phần thân của LaTeX của bạn, bỏ qua toàn bộ phần mở đầu và \end{document}, hoặc nó sẽ hiển thị toàn bộ tài liệu, nhưng trong cả hai trường hợp, một tài liệu hoàn chỉnh sẽ được mở trong Overleaf.

* Lưu ý: Vì lý do liên quan đến phân tích cú pháp MediaWiki, **bạn cần dùng `{{!}}` trong mã TeX của bạn để tạo ra ký tự |**.

### Các tham số để điều khiển hiển thị nội dòng mã LaTeX (và xây dựng tài liệu)

* **`pre`**, dùng để thiết lập `phần tiền đề` của tài liệu của bạn. Mặc định là

```
\documentclass{article}
\begin{document}
```

* **`thân`** đây là mã lõi của tài liệu LaTeX của bạn
* **`post`**, dùng để thiết lập phần cuối của tài liệu của bạn. Mặc định là

```
\end{document}
```

* **`show`** điều khiển cách hiển thị mã LaTeX của bạn: hoặc `thân` phần hoặc toàn bộ tài liệu
  * `show=ALL` hiển thị toàn bộ tài liệu LaTeX---sử dụng các giá trị của bạn cho `thân`, `pre` và `post`, hoặc dùng các *giá trị mặc định* cho `pre` hoặc `post`.
  * `show=BODY` chỉ hiển thị phần thân của mã LaTeX của bạn

Trong mọi trường hợp, một liên kết tự động "Open in Overleaf" được tạo bằng cách sử dụng các thiết lập cho **`pre`**, **`thân`** và **`post`**

### Các tham số để điều khiển lời gọi API của Overleaf (kế thừa từ công trình của Alf)

* **`engine`** thiết lập trình biên dịch dùng cho mã, có thể là một trong các:
  * `pdflatex` (mặc định nếu không chọn engine)
  * `xelatex`
  * `lualatex`
  * `latex_dvipdf`
* **`tên`** thiết lập tiêu đề của tài liệu Overleaf
* **`text`** thiết lập văn bản dùng để hiển thị liên kết

## Ví dụ

Phần sau liệt kê một số ví dụ sử dụng mẫu.

### Định nghĩa pre, post và đặt show=ALL

```
{{OpenLaTeXInOverleaf|show=ALL|pre=
\documentclass{book}
\begin{document}
|body=

Xin chào

thân mến

\LaTeX

|post=
\end{document}%Ở đây chúng ta kết thúc tài liệu
|engine=lualatex|name=Kiểm tra dùng LuaLaTeX|text=Mở một ví dụ LuaLaTeX trong Overleaf
}}
```

Mã trên tạo ra phần hiển thị nội dòng sau và liên kết "Mở trong Overleaf"

```latex
\documentclass{book}
\begin{document}
Xin chào

thân mến

\LaTeX
\end{document}%Ở đây chúng ta kết thúc tài liệu
```

&#x20;[Mở một ví dụ LuaLaTeX trong Overleaf](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Test+using+LuaLaTeX\&snip=%5Cdocumentclass%7Bbook%7D%0A%5Cbegin%7Bdocument%7D%0AHello+%0A%0Adear%0A%0A%5CLaTeX%0A%5Cend%7Bdocument%7D%25Here+we+end+the+document)

### Định nghĩa pre, post và show=BODY

```
{{OpenLaTeXInOverleaf|show=BODY|pre=
\documentclass{book}
\begin{document}
|body=

Xin chào

thân mến

\LaTeX

|post=
\end{document}%Ở đây chúng ta kết thúc tài liệu
|engine=lualatex|name=Kiểm tra dùng LuaLaTeX|text=Mở một ví dụ LuaLaTeX trong Overleaf
}}
```

Mã trên tạo ra phần hiển thị nội dòng sau và liên kết "Mở trong Overleaf"

```latex
Xin chào

thân mến

\LaTeX
```

&#x20;[Mở một ví dụ LuaLaTeX trong Overleaf](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Test+using+LuaLaTeX\&snip=%5Cdocumentclass%7Bbook%7D%0A%5Cbegin%7Bdocument%7D%0AHello+%0A%0Adear%0A%0A%5CLaTeX%0A%5Cend%7Bdocument%7D%25Here+we+end+the+document)

### Định nghĩa pre rỗng, post rỗng nhưng phần thân đầy đủ hơn

```
{{OpenLaTeXInOverleaf|show=ALL|pre=|post=|body=

\documentclass{book}

\begin{document}

Xin chào

thân mến

\LaTeX

\end{document}
|engine=lualatex|name=Kiểm tra dùng LuaLaTeX|text=Mở một ví dụ LuaLaTeX trong Overleaf
}}
```

Mã trên tạo ra phần hiển thị nội dòng sau và liên kết "Mở trong Overleaf"

```latex
\documentclass{book}

\begin{document}

Xin chào

thân mến

\LaTeX

\end{document}
```

&#x20;[Mở một ví dụ LuaLaTeX trong Overleaf](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Test+using+LuaLaTeX\&snip=%5Cdocumentclass%7Bbook%7D%0A%0A%0A%5Cbegin%7Bdocument%7D%0A%0A%0AHello+%0A%0Adear%0A%0A%5CLaTeX%0A%0A%0A%5Cend%7Bdocument%7D)

### Dùng giá trị mặc định cho pre và post nhưng cung cấp mã cho phần thân

```
{{OpenLaTeXInOverleaf|show=ALL|body=
Xin chào

thân mến

\LaTeX
|engine=lualatex|name=Kiểm tra dùng LuaLaTeX|text=Mở một ví dụ LuaLaTeX trong Overleaf
}}
```

Mã trên tạo ra phần hiển thị nội dòng sau và liên kết "Mở trong Overleaf"

```latex
\documentclass{article}
\begin{document}

Xin chào

thân mến

\LaTeX

\end{document}
```

&#x20;[Mở một ví dụ LuaLaTeX trong Overleaf](https://www.overleaf.com/docs?engine=lualatex\&snip_name=Test+using+LuaLaTeX\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%0AHello+%0A%0Adear%0A%0A%5CLaTeX%0A%0A%5Cend%7Bdocument%7D)

## KIỂM TRA, BỎ QUA CÁC LIÊN KẾT NÀY

```latex
\documentclass{article}
\begin{document}

\LaTeX

\end{document}
```

&#x20;[Mở trong Overleaf](https://www.overleaf.com/docs?engine=\&snip_name=\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cbegin%7Bdocument%7D%0A%0A%5CLaTeX%0A%0A%5Cend%7Bdocument%7D)


---

# 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/vi/bai-viet-chuyen-sau/46-testing-display-and-link-template.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.
