\frac{numerator}
الاستخدام الأساسي لـ \frac
الأمر \frac{numerator}{denominator} هو الطريقة القياسية لكتابة الكسور في LaTeX. وهو متاح في جميع أوضاع الرياضيات دون أي حزم إضافية. يتكيف الحجم تلقائيًا: أصغر ضمن السطر وبالحجم الكامل في الرياضيات المعروضة.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% Basic \frac{numerator}{denominator}
The slope is $\frac{\Delta y}{\Delta x}$.
% Display-style fraction with \[...\]
\[
\frac{d}{dx}\left[\frac{f(x)}{g(x)}\right]
= \frac{f'(x)\,g(x) - f(x)\,g'(x)}{[g(x)]^2}
\]
% \dfrac: always display size (good for inline headings)
The exact value is $\dfrac{\sqrt{3}}{2}$.
% \tfrac: always text size (good in display for side notes)
\[
\text{Mixing sizes: } \tfrac{1}{2} + \frac{1}{3} = \frac{5}{6}
\]
\end{document}\dfrac{vs \\tfrac}
\dfrac مقابل \tfrac
كلا الأمرين توفرهما amsmath ويتجاوزان الاختيار التلقائي للحجم في \frac. استخدمهما عندما يكون الحجم الافتراضي غير مناسب للسياق.
\frac
Auto-sizing
يختار نمط النص أو العرض بحسب سياق الرياضيات الحالي. الخيار الافتراضي المعقول في معظم الحالات.
الأنسب لـ: معظم المعادلات
\dfrac
حجم العرض
يُعرض دائمًا بحجم العرض الكامل. استخدمه داخل الرياضيات ضمن السطر أو في عناصر المصفوفات عندما تحتاج إلى كسر كبير وواضح.
الأنسب لـ: العناوين ضمن السطر وخلايا المصفوفات
\tfrac
حجم النص
يُعرض دائمًا بحجم النص المدمج. استخدمه داخل المعادلات المعروضة عندما يكون الكسر بالحجم الكامل بارزًا أكثر من اللازم.
الأنسب لـ: أدلة المجموع والملاحظات الجانبية
\cfrac{continued}
الكسور المتداخلة والكسور المتصلة
يمكنك تداخل \frac داخل نفسه، لكن كل مستوى يصغّر الخط. وللبنى شديدة التداخل، خصوصًا الكسور المتصلة، استخدم \cfrac من amsmath الذي يُبقي كل مستوى بحجم العرض.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
% Nested fractions
\[
\frac{1}{\dfrac{1}{a} + \dfrac{1}{b}} = \frac{ab}{a + b}
\]
% Continued fraction with \cfrac (no size reduction)
\[
\sqrt{2} = 1 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2 + \cdots}}}
\]
% Binomial coefficient
\[
\binom{n}{k} = \frac{n!}{k!\,(n-k)!}
\]
\end{document}\section{الأنماط الشائعة}
أنماط الكسور التي ستستخدمها يوميًا
أوامر جاهزة للنسخ لأشكال الكسور الأكثر ظهورًا في مستندات الرياضيات والفيزياء والهندسة.
\frac{1}{2}
النصف البسيط، وهو أشيع كسر
\frac{a+b}{c-d}
تعبيرات في البسط والمقام
\frac{df}{dx}
رمز المشتقة (ليبنتز)
\frac{\partial f}{\partial x}
المشتقة الجزئية
\frac{n!}{k!(n-k)!}
الصيغة الموسعة لمعامل ذي الحدين
\binom{n}{k}
الصيغة المدمجة لمعامل ذي الحدين
\cfrac{1}{1+\cfrac{1}{x}}
الكسر المتصل (دون تصغير)
\sfrac{1}{2}
الكسر المائل (يتطلب حزمة xfrac)
\section{الأخطاء الشائعة}
تجنّب هذه المزالق
غياب الأقواس حول الوسائط متعددة المحارف
\frac ab+c is not the same as \frac{a}{b+c}. Without braces, LaTeX treats only the first token as each argument — so \frac ab+c renders as (a/b)+c.
Using \frac in exponents without braces
e^{\frac{x}{2}} is correct; e^\frac{x}{2} is ambiguous and will compile incorrectly. Always wrap \frac in braces when it appears in a superscript or subscript.
Overusing \dfrac in running text
\dfrac forces a large fraction that increases line-height in inline math, causing uneven paragraph spacing. Prefer \frac in inline math, or rewrite the expression to avoid inline fractions in body paragraphs.
\section{FAQ}
الأسئلة الشائعة
What is the difference between \frac and \dfrac in LaTeX?
\frac automatically adjusts its size to context: in inline math it renders in text style (smaller), in display math it renders in display style (larger). \dfrac always forces display style regardless of context — use it when you need a full-size fraction inside inline math or inside a subscript.
When should I use \tfrac?
\tfrac forces text (inline) style even inside a display equation. It is useful when you want a compact fraction as part of a larger display expression — for example, inside a matrix entry or a summation index where a full-size fraction would look too large.
كيف أكتب كسرًا متصلًا في LaTeX؟
Use \cfrac from amsmath. Unlike \frac, \cfrac keeps the numerator and denominator at full size when nested — it does not progressively shrink. Write \cfrac{a}{b + \cfrac{c}{d + \cdots}} to build up the continued fraction level by level.
كيف أكتب كسرًا دون amsmath؟
Plain LaTeX provides \frac in math mode without needing any package. amsmath is only required for \dfrac, \tfrac, and \cfrac. For the vast majority of documents, including \usepackage{amsmath} is a good habit regardless.
كيف أجعل الكسور أكبر ضمن السطر؟
Use \dfrac instead of \frac. Alternatively, switch to display math with \[...\] or the equation environment. If you only need a single fraction to be larger without switching the full equation to display mode, \dfrac is the cleanest solution.
\section{أدلة ذات صلة}

