اذهب إلى المحتوى
  • 0

كيف أرسم شكلاً شبيها بهذا على برنامج LaTeX؟

سعاد

السؤال

على برنامج تحرير الوثائق LaTeX أريد رسم شكل كهذا الموجود في الصورة:

v71ME.thumb.png.1cf8cbcffac4cb96f15ee758

لكني وجدت مشكلة في إدراج الأسهم جهة اليمين، وهذا هو الكود الحالي:

\documentclass{article}
\usepackage{xcolor}
\begin{document}
\centering
\fboxsep=10mm \fboxrule=0.5mm
\fcolorbox{black}{blue!40!white}{{\bf P}}\\[2cm]

\fboxsep=3mm \fboxrule=0.5mm
\fcolorbox{black}{blue!40!white}{$a_1$}\fcolorbox{black}{blue!40!white}{$o_1$}\fcolorbox{black}{blue!40!white}{$a_2$}\fcolorbox{black}{blue!40!white}{$o_2$}\fcolorbox{black}{blue!40!white}{$a_3$}\fcolorbox{black}{blue!40!white}{$o_4$}\\[2cm]

\fboxsep=10mm \fboxrule=0.5mm
\fcolorbox{black}{blue!40!white}{{\bf Q}}

\end{document}

كيف أرسم الشكل أعلاه باستعمال LaTeX؟

رابط هذا التعليق
شارك على الشبكات الإجتماعية

Recommended Posts

  • 0

هناك حل باستعمال حزمة TiKZ، وذلك باستخدام الجدول matrix/ ووضع محتواه متوسطا للخانات عن طريق  0pt، مع استعمال أسهم موجهة نحو القيم الموجودة بالجدول، ثم رسم إطار جدول بشكل عريض، بهذه الطريقة:

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows,matrix,positioning}

\begin{document}
\begin{tikzpicture}[>=stealth']

\matrix (tape) [matrix of math nodes, inner sep=0pt, nodes={draw, inner sep=3pt, fill=blue!40, outer sep=0pt}, column sep=-\pgflinewidth, inner sep=0pt] {a_1 & o_1 & a_2 & o_2 & a_3 & o_3 & a_4 & o_4 & a_5 & o_5 \\};

\node[draw, minimum width=12mm, above = 6mm of tape-1-5.north east, fill=blue!40] (P) {\rule{0cm}{1cm}P};

\node[draw, minimum width=12mm, below = 6mm of tape-1-5.south east, fill=blue!40] (Q) {\rule{0cm}{1cm}Q};

\draw[<-, shorten <=-2pt] (tape-1-5.north)--(tape-1-5|-P.south);
\draw[->, shorten >=-2pt] (tape-1-5.south)--(tape-1-5|-Q.north);
\draw[->, shorten >=-2pt] (tape-1-6.north)--(tape-1-6|-P.south);
\draw[<-, shorten <=-2pt] (tape-1-6.south)--(tape-1-6|-Q.north);

\draw[shorten <=-1mm, shorten >=-1mm] ([xshift=2mm]tape-1-10.north east) to [bend left] ([xshift=2mm]tape-1-10.east) to [bend right] ([xshift=2mm]tape-1-10.south east);
\draw[shorten <=-1mm, shorten >=-1mm] ([xshift=3mm]tape-1-10.north east) to [bend left] ([xshift=3mm]tape-1-10.east) to [bend right] ([xshift=3mm]tape-1-10.south east);
\draw[fill=blue!40] (tape-1-10.north east)--([xshift=2mm]tape-1-10.north east) to [bend left] ([xshift=2mm]tape-1-10.east) to [bend right] ([xshift=2mm]tape-1-10.south east)--(tape-1-10.south east)--cycle;

\draw[thick] ([xshift=2mm]tape-1-10.north east)-|(tape-1-1.west)|-([xshift=2mm]tape-1-10.south east);
\end{tikzpicture}
\end{document}

لتكون النتيجة بالشكل التالي:

Shn0l.thumb.png.8b27945c6d94f111a5dd0bec

رابط هذا التعليق
شارك على الشبكات الإجتماعية

انضم إلى النقاش

يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.

زائر
أجب على هذا السؤال...

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   جرى استعادة المحتوى السابق..   امسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

  • إعلانات

  • تابعنا على



×
×
  • أضف...