> 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/50-wrapping-text-around-figures.md).

# التفاف النص حول الأشكال

في بعض الأحيان، قد يكون من المرغوب فيه التفاف النص حول عنصر عائم (صورة، في حالتنا) حتى لا ينقطع تدفق النص. توجد عدة حزم في LaTeX لإنجاز هذه المهمة، رغم أنها تتطلب قدراً من الضبط اليدوي في معظم الحالات.

### استخدام wrapfig

لاستخدام *wrapfig*، نحتاج إلى تضمين السطر التالي في المقدمة:

```latex
\usepackage{wrapfig}
```

هذا يجعل *wrapfigure* المتاحة لنا، ويمكننا وضع *\includegraphics* أمر بداخلها لإنشاء شكل يلتف النص حوله. فيما يلي كيفية تحديد *wrapfigure* البيئة:

```latex
\begin{wrapfigure}[lineheight]{position}{width}
  ...
\end{wrapfigure}
```

ال *الموضع* للمعامل ثماني قيم ممكنة:

|   |   |                                                          |
| - | - | -------------------------------------------------------- |
| r | R | الجانب الأيمن من النص                                    |
| l | L | الجانب الأيسر من النص                                    |
| i | I | الحافة الداخلية — بالقرب من التجليد (في *twoside* مستند) |
| o | O | الحافة الخارجية — بعيدًا عن التجليد                      |

تسمح النسخة ذات الحرف الكبير للشكل بأن يكون عائمًا. أما النسخة ذات الحرف الصغير فتعني *هنا بالضبط*.

إليك مثالاً:

```latex
\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{birds}
  \end{center}
  \caption{الطيور}
\end{wrapfigure}
```

يجدر ملاحظة أن عرض الصورة المدرجة تم تحديده نسبةً إلى عرض النص (*\textwidth*). ومن الجيد استخدام الأحجام النسبية لتعريف الأطوال (الارتفاع، العرض، إلخ)، خصوصاً عند استخدام *wrapfigure*.

في المثال أعلاه، تغطي الصورة بالضبط نصف عرض النص، وتستخدم الصورة الفعلية عرضاً أصغر قليلاً، بحيث توجد مساحة بيضاء صغيرة لطيفة بين الصورة والنص. ينبغي أن تكون الصورة دائماً أصغر (أقل عرضاً) من الالتفاف، وإلا فسوف تتجاوز النص.

انتبه عند إضافة *wrapfigures* قريباً جداً من أعلى الصفحة أو أسفلها، لأن ذلك قد يتسبب كثيراً في آثار غير مرغوب فيها يصعب أو يكاد يستحيل حلها. لا يُنصح بمحاولة استخدام *wrapfigures* إلى جانب المعادلات أو العناوين القطاعية. كما لا يمكن استخدامها في القوائم، مثل `itemize` و `enumerate` البيئات.

[افتح مثالًا في Overleaf](https://www.overleaf.com/project/new/template/19663?id=66518064\&templateName=Example+of+positioning+tables+and+figures\&latexEngine=pdflatex\&texImage=texlive-full%3A2020.1\&mainFile=)

### التعامل مع الصور التي تحتوي على فراغ أبيض

إذا كانت الصورة تحتوي على فراغ أبيض غير مرغوب فيه، فيمكننا استخدام أي من الخيارات التالية لإزالة الفراغ الأبيض الزائد:

* *القص* الفراغ الأبيض عند استخدام \includegraphics
* ال *picins* يمكن استخدام الحزمة بدلاً من *wrapfigure*، والتي تزيل الفراغ الأبيض الزائد مباشرةً دون أي ضبط يدوي.
* الحزمة *floatflt* هو بديل آخر.
* تجنب استخدام *\begin{center}* لتوسيط الصورة، لأنه يضيف مساحة إضافية. استخدم *\centering* بدلًا من ذلك.
* البرنامج *pdfcrop* (المضمّن في معظم توزيعات TeX) يمكن استخدامه لإزالة الفراغ الأبيض نهائياً.


---

# 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/50-wrapping-text-around-figures.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.
