\usepackage{hyperref}
إعداد hyperref
أضف \usepackage{hyperref} إلى المقدمة (preamble)، ويفضل أن تكون آخر حزمة. يتيح تمرير الخيارات مباشرةً ضبط ألوان الروابط وبيانات PDF الوصفية وسلوك الإشارات المرجعية دفعة واحدة.
\documentclass{article}
\usepackage[
colorlinks = true,
linkcolor = blue,
urlcolor = cyan,
citecolor = green,
pdftitle = {My Document},
pdfauthor = {Author Name},
pdfsubject = {LaTeX tutorial},
bookmarks = true,
bookmarksnumbered = true,
]{hyperref}
\begin{document}
\tableofcontents
\section{Introduction}
\label{sec:intro}
This section is clickable in both the PDF bookmark panel
and the table of contents.
\section{Links}
\label{sec:links}
See \href{https://formatex.io}{FormaTeX} for live compilation.
Internal link back to Section~\ref{sec:intro}.
\end{document}\section{أوامر الروابط}
\href, \url, and \hyperref
توفر hyperref أربعة أوامر رئيسية لإنشاء الروابط. لكل أمر غرض مميز، فاختر الأنسب للحصول على شيفرة مصدرية أنظف وأكثر دلالة.
\href{url}{text}
عنوان URL خارجي أو داخلي مع نص رابط ظاهر مخصص. النص هو ما يراه القراء، والعنوان هو الوجهة.
\url{url}
يعرض عنوان URL كما هو بخط ثابت العرض ويجعله قابلًا للنقر. الأنسب للعناوين الخام في الحواشي السفلية أو المراجع.
\hyperref[label]{text}
Internal cross-reference using a \label. Jumps to the labelled element with custom link text — no URL required.
\autoref{label}
Like \ref but automatically prepends the type name (Section, Figure, Table …) based on the environment.
\section{أمثلة على الاستخدام}
الأوامر الأربعة قيد العمل
يعرض المثال أدناه \href و\url و\hyperref ورابط mailto جنبًا إلى جنب مع مقدمة (preamble) بسيطة.
\documentclass{article}
\usepackage{hyperref}
\begin{document}
% \href{url}{text} — URL with custom anchor text
Visit \href{https://formatex.io}{FormaTeX} for online compilation.
% \url{url} — raw URL, displayed and linked as-is
Package docs: \url{https://ctan.org/pkg/hyperref}.
% \hyperref[label]{text} — internal cross-reference with custom text
\hyperref[sec:results]{Jump to the Results section}.
% Email address link
Questions? \href{mailto:[email protected]}{Send us an email}.
% Footnote URL (keeps text clean)
Documented elsewhere.\footnote{\url{https://example.com/docs}}
\section{Results}
\label{sec:results}
Data analysis and findings.
\end{document}\section{الروابط الملونة}
ضبط ألوان الروابط
مع colorlinks=true يحصل كل نوع من الروابط على مفتاح لون خاص به. يمكنك تمرير أي لون مسمى من حزمة xcolor ، بما فيها تعريفات RGB مخصصة.
Internal links — \ref, \autoref, TOC entries
External URLs — \href and \url
Citation links — \cite
File links — \href{run:file.pdf}{...}
روابط قائمة Acrobat (نادرة)
نص الرابط (نادرًا ما يُخصَّص)
مخرجات جاهزة للطباعة
للمستندات المخصصة للطباعة، مرّر hidelinks لإخفاء جميع الألوان والحدود مع إبقاء الروابط فعالة في ملفات PDF الرقمية.
\section{إشارات PDF المرجعية}
إشارات PDF المرجعية وروابط جدول المحتويات
تحوّل hyperref تلقائيًا كل \section و\subsection و\caption إلى إشارة PDF مرجعية قابلة للنقر. وتصبح عناصر جدول المحتويات روابط تشعبية داخلية دون أي تكلفة إضافية.
bookmarks=true
ينشئ لوحة إشارات PDF المرجعية (المخطط). مفعّل افتراضيًا في معظم إعدادات hyperref.
bookmarksnumbered=true
يضيف رقم القسم بادئةً لكل إشارة مرجعية، ما يُبقي اللوحة متسقة مع جدول المحتويات المطبوع.
pdftitle & pdfauthor
املأ البيانات الوصفية للمستند التي تظهر في عارضات PDF وتستخدمها محركات البحث لفهرسة ملفات PDF.
\section{أخطاء شائعة}
تجنّب هذه الأخطاء
حمّل hyperref أخيرًا
تعيد hyperref تعريف كثير من أوامر LaTeX الداخلية. حمّلها بعد جميع الحزم الأخرى لتجنب التعارضات، ولا يجب أن يتبعها سوى cleveref وقلة من الحزم الأخرى.
الأحرف الخاصة في عناوين URL
Characters like %, #, and & are special in LaTeX. Inside \url{} they are handled automatically; inside \href{} you must percent-encode them in the URL argument.
مربعات ملونة مقابل نص ملون
يرسم نمط hyperref الافتراضي مربعًا ملونًا حول الروابط (colorlinks=false). اضبط colorlinks=true لتلوين النص فقط، فهذا يبدو أفضل في المستندات المطبوعة والرقمية.
hyperref والحواشي السفلية
Using \footnote{\href{...}{...}} is fine. Avoid \href inside \section{} titles unless you also pass hidelinks to suppress the colored bookmark entry.
\section{FAQ}
الأسئلة الشائعة
\section{أدلة ذات صلة}
واصل تعلّم LaTeX
استكشف المزيد من الأدلة وجرّب كل مثال مباشرةً في FormaTeX playground.

