> 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/ar/mzyd-mn-almwdhwaat/03-aligning-equations-with-amsmath-es.md).

# محاذاة المعادلات باستخدام amsmath es

الحزمة **amsmath** توفر عددًا جيدًا من الخيارات لطباعة المعادلات. يمكن اختيار طريقة عرض المعادلات التي تناسب المستند على أفضل نحو، حتى عندما تكون المعادلات كبيرة جدًا، أو إذا كان يجب تضمين عدة معادلات في سطر واحد.

## مقدمة

تفتقر أدوات LaTeX القياسية للتعامل مع المعادلات إلى المرونة، مما يؤدي أحيانًا إلى تراكب العناصر أو حتى اقتطاع عناصر المعادلة عندما تكون كبيرة جدًا. يمكن تجاوز جميع هذه الصعوبات باستخدام الحزمة **amsmath**. لنبدأ بمثال:

```latex
\begin{equation} \label{eq1}
\begin{split}
A & = \frac{\pi r^2}{2} \\
 & = \frac{1}{2} \pi r^2
\end{split}
\end{equation}
```

![Amsmath-eqn1.png](/files/7c3c4f428c795ad474930339d09815375054b5af)

يجب تضمين المعادلة داخل بيئة *equation* إذا كان مطلوبًا أن تظهر مرقمة، فيمكن استخدام *equation\** (مع نجمة) إذا لم يُرَد لها أن تُرقَّم. داخل بيئة *equation* تُستخدم بيئة *split* لتقسيم المعادلة إلى أجزاء أصغر، والتي سيتم محاذاتها تلقائيًا. ويعمل استخدام شرطة مائلة عكسية مزدوجة (double backslash) كفاصل سطر. وتُستخدم علامة et أو (المعروفة أيضًا باسمها الإنجليزي ampersand) *&* لتحديد النقاط التي ستُحاذى عندها المعادلات عموديًا.

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## استيراد حزمة amsmath

هذه الخطوة بسيطة جدًا، فإذا كنت من مستخدمي LaTeX المتكررين فربما تعرف هذا بالفعل. لاستيراد الحزمة '*amsmath*, أضف السطر البرمجي التالي في مقدمة مستندك.

`\usepackage{amsmath}`

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## كتابة معادلة واحدة

لعرض معادلة واحدة فقط، كما ورد في المقدمة، يجب استخدام إما بيئة *equation\** للمعادلات غير المرقمة، أو بيئة *equation* للمعادلات المرقمة. بالإضافة إلى ذلك، يمكن إضافة وسم باستخدام الأمر `\label`, وهو وسم يمكن الإشارة إليه لاحقًا داخل المستند.

```latex
\begin{equation} \label{eu_eqn}
e^{\pi i} - 1 = 0
\end{equation}

المعادلة الجميلة \ref{eu_eqn} تُعرف باسم معادلة أويلر
```

![Amsmath-eqn2.png](/files/9d46881bc67c6ed5c7a21c54b91c6383fd222a1d)

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## تضمين معادلات متعددة الأسطر

لإنشاء معادلة تمتد على أكثر من سطر، يجب استخدام بيئة *multline*. يجب إدراج شرطة مائلة عكسية مزدوجة لتحديد النقطة التي ستُفصل عندها المعادلة. سيكون الجزء الأول بمحاذاة اليسار بينما سيظهر الجزء الآخر في السطر التالي وبمحاذاة اليمين.

وبنفس الطريقة كما في الأوامر الأخرى، يمكن إضافة نجمة إلى اسم البيئة لتحديد ما إذا كانت المعادلة ستُرقَّم أم لا.

```latex
\begin{multline*}
p(x) = 3x^6 + 14x^5y + 590x^4y^2 + 19x^3y^3\\
- 12x^2y^4 - 12xy^5 + 2y^6 - a^3b^3
\end{multline*}
```

![Amsmath-eqn3.png](/files/051127dc52c69e50468c3895a6745d9243ba9bf3)

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## تقسيم المعادلات ومحاذاتها

