\usepackage{lmodern}
حزم الخطوط في pdfLaTeX
في pdfLaTeX تُختار الخطوط بتحميل حزمة خط. أدرج دائمًا \usepackage[T1]{fontenc} أولًا للحصول على ترميز مخرجات صحيح. يعرض المثال أدناه الإعداد الموصى به مع بدائل معلّق عليها.
Latin Modern
خط LaTeX الافتراضي، وهو Computer Modern موسّع بدعم كامل لترميز T1. نقطة بداية موصى بها.
TeX Gyre Pagella
نسخة مصقولة من Palatino. أعرض قليلًا بزوائد أنيقة، وشائع في التنضيد الأكاديمي وتنضيد الكتب.
TeX Gyre Heros
نسخة من Helvetica. ينسجم جيدًا مع Pagella أو Latin Modern للعناوين والتعليقات التوضيحية.
Inconsolata
خط أحادي المسافة ملائم للمبرمجين بقراءة أفضل من Courier الافتراضي.
\documentclass{article}
% Encoding — required for proper output with pdfLaTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
% --- Serif fonts (pick one) ---
% \usepackage{lmodern} % Latin Modern (default, recommended)
% \usepackage{palatino} % Palatino — elegant, slightly wider
% \usepackage{tgpagella} % TeX Gyre Pagella — polished Palatino clone
% \usepackage{times} % Times New Roman look-alike
% --- Sans-serif fonts (pick one) ---
% \usepackage{helvet} \renewcommand{\familydefault}{\sfdefault}
% \usepackage{tgheros} \renewcommand{\familydefault}{\sfdefault}
% --- Monospaced fonts (pick one) ---
% \usepackage{courier} % Courier monospaced
% \usepackage{inconsolata} % Inconsolata — more readable
\usepackage{lmodern}
\begin{document}
This paragraph is set in Latin Modern, the default LaTeX font.
{\sffamily This text uses the sans-serif font family.}
{\ttfamily This text uses the monospaced (typewriter) font.}
\end{document}\setmainfont{TeX Gyre Pagella}
fontspec لـ XeLaTeX وLuaLaTeX
يمنحك fontspec وصولًا مباشرًا إلى أي خط OpenType أو TrueType مثبّت على النظام. استخدم \setmainfont و\setsansfont و\setmonofont لتعريف عائلات الخطوط الثلاث على مستوى المستند كله.
BoldFont
BoldFont = {Source Sans Bold}
Override which font file is used for \textbf{}.
ItalicFont
ItalicFont = {Source Sans Italic}
Override the italic variant for \textit{}.
Scale
Scale = 0.9
غيّر مقياس الخط نسبةً إلى حجم الخط الرئيسي، وهو مفيد للخطوط أحادية المسافة.
Numbers
Numbers = OldStyle
فعّل أرقام OpenType القديمة (الصغيرة) لنص أساسي أسهل قراءة.
Ligatures
Ligatures = TeX
فعّل الربطات بأسلوب TeX مثل -- للشرطة المتوسطة و--- للشرطة الطويلة.
Kerning
Kerning = On
فعّل تعديلات التقارب البصري بين أزواج الأحرف.
\documentclass{article}
% fontspec requires XeLaTeX or LuaLaTeX
\usepackage{fontspec}
% Set the main (serif) font — use any font installed on the system
\setmainfont{TeX Gyre Pagella}
% Set the sans-serif font
\setsansfont{TeX Gyre Heros}
% Set the monospaced font
\setmonofont[Scale=0.9]{Inconsolata}
% Load a font with specific features
\newfontfamily\titlefont{TeX Gyre Termes}[
BoldFont = {TeX Gyre Termes Bold},
ItalicFont = {TeX Gyre Termes Italic},
]
\begin{document}
Regular text is set in TeX Gyre Pagella.
{\sffamily Sans-serif text uses TeX Gyre Heros.}
{\titlefont This paragraph uses the custom \textbackslash titlefont family.}
\texttt{Monospaced code uses Inconsolata at 90\% scale.}
\end{document}\section{أحجام الخطوط}
أوامر حجم الخط وتباعد الأسطر
يوفر LaTeX عشرة أوامر لأحجام نسبية. يعتمد الحجم الفعلي بالنقاط على الحجم الأساسي لفئة المستند (10 أو 11 أو 12 نقطة). وتتولى الحزمة setspace تباعد الأسطر بشكل نظيف دون التأثير في حجم الخط.
\tiny
5 pt
\scriptsize
7 pt
\footnotesize
8 pt
\small
9 pt
\normalsize
10 pt
\large
12 pt
\Large
14 pt
\LARGE
17 pt
\huge
20 pt
\Huge
25 pt
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{setspace} % line spacing
\begin{document}
% ---- Font size commands ----
{\tiny tiny (5pt)} \\
{\scriptsize scriptsize (7pt)} \\
{\footnotesize footnotesize (8pt)} \\
{\small small (9pt)} \\
{\normalsize normalsize (10pt)} \\
{\large large (12pt)} \\
{\Large Large (14pt)} \\
{\LARGE LARGE (17pt)} \\
{\huge huge (20pt)} \\
{\Huge Huge (25pt)} \\
\vspace{1em}
% ---- Line spacing ----
\begin{singlespace}
Single-spaced paragraph using the setspace package.
\end{singlespace}
\begin{doublespace}
Double-spaced paragraph — common for draft submission.
\end{doublespace}
% Compact half-line increase
\setstretch{1.25}
Paragraph at 1.25$\times$ line spacing.
\end{document}\section{خطوط Google}
استخدام خطوط Google في LaTeX
تُوزَّع خطوط Google كملفات TrueType أو OpenType. ومع XeLaTeX أو LuaLaTeX مع fontspec يمكنك استخدامها بالاسم بعد تثبيتها. إليك سير العمل الموصى به:
نزّل الخط
زر fonts.google.com، واختر الخط، ونزّل ملفات .ttf أو .otf.
ثبّته على النظام
على Linux: انسخه إلى ~/.fonts/ أو /usr/share/fonts/ ثم شغّل fc-cache -fv. على macOS: افتحه في Font Book. على Windows: انقر بزر الفأرة الأيمن على الملف واختر Install.
استخدمه مع fontspec
\setmainfont{Inter}[Ligatures=TeX] — use the exact font family name. Confirm availability with fc-list | grep "Inter" on Linux/macOS.
متطلب المحرك
تتطلب خطوط Google المحرك XeLaTeX أو LuaLaTeX مع fontspec. أما pdfLaTeX فيدعم فقط الخطوط المضمّنة في توزيعة TeX. ويدعم FormaTeX المحركات الثلاثة، قارن بين المحركات .
\section{أخطاء شائعة}
تجنب هذه الأخطاء في الخطوط
يتطلب fontspec المحرك XeLaTeX أو LuaLaTeX
لا يمكن استخدام fontspec مع pdfLaTeX. إذا كنت تريد خطوط النظام أو ميزات OpenType فبدّل المحرك. ويدعم FormaTeX المحركات الثلاثة، راجع دليل مقارنة المحركات.
غياب ترميز T1 مع pdfLaTeX
Without \usepackage[T1]{fontenc} the output uses OT1 encoding, which lacks proper hyphenation for accented characters and makes copy-paste from the PDF unreliable.
تحجيم خطوط الرياضيات بشكل منفصل
تغيير الخط الأساسي لا يغيّر تلقائيًا مقياس خط الرياضيات. استخدم حزمًا مثل newtxmath أو newpxmath أو mathasaccents التي تطابق خط النص الذي اخترته.
تحميل حزم الخطوط بترتيب خاطئ
حمّل fontenc وinputenc قبل أي حزمة خط. ومع fontspec حمّله أولًا ثم أي حزم إضافية لميزات OpenType.
\section{FAQ}
الأسئلة الشائعة
\section{أدلة ذات صلة}
واصل تعلّم LaTeX
استكشف مزيدًا من الأدلة وجرّب كل مثال مباشرة في الـ playground الخاص بـ FormaTeX.

