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

كيف اضبط محاذاة سطري نص معَ خط في الجانب على LaTeX؟

Badraoui

السؤال

أحاول تكملة هذا الرسم على برنامج LaTeX:

bq18l.thumb.png.bedbd6012b7fc76cc18f7b1d

المشكلة: أن النص الظاهر جانب الخط لا يتموضع وسط الخط، أي أن المستقيم -الخط-، أريده أي يتموضع وسط السطرين من الكتابة، كيف ذلك؟

هذا هو الكود المصدري:

\documentclass[border=5pt, multi, tikz]{standalone}
\usetikzlibrary{arrows.meta,decorations.markings}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}


\begin{tikzpicture}
\draw[very thick](0,0) -- (7,0) node [right] {Light to the East // of mast means 11};
\draw[black!80,fill=white] (1,0) circle (.2cm) node [left] {Light to the West // of mast means 00};
\draw[black!80,fill=red] (3.5,-3) circle (.2cm);
\draw[black!80,fill=red] (3.5,3) circle (.2cm) node [above] {Light to the North // of mast means 01};
\draw[black!80,fill=white] (6,0) circle (.2cm);
\draw[very thick] (3.5,3.5) -- (3.5,-3.5) node [below] {Light to the South // of mast means 10};
\end{tikzpicture}

\end{document}

 

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

Recommended Posts

  • 0

من أجل ضبط محاذاة النص المكون من سطرين مع العقدة(الخط في حالتك)، يجب اتباع الخطوات التالية:

  • حدد تنسيق العقدة بإضافة تحديد أكثر دقة كـ[{ \begin{tikzpicture}[every node/.style={align=left.
  • عوض // استعمل التعبير الأصح لإنشاء سطر جديد، وهو \\.

ليكون الكود الصحيح، بعد التغيرات المُدرجة أعلاه كالآتي:

 

\documentclass[border=5pt, multi, tikz]{standalone}
%\usetikzlibrary{arrows.meta,decorations.markings}
%\usepackage{amsmath}
%\usepackage{xcolor}
\begin{document}

    \begin{tikzpicture}[
every node/.style={align=left}
                        ]
% lines with nodes                      
\draw[very thick]
    (0,0) node [left]  {Light to the West\\ of mast means 00}
              -- (7,0) node [right] {Light to the East\\ of mast means 11}
    (3.5,3.5) node [above] {Light to the North\\ of mast means 01}
              -- (3.5,-3.5) node [below] {Light to the South\\ of mast means};
% red circles
\draw[fill=red]     (3.5,-3) circle (.2) 
                    (3.5, 3) circle (.2); 
% white circles
\draw[fill=white]   (6,0)    circle (.2)
                    (1,0)    circle (.2);
% black square
\draw[fill=black]   (3.3,-0.2) rectangle +(.4,0.4);
    \end{tikzpicture}
\end{document}

النتيجة:

dEXOp_(1).thumb.png.95763350b957ff7acfa5

*ملاحظة: كما تلاحظ السطرين النصيين يظهران بشكل أكثر تناسق، وذلك عن طريق تحديد أكثر لتنسيقهما (تنسيق العقدة).

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

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

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

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

×   لقد أضفت محتوى بخط أو تنسيق مختلف.   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.

  • إعلانات

  • تابعنا على



×
×
  • أضف...