*split* هو بيئة شبيهة جدًا بـ *multline*. البيئة *split* تُستخدم لتقسيم معادلة إلى عدة أجزاء ثم محاذاتها في أعمدة، كما لو كانت أجزاء المعادلة داخل جدول. يجب استخدام هذه البيئة داخل بيئة *equation*. للاطلاع على مثال، راجع القسم التمهيدي في بداية هذا المقال.

## محاذاة عدة معادلات

إذا كانت هناك عدة معادلات يجب محاذاتها عموديًا، فإن بيئة *align* تتكفل بذلك:

```latex
\begin{align*}
2x - 5y &=  8 \\
3x + 9y &=  -12
\end{align*}
```

![Amsmath-eqn4.png](/files/668a3f901946fff2cbf2ef3094b5d0e8c8630177)

عادةً ما تُستخدم العوامل الثنائية (>, < و =) كنقاط للمحاذاة العمودية، وبذلك نحصل على مستند جميل من الناحية البصرية.

كما ذُكر سابقًا، فإن علامة et *&* تحدد نقاط محاذاة المعادلات. لنرَ مثالًا أكثر تعقيدًا بعض الشيء:

```latex
\begin{align*}
x&=y           &  w &=z              &  a&=b+c\\
2x&=-y         &  3w&=\frac{1}{2}z   &  a&=b\\
-4 + 5x&=2+y   &  w+2&=-1+w          &  ab&=cb
\end{align*}
```

![Amsmath-eqn6.png](/files/803531df913b1e9bc2c131064803b7aab3f2e7cc)

هنا تُرتَّب المعادلات في ثلاثة أعمدة. يفترض LaTeX أن كل معادلة تتكون من جزأين يفصل بينهما الحرف *&*؛ وأن كل معادلة تُفصل عن السابقة بواسطة *&*.

مرة أخرى، يمكن استخدام النجمة \* لتفعيل أو تعطيل ترقيم المعادلات. عندما يكون الترقيم نشطًا، يمكن وسم كل سطر بشكل مستقل.

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## تجميع المعادلات وتوسيطها

إذا كنت تحتاج فقط إلى عرض سلسلة من المعادلات المتتالية، في وسط الصفحة وبدون أي محاذاة، فاستخدم بيئة *gather*. وتعمل أيضًا حيلة النجمة لتفعيل/تعطيل ترقيم المعادلات هنا.

```latex
\begin{gather*}
2x - 5y =  8 \\
3x^2 + 9y =  3a + c
\end{gather*}
```

![Amsmath-eqn5.png](/files/95116a806a9c11426f1a7389c68038ad744a84e3)

[فتح مثال لحزمة amsmath في Overleaf](https://www.sharelatex.com/project/new/template?zipUrl=/project/52e1889fd3e596077700148c/download/zip\&templateName=Amsmath_Example_Project\&compiler=pdflatex)

## قراءات إضافية

للمزيد من المعلومات، راجع:

* [التعابير الرياضية](/latex/ar/alryadhyat/01-mathematical-expressions.md)
* [الأقواس والقوسان](/latex/ar/alryadhyat/03-brackets-and-parentheses.md)
* [الأسس السفلية والعليا](/latex/ar/alryadhyat/02-subscripts-and-superscripts.md)
* [التباعد في وضع الرياضيات](/latex/ar/alryadhyat/08-spacing-in-math-mode.md)
* [النمط المعروض في وضع الرياضيات](/latex/ar/alryadhyat/10-display-style-in-math-mode.md)
* [الخطوط الرياضية](/latex/ar/alryadhyat/12-mathematical-fonts.md)
* [قائمة الحروف اليونانية والرموز الرياضية](/latex/ar/alryadhyat/11-list-of-greek-letters-and-math-symbols.md)
* [المؤثرات](/latex/ar/alryadhyat/07-operators.md)
* [الكسور والحدود الثنائية](/latex/ar/alryadhyat/05-fractions-and-binomials.md)
* [توثيق حزمة amsmath](http://mirrors.ctan.org/macros/latex/required/amsmath/amsmath.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/ar/mzyd-mn-almwdhwaat/03-aligning-equations-with-amsmath-es.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.
