> 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/toan-hoc/10-display-style-in-math-mode.md).

# Kiểu hiển thị trong chế độ toán học

## Giới thiệu

Bài viết này giải thích cách điều chỉnh thủ công kiểu trình bày của toán học được dàn trang—nhưng trước hết chúng ta sẽ bắt đầu bằng một nhắc nhanh về những khác biệt có thể thấy giữa kiểu toán trong dòng và kiểu hiển thị.

Toán học được dàn trang nằm trong dòng (bên trong) văn bản của một đoạn cần chiếm ít chỗ hơn so với cùng phép toán đó khi được dàn trang bên ngoài văn bản đoạn dưới dạng độc lập, theo kiểu hiển thị. Để thấy điều này trong thực tế, hãy giải thích rằng phương trình $$f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x}$$ có thể phân kỳ hoặc hội tụ tùy thuộc vào giá trị của $$x$$. Chúng ta cũng có thể dàn trang $$f(x)$$ bên ngoài đoạn ở kiểu hiển thị:

$$f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x}$$

Chỉ cần nhìn lướt qua ví dụ trước cũng cho thấy những thay đổi về kích thước và định dạng của các ký hiệu toán học, chẳng hạn như $$\sum$$ và vị trí của các cận của nó, cùng với sự thay đổi về kích thước/vị trí của số mũ, chỉ số dưới và phân số.

Những vấn đề về kiểu chữ toán học này là sự tương tác giữa các thuật toán dàn trang được tích hợp trong các bộ máy TeX cùng với một số tham số giãn cách nhất định có trong các phông toán học. Những tham số phông đó giúp tinh chỉnh việc dàn trang toán học theo các đặc điểm thiết kế của phông toán học đang được sử dụng.

## Ghi đè các kiểu toán học mặc định

Đôi khi bạn có thể muốn thay đổi kiểu mặc định được dùng để dàn trang một đoạn toán học. Ví dụ, bạn có thể muốn thay đổi toán trong dòng, chẳng hạn như $$f(x) = \frac{1}{1+x}$$, và đưa nó vào đoạn văn nhưng được dàn trang theo kiểu hiển thị: $$\displaystyle f(x) = \frac{1}{1+x}$$, mặc dù nó ảnh hưởng mạnh đến khoảng cách dòng.

Các bộ máy TeX cung cấp một số lệnh có thể dùng để ghi đè kiểu mặc định mà một đoạn toán học được dàn trang:

* `\textstyle`: áp dụng kiểu dùng cho toán học được dàn trang trong đoạn văn
* `\displaystyle`: áp dụng kiểu dùng cho toán học được dàn trang trên các dòng riêng
* `\scriptstyle`: áp dụng kiểu dùng cho chỉ số dưới hoặc chỉ số trên
* `\scriptscriptstyle`: áp dụng kiểu dùng cho chỉ số dưới hoặc chỉ số trên bậc hai

Ví dụ kinh điển được lấy từ trang 142 của TeXBook, mặc dù chúng tôi đã thay thế `$$` bằng dạng được LaTeX ưa dùng `\[` và `\]`:

```latex
\[
a_0+{1\over a_1+
      {1\over a_2+
        {1 \over a_3 +
           {1 \over a_4}}}}
\]
```

Theo mặc định, nó được dàn trang như sau:

$$a\_0+{1\over a\_1+{1\over a\_2 +{1 \over a\_3 + {1 \over a\_4}}}}$$

Kiểu dàn trang mặc định có thể được sửa bằng cách dùng `\displaystyle` lệnh:

```latex
\[
a_0+{1\over\displaystyle a_1+
      {1\over\displaystyle a_2+
        {1 \over\displaystyle a_3 +
           {1 \over\displaystyle a_4}}}}
\]
```

cho ra

$$a\_0+{1\over\displaystyle a\_1+{1\over\displaystyle a\_2+{1 \over\displaystyle a\_3 +{1 \over\displaystyle a\_4}}}}$$

Đây là một ví dụ khác cho thấy tác dụng của `\textstyle`, `\scriptstyle` và `\scriptscriptstyle`:

```latex
\[
\begin{align*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \textstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \scriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \scriptscriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{align*}
\]
```

được biểu diễn thành $$\begin{align\*} f(x) = \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \textstyle f(x) = \textstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \scriptstyle f(x) = \scriptstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \ \scriptscriptstyle f(x) = \scriptscriptstyle \sum\_{i=0}^{n} \frac{a\_i}{1+x} \end{align\*}$$

Đây là một ví dụ bạn có thể mở trong Overleaf:

```latex
\documentclass{article}
\usepackage{amsmath}
\title{Khám phá các kiểu hiển thị toán học}
\author{Nhóm Overleaf}
\begin{document}
\maketitle
Tùy theo giá trị của \(x\), phương trình \( f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \) có thể phân kỳ hoặc hội tụ.

\[ f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \]

\vspace{1cm}

Các phần tử toán trong dòng có thể được đặt với một kiểu khác: \(f(x) = \displaystyle \frac{1}{1+x}\). Điều tương tự cũng đúng với nội dung toán ở kiểu hiển thị:

\begin{align*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{align*}
\end{document}
```

[Mở ví dụ này trong Overleaf](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Exploring+math+display+styles\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bamsmath%7D%0A%5Ctitle%7BExploring+math+display+styles%7D%0A%5Cauthor%7BOverleaf+team%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cmaketitle%0ADepending+on+the+value+of+%5C%28x%5C%29+the+equation+%5C%28+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%29+may+diverge+or+converge.%0A%0A%5C%5B+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5D%0A%0A%5Cvspace%7B1cm%7D%0A%0AInline+maths+elements+can+be+set+with+a+different+style%3A+%5C%28f%28x%29+%3D+%5Cdisplaystyle+%5Cfrac%7B1%7D%7B1%2Bx%7D%5C%29.+The+same+is+true+for+display+math+material%3A%0A%0A%5Cbegin%7Balign%2A%7D%0Af%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Ctextstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Cscriptstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D+%5C%5C%0A%5Cscriptscriptstyle+f%28x%29+%3D+%5Csum_%7Bi%3D0%7D%5E%7Bn%7D+%5Cfrac%7Ba_i%7D%7B1%2Bx%7D%0A%5Cend%7Balign%2A%7D%0A%5Cend%7Bdocument%7D)

## Đọc thêm

Để biết thêm thông tin, xem

* [Biểu thức toán học](/latex/vi/toan-hoc/01-mathematical-expressions.md)
* [Chỉ số dưới và chỉ số trên](/latex/vi/toan-hoc/02-subscripts-and-superscripts.md)
* [Căn chỉnh các phương trình bằng amsmath](/latex/vi/toan-hoc/06-aligning-equations-with-amsmath.md)
* [Khoảng cách trong chế độ toán học](/latex/vi/toan-hoc/08-spacing-in-math-mode.md)
* [Tích phân, tổng và giới hạn](/latex/vi/toan-hoc/09-integrals-sums-and-limits.md)
* [Phông chữ toán học](/latex/vi/toan-hoc/12-mathematical-fonts.md)
* [Phần giới thiệu về LaTeX2ε không quá ngắn](http://www.ctan.org/tex-archive/info/lshort/)


---

# 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/toan-hoc/10-display-style-in-math-mode.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.
