2

I want to encode in LateX the figure below. So far this is what I've tried.

\documentclass{article}

\usepackage[english]{babel}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}

\draw[thin](0,0) circle (2cm);
\draw (-1.4,-1.4) rectangle (1.4,1.4);
\draw (0,0)--(1.4,1.4);
\draw (0,0)--(1.4,0);

\end{tikzpicture}

\end{document}

Can someone help me on how to do the labelings in LateX?

enter image description here

2

Labels (or any kind of text) are included in TiKZ pictures with nodes:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[thin](0,0) circle (2cm);
\draw (-1.4,-1.4) rectangle (1.4,1.4);
\draw (0,0)-- node[above] {$r$} (1.4,1.4);
\draw (0,0)--node[below] {$x$} (1.4,0);
\node[right] at (1.4,0.7) {$y$};
\node[left] at (-1.4,0) {$W$};
\node[above] at (0,1.4) {$L$};
\end{tikzpicture}

\end{document}

enter image description here

  • Its nice and thank you very much. I am new in TikZ package and still learning to use it. +1 rep Sir – jun Sep 27 at 10:55
2

While you are waiting for some help with TikZ, here is how you could do that in Metapost, using luamplib. Compile with lualatex.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
    path C, S, T;

    C = fullcircle scaled 144;
    S = point 1 of C -- point 3 of C -- point 5 of C -- point 7 of C -- cycle;
    T = point 0 of S -- center S -- point 3.5 of S -- cycle;

    fill C withcolor 0.94 [red, white];
    fill S withcolor 0.94 [blue, white];
    fill T withcolor 0.94 [green, white];

    draw C;
    draw S;
    draw T;

    drawoptions(withcolor 2/3 blue);

    label.top ("$L$", point 0.5 of S);
    label.lft ("$W$", point 1.5 of S);

    label.ulft ("$r$", point 0.5 of T);
    label.bot  ("$x$", point 1.5 of T);
    label.rt   ("$y$", point 2.5 of T);

    drawoptions();
endfig;
\end{mplibcode}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.