2

Consider the following picture:

chess-pawn

I would like to draw this picture using LaTeX (preferably PSTricks but TikZ is also fine).

The space between the two curves should be completely yellow.

P.S. I know that this is a "please do it for me" question (sorry for that!) but I really don't know how to draw this at all.

11
  • @CroCo Did you even read the question? He even explains himself. Sep 11 '17 at 1:39
  • @CroCo And the OP is being picky about application and colouring. If you have no clue how to do it why would you care whether it is pstricks, MetaPost or picture?
    – cfr
    Sep 11 '17 at 1:39
  • 1
    @cfr Sometimes you just get stuck and don't know where to start, see this question of mine. I agree that the phrasing could be improved though. Sep 11 '17 at 1:42
  • 1
    @HenriMenke So why do you close all the newbies' questions? Only high rep users are allowed to get stuck? I think there is something to be said for being more tolerant of do-it-for-mes from new users than established users. But, apparently, you think the right to not have a clue has to be earned by accumulating points by having a clue what to do, which seems like catch-22 for beginners.
    – cfr
    Sep 11 '17 at 1:54
  • 1
    @cfr, when some people like posts, they will search for any excuses to not downvote or close a post, something like He even explains himself. :)
    – CroCo
    Sep 11 '17 at 2:11
3

I think this comes somewhat close.

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[yscale=3]
  \draw[double=yellow,double distance=2pt,line join=round,looseness=3]
  (0,0)
  -- (1,0)
  to[out=70,in=-10,looseness=1] (.5,.5)
  to[out=10,in=-10] (.25,.75)
  to[out=10,in=0] (0,1)
  to[out=180,in=170] (-.25,.75)
  to[out=190,in=170] (-.5,.5)
  to[out=190,in=120,looseness=1] (-1,0)
  -- cycle;
\end{tikzpicture}

\end{document}

enter image description here

2
  • This looks really nice. Thank you very much! Sep 11 '17 at 1:43
  • 1
    @SvendTveskæg It's not pstricks though. I don't know how to draw a connected \ncarc to get the rounded corners. Maybe you find a way to convert it. Sep 11 '17 at 1:52
4

Just for fun, with pstricks 😉

I feel there ought to be (surely) an easier way of continuing an arc from the previous point, but I couldn't find it.

\documentclass[pstricks,border=5]{standalone}
\usepackage{pgffor}
\def\lstxy{!CP \csname tx@UserCoor\endcsname}
\newcommand\psrarcn[4][]{%
  \psarcn[#1](\lstxy exch #3 cos #2 mul sub exch #3 sin #2 mul sub){#2}{#3}{#4}
}
\begin{document}
\begin{pspicture}(-8,-1)(8,20)
\foreach \lnwd/\lncl in {30pt/black, 25pt/yellow}{
  \pscustom[linewidth=\lnwd,linecolor=\lncl,linejoin=1]{
    \psline(0,0)(!220 cos 5 mul 220 cos 2 mul add 0)
    \psrarcn{5}{220}{90}
    \psrarcn{3}{270}{90}
    \psrarcn{2}{225}{-45}
    \psrarcn{3}{90}{-90}
    \psrarcn{5}{90}{-40}
    \psline(\lstxy)(0,0)
}}
\end{pspicture}
\end{document}

enter image description here

0
3
\documentclass[pstricks,border=5]{standalone}

\usepackage{pstricks}
\def\fig#1#2{\pscustom[arrows=c-c,linewidth=#1,linecolor=#2,linejoin=1]{%
    \psline(-4.9,0)(4.9,0)
    \psarc(0,1){5}{-10}{73}
    \psarc(0,7.5){2.15}{-50}{70}
    \psarc(0,11){1.6}{-60}{240}
    \psarc(0,7.5){2.15}{110}{230}
    \psarc(0,1){5}{107}{190}}}
\begin{document}

\begin{pspicture}(-6,-1)(6,13)
\fig{6mm}{black}
\fig{5mm}{yellow}
\end{pspicture}
\end{document}

enter image description here

2
  • Very elegant. If I compile the code (using xelatex), a piece of the figure is missing at the bottom left corner. Sep 11 '17 at 14:33
  • 1
    Oh, the arrows=c-c was missing in \pscustom
    – user2478
    Sep 11 '17 at 14:47

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.