\section{Environments}
بيئات المصفوفات
توفر amsmath ست بيئات للمصفوفات، تنتج كل منها نمط أقواس مختلفًا. وتستخدم جميعها صياغة الصفوف والأعمدة نفسها، ولا يتغير سوى المحددات المحيطة.
Bare matrix with no surrounding brackets. Wrap manually in \left( ... \right) if needed.
مصفوفة محاطة بأقواس هلالية. الصيغة الأكثر شيوعًا في الجبر الخطي.
مصفوفة محاطة بأقواس مربعة. شائعة في الهندسة ونظرية التحكم.
مصفوفة محاطة بأقواس معقوفة. تُستخدم أحيانًا في ترميز بناء المجموعات.
مصفوفة محاطة بخطين عموديين مفردين. الترميز القياسي للمحددات.
مصفوفة محاطة بخطين عموديين مزدوجين. تُستخدم لنظائم المصفوفات.
\begin{pmatrix}
شرح الصياغة
تشبه صياغة المصفوفة بيئة tabular: تُفصل الأعمدة بالرمز & وتنتهي الصفوف بـ \\. وعلى خلاف الجداول، لا تحدد محاذاة الأعمدة، فأعمدة المصفوفة متمركزة دائمًا.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% No delimiters
\[
\begin{matrix}
1 & 0 \\ 0 & 1
\end{matrix}
\]
% Parentheses — pmatrix
\[
A = \begin{pmatrix}
a_{11} & a_{12} & a_{13} \\
a_{21} & a_{22} & a_{23} \\
a_{31} & a_{32} & a_{33}
\end{pmatrix}
\]
% Square brackets — bmatrix
\[
B = \begin{bmatrix} 2 & -1 \\ 3 & 4 \end{bmatrix}
\]
% Vertical bars (determinant) — vmatrix
\[
\det(A) = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc
\]
\end{document}&
فاصل الأعمدة
يفصل بين العناصر داخل الصف، تمامًا كما في tabular.
\\
فاصل الصفوف
ينهي الصف الحالي ويبدأ صفًا جديدًا.
a_{ij}
ترميز الأدلة السفلية
ترميز الفهرس القياسي للعنصر (i, j).
\begin{array}
المصفوفات الموسّعة باستخدام array
لا تدعم بيئات المصفوفات في amsmath خطًا فاصلًا عموديًا. للمصفوفات الموسّعة (مثل اختزال الصفوف)، استخدم بيئة array المضمَّنة داخل محددات \left[...\right] يدوية. وأضف | في مواصفات الأعمدة لرسم الفاصل العمودي.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% Augmented matrix — use array with a vertical rule
\[
\left[\begin{array}{ccc|c}
1 & 2 & 3 & 4 \\
0 & 1 & 2 & 3 \\
0 & 0 & 1 & 2
\end{array}\right]
\]
% 3x3 identity matrix
\[
I_3 = \begin{pmatrix}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
\]
\end{document}\section{جرّبه مباشرةً}
مثال لمصفوفة 3 × 3
افتح هذا المثال الكامل لمصفوفة 3×3، بما فيه pmatrix ومحدد vmatrix، مباشرةً في FormaTeX playground وجمّعه بنقرة واحدة.
\section{أخطاء شائعة}
تجنّب هذه المزالق
استخدام بيئات المصفوفات خارج وضع الرياضيات
All amsmath matrix environments must be inside \[...\] or another math environment. Placing \begin{pmatrix} directly in the document body will cause a compilation error.
أعداد أعمدة غير متسقة
يجب أن يحتوي كل صف على العدد نفسه من الفواصل &. تحتاج المصفوفة ذات 3 أعمدة إلى فاصلين & بالضبط في كل صف. تنتج الأعداد غير المتسقة مخرجات غير محاذاة أو أخطاء.
محاولة إضافة خط عمودي داخل pmatrix
pmatrix and its siblings do not accept a column spec, so you cannot insert a | divider. Use the array environment inside \left[...\right] for augmented matrices instead.
\section{FAQ}
الأسئلة الشائعة
ما الحزمة التي أحتاج إليها لبيئات المصفوفات في LaTeX؟
All matrix environments (matrix, pmatrix, bmatrix, vmatrix, etc.) are provided by the amsmath package. Add \usepackage{amsmath} to your preamble. The array environment for augmented matrices is built into LaTeX and does not need any extra package.
كيف أكتب محددًا في LaTeX؟
Use the vmatrix environment from amsmath: \begin{vmatrix} a & b \\ c & d \end{vmatrix}. This places the matrix between single vertical bars. For a 2×2 determinant the result is |A| = ad - bc.
كيف أنشئ مصفوفة موسّعة في LaTeX؟
Use the array environment with a column spec that includes a vertical bar. For example: \left[\begin{array}{cc|c} a & b & e \\ c & d & f \end{array}\right]. The | in the column spec {cc|c} draws the vertical line separating the coefficient and constant columns.
كم عدد الأعمدة التي يمكن أن تحتويها مصفوفة LaTeX؟
There is no hard limit on matrix columns in standard LaTeX. However, very wide matrices may overflow the text area. For matrices wider than the page, consider using \resizebox from the graphicx package, or splitting the matrix across multiple equations.
كيف أضيف نقاطًا (علامات حذف) داخل مصفوفة؟
Use \cdots for horizontal dots, \vdots for vertical dots, and \ddots for diagonal dots. For example: \begin{pmatrix} 1 & \cdots & n \\ \vdots & \ddots & \vdots \\ n & \cdots & n^2 \end{pmatrix}
\section{أدلة ذات صلة}

