3

I need to draw the 'right-hand' rule with Metapost in my Latex document. The appearance should be artistic (i.e show the real hand fingers pointing). How is it done?

  • 1
    Welcome to TeX.SX! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are either "off topic", "too broad", or "unclear". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. – Stefan Pinnow Aug 8 '17 at 5:56
  • 1
    Metapost is not the best tool for "artistic" work --- if you must have an artistic path in MP, then use some other tool to capture the path first. For example you could sketch on graph paper and work out the coordinates by hand or scan a graphic or a photograph and use something like Gimp that will let you pick out a path and export it. – Thruston Aug 8 '17 at 9:22
10

Here's a Metapost version as the OP requested. There's nothing very clever about this apart from the actual sequence of paths to draw the hand. I captured these from a sketch (of my left hand) on graph paper. Hopefully of use to others, as the paths could easily be adapted to TikZ.

A diagram of a human hand

prologues := 3;
outputtemplate := "%j%c.eps";

vardef left_hand(expr shade) = 
    save H, N;
    path H, N[];

    H = (28,-10)..(37.5,0)..(52,9.6)..(60,13.1)..(70,18)..(74,20)..(91,30)
      ..(101,40)..(106,48)..(110,52)..(115,58)..(116,60)..(116.4,64)..(110,70)
      & (110,70)..(112,74)..(110,81)..(108,85)..(102,87)
      & (102,87)..(110,91)..(120,95)..(130,98)..(136,100)..(140,103)..(140.4,109)
      ..(130,112)..(121,111.2)..(110,110)..(100,108)..(90,105)..(86,103)
      & (86,103)..(90,111)..(95,119)..(103.5,130)..(112,139)..(120,150)..(113,158)..(110,156)..(91,140)..(70,120)..(59,111)
      & (59,111)..(58,120)..(56,130)..(53,140)..(48,150)..(40,154)..(34,150)..(34,140)..(35,130)..(36,120)..(36,110)..(35,100)..(30,80)..(10,51)..(0,42)
      &(0,42) {down} .. (28,-10) & cycle;

    N0 = buildcycle(H, ((34.5,133.8) .. (38,140) .. (38,149) & (38,149) .. (34,150)));
    N3 = (74,44)..(81,50)..(80,57)..(71,52){dir 240}..cycle;
    N4 = (85,40)..(90,43)..(92,50)..(90,52)..(84,50)..(81,44)&(81,44)..cycle; 

    save p; picture p; p = image(
    fill H withcolor .9[shade, white];

    unfill N0; draw N0;  
    unfill N3; draw N3;
    unfill N4; draw N4;

    draw (59,111) { down }..(60,101)..(64,90)..(68,80);

    draw (102,146) .. (108,138) {dir -80};
    draw (88,132) .. (95,122) { dir -80};
    draw (71,112) .. (73,100) .. (72,66) { dir -96};

    draw (121,109)..(122,98) { dir -59 }; 
    draw (101,105)..(105,92) { dir -54 }; 
    draw (86,103).. { dir -54 } (89,83) & (89,83) .. (102,87) {2,1};
    draw (89,83)..{dir -100}(88,79);

    draw (110,70)..(100,64)..(90,56)..(84,50)..(80,44)..(76,41)..
         (70,42)..(67,48)..(67,51)..(70,57) ..(80,68)..(96,81);
    draw (89,70)..(92,61){dir -90};

    draw (106,48)..(90,40)..(82,40)..(80,44);
    draw (97,59)..(100,48){dir -100};
    draw (65,42)..(60,30)..(58,27);

    draw H; 

    draw (25,64){down}.. (30,39) .. (48,12){dir -40};
    ) shifted -(45,85) rotated -4; p
enddef;

vardef right_hand(expr shade) = 
    left_hand(shade) reflectedabout(up,down)
enddef;

beginfig(1);

draw right_hand(red + 1/2 green + 1/8 blue);

path a[]; 
a1 = origin -- 80 up;
a2 = origin -- 120 up rotated 50;
a3 = origin -- 120 up rotated 80;

for i=1 upto 3:
    drawarrow a[i] dashed withdots scaled 1/4 withcolor 2/3 red;
endfor

label.top (btex $a \times b$ etex, point 1 of a1);
label.ulft(btex $a$ etex, point 1 of a2);
label.lft (btex $b$ etex, point 1 of a3);

endfig;
end.

Notes

  • The two routines left_hand and right_hand return a MP picture primary that you draw or save as a picture variable.

  • I've shifted the drawing so that it is conveniently centred on the origin. You can of course shift it about, or rotate it, as you need.

  • This also means it's easy to flip between left-hand and right-hand versions, using reflectedabout(up,down)

  • The small negative rotation is so that the pointing fingers and thumb are at nice angles: 0, 50, and 80. This was just fortuitous, and not part of my original plan.

6

enter image description here

Run with xelatex or latex->dvips->ps2pdf

\documentclass[pstricks]{article}
\pagestyle{empty}
\usepackage{pst-slpe,pstricks-add}

\definecolor{Weiss}{rgb}{1,0.98,0.98}%  255 250 250
\definecolor{Haut}{rgb}{1,0.894,0.769}% 255 228 196
\definecolor{Auge}{rgb}{0.54,0.27,0.074}% 139 69 19

\begin{document}

\def\RechteHand{%
    \begin{pspicture}[shift=-6](0,0)(7,7)
        \begin{psclip}
        {\pspolygon[linestyle=none](0.2,0.2)(0.2,5)(1.6,6.4)(7,6.4)(7,0.2)}
        \pscustom[fillstyle=solid,fillcolor=Haut,linecolor=black!90,linewidth=0.8pt,opacity=0.5]{%
            %
            %\psset{showpoints}
            % Hals links
            \psbezier(0.1,4.95)(0.6,4.5)(1.8,4.15)(1.8,3.65)
            \psbezier(1.8,2.75)(1.9,3.15)(1.9,2.55)
            \psbezier(1.9,2.35)(2.25,2.15)(2.25,1.65)
            \psbezier(2.25,1.4)(1.65,0.8)(1.65,0.75)
            \psbezier(1.65,0.6)(1.8,0.54)(1.9,0.5)
            \psbezier(2,0.44)(2.5,0.6)(2.7,1.05)
            \psbezier(3,1.45)(3,1.5)(3,1.8)
            \psbezier(3.05,2.1)(3.1,2.1)(3.4,2)
            \psbezier(3.6,2)(3.6,1.95)(3.8,1.95)
            \psbezier(3.85,1.95)(4.1,1.85)(4.2,1.85)
            \psbezier(4.4,1.85)(4.5,1.95)(5,2)
            \psbezier(5.4,1.95)(5.5,1.95)(5.8,1.96)
            \psbezier(6.55,1.92)(6.7,1.94)(6.7,2.2)
            \psbezier(6.7,2.45)(6.1,2.5)(5.9,2.43)
            \psbezier(5.8,2.47)(5.2,2.55)(5.1,2.5)
            \psbezier(5.0,2.55)(5,2.57)(4.9,2.6)%  wichtige Endpunkte f\"{u}r Mittelfinger
            \psbezier(4.95,3.0)(4.95,3.0)(4.9,3.6)%  wichtige Endpunkte f\"{u}r Start des 
            %Mittelfingers
            \psbezier(4.93,4.0)(4.9,4.0)(4.85,4.5)
            \psbezier(4.83,4.8)(4.8,4.6)(4.78,5)% Fingernagel Mittelfinger
            \psbezier(4.76,5.2)(4.8,5.0)(4.75,5.35)% Fingernagel Mittelfinger
            \psbezier(4.35,5.57)(4.23,5.0)(4.33,4.5)
            \psbezier(4.3,4.38)(4.31,4.4)(4.3,4.18)
            \psline(4.3,4.18)(4.25,4.16)
            \psbezier(4,4.5)(3.4,4.7)(3,4.75)
            \psbezier(2.8,4.8)(2.65,5.03)(2.6,5.05)
            \psbezier(2.4,5.15)(1.75,5.8)(1.3,6.25)
            \closepath
        }
        \end{psclip}
        % Fingernagel Mittelfinger
        \pscustom[fillstyle=solid,fillcolor=yellow,linecolor=black!90,linewidth=0.3pt,opacity=1]{%
            \psbezier(4.75,5.35)(4.6,5.32)(4.56,5.25)(4.56,5.17)
            \psbezier(4.56,4.95)(4.6,4.98)(4.79,5)
            \closepath
        }
        % Fingernagel Ringfinger
        \pscustom[fillstyle=solid,fillcolor=red,linecolor=black!90,linewidth=0.3pt,opacity=1]{%
            \psbezier(3.53,3.9)(3.46,3.7)(3.4,3.69)(3.25,3.68)
            \psbezier(3.2,3.675)(3.17,3.7)(3.23,3.8)
            \psbezier(3.3,3.87)(3.33,3.87)(3.4,3.88)
            \psbezier(3.5,3.9)(3.5,3.91)(3.53,3.9)
            \closepath
        }
        % Fingernagel kleiner Finger
        \pscustom[fillstyle=solid,fillcolor=black,linecolor=black!90,linewidth=0.3pt,opacity=1]{%
            \psbezier(4.02,4.12)(4.02,4.0)(3.84,3.96)(3.9,3.97)
            \psbezier(3.82,3.95)(3.69,3.94)(3.7,3.96)
            \psbezier(3.75,4.07)(3.74,4.04)(3.82,4.08)
            \closepath
        }
        % Fingernagel Daumen
        \pscustom[fillstyle=solid,fillcolor=red!20,linecolor=black!90,linewidth=0.3pt,opacity=1]{%
            \psbezier(1.92,1.085)(1.93,1.02)(1.8,0.85)(1.66,0.7)
            \psbezier(1.64,0.8)(1.64,0.74)(1.92,1.085)
            \closepath
        }
        % Fingernagel Zeigefinger
        \pscustom[fillstyle=solid,fillcolor=red!20,linecolor=black!90,linewidth=0.3pt,opacity=1]{%
            \psbezier(6.25,1.95)(6.3,2)(6.5,2.01)(6.65,2)
            \psbezier(6.63,1.93)(6.35,1.94)(6.25,1.95)
            \closepath
        }
        % Mittelfinger
        \psbezier(4.9,2.6)(4.85,2.61)(4.85,2.61)(4.8,2.62)
        \psbezier(4.8,2.62)(4.7,2.63)(4.5,2.68)(4.39,2.65)
        \psbezier(4.39,2.65)(4.2,3)(4.35,3.5)(4.36,3.6)
        \psbezier(4.36,3.6)(4.3,4.0)(4.3,4)(4.3,4.18)
        \psbezier(4.8,2.62)(4.85,3)(4.85,3)(4.9,3.5)
        %  Linien im Mittelfinger
        {\psset{linewidth=0.4pt,linecolor=black!50}
            \psbezier(4.85,4.6)(4.8,4.59)(4.75,4.59)(4.7,4.56)
            \psbezier(4.85,4.5)(4.8,4.49)(4.75,4.49)(4.7,4.47)
            %
            \psbezier(4.89,3.8)(4.84,3.79)(4.79,3.79)(4.74,3.76)
            \psbezier(4.89,3.7)(4.84,3.69)(4.79,3.69)(4.74,3.67)
            \psbezier(4.89,3.6)(4.84,3.59)(4.79,3.58)(4.74,3.59)
        }
        % kleiner Finger
        \psbezier(4.25,4.16)(4.15,4.15)(4.1,4.14)(4.02,4.12)
        % Ringfinger
        \psbezier(4.3,4.02)(4.23,4.01)(4.2,4.02)(4.0,3.98)
        \psbezier(4.0,3.98)(3.8,3.97)(3.7,3.95)(3.53,3.9)
        %
        \psbezier(4.35,3.57)(4.23,3.51)(4.2,3.51)(4,3.54)
        \psbezier(4,3.54)(3.4,3.4)(3.12,3.5)(3.2,3.7)
        % Linie im Ringfinger
        {\psset{linewidth=0.4pt,linecolor=black!50}
            \psbezier(4,3.97)(3.9,3.94)(3.9,3.84)(3.88,3.8)
        }
        % Linien in Zeigefinger und Daumen
        {\psset{linewidth=0.4pt,linecolor=black!50}
            \psbezier(5.9,2.41)(5.86,2.35)(5.84,2.29)(5.83,2.25)
            \psbezier(5.1,2.5)(5.04,2.43)(5.03,2.44)(5.0,2.35)
            \psbezier(3.15,2.05)(3.24,2.23)(3.4,2.35)(3.5,2.4)
            \psbezier(3.05,2.05)(3.03,2.13)(3.07,2.38)(3.1,2.45)
            \psbezier(2.7,1.05)(2.63,1.08)(2.55,1.2)(2.45,1.2)
            % Linien in der Handfl\"{a}che
            \psbezier(2.1,3.8)(2.05,4.0)(2.4,4.4)(2.8,4.5)
            \psbezier(2.83,4.12)(3,4.22)(3.15,4.0)(3.25,3.83)
        }
        \psline[linewidth=0.8pt,linecolor=red,arrowscale=1.2,arrowlength=1.6,arrowinset=0.05]{->}(4.6,2.2)(4.6,6)
        \psline[linewidth=0.8pt,linecolor=blue,arrowscale=1.2,arrowlength=1.6,arrowinset=0.05]{->}(4.6,2.2)(7,2.2)
        \psline[linewidth=0.8pt,linecolor=green,arrowscale=1.2,arrowlength=1.6,arrowinset=0.05]{->}(4.6,2.2)(3,0.6)
        %\psgrid[subgriddiv=5,gridlabels=10pt,gridwidth=0.6pt,gridcolor=green!80,subgridwidth=0.2pt,subgridcolor=green!50]
    \end{pspicture}}

\RechteHand %
\psscalebox{-1 1}{\RechteHand }

\end{document}
1
\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{fourier}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}


\usepackage{tikz}
\usepackage{tikz-3dplot} 
\usetikzlibrary{shapes,shadows,calc}
\usetikzlibrary{positioning,calc}
\usepackage{lipsum}
\usepackage{gnuplot-lua-tikz}
%

\usepackage{indentfirst}

\setlength{\parskip}{.5cm}
\usetikzlibrary{angles,quotes}

\usepackage{xcolor}
\usepackage{enumitem}


\usetikzlibrary{scopes,patterns,intersections}
\usetikzlibrary{decorations.markings}
\usepackage{tikzpagenodes}
\usetikzlibrary{shapes.geometric,calc}
\usetikzlibrary{patterns,snakes}

\usetikzlibrary{tikzmark}

\usetikzlibrary{calc}
\usetikzlibrary{tikzmark}

%% USO DE CAMADAS (layers)

\pgfdeclarelayer{background}
\pgfdeclarelayer{main}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

%%exemplo
%% \begin{pgflayer}{background}  \end{pgflayer}

\definecolor{crimsonglory}{rgb}{0.75, 0.0, 0.2}

\definecolor{cor1}{HTML}{57C3CF}
\definecolor{cor2}{HTML}{4EA8B1}
\definecolor{almond}{rgb}{0.94, 0.87, 0.8}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{darkmagenta}{rgb}{0.55, 0.0, 0.55}



\begin{document}


        \begin{tikzpicture}[scale=0.4,
%   rotate=15,
    font=\footnotesize,%\tiny
    line cap=round,
    line join=round,
    >=stealth,
    ]

   %% coordenadas

   \coordinate (0) at (0,0);    
   \coordinate (AB) at (0,4);
   \coordinate (A) at (-5.5,4.85);
   \coordinate (B) at (-6.5,1.2);
   \coordinate (B1) at (2.8,-2.2);
   \coordinate (B2) at (1.5,-5.5);
   \coordinate (B3) at (.3,3.8);
    \coordinate (B4) at (-1.75,1.5);
    \coordinate (B5) at (-1.5,-1.2);
    \coordinate (B6) at (-4.5,1.1);
    \coordinate (B7) at (-4.5,0.5);
        \coordinate (B8) at (-3.4,.8);
    \coordinate (B9) at (-3.5,0.2);
    \coordinate (B10) at (-3.5,3.4);
    \coordinate (B11) at (-3.85,2.8);

% dedo 2
\coordinate (M1) at (-2.5,.9);
\coordinate (M2) at (-4,1.34);
\coordinate (M3) at (-5,1.32);
\coordinate (M4) at (-5.5,1.2);
\coordinate (M5) at (-5.8,0.8);
\coordinate (M6) at (-5.5,0.6);
\coordinate (M7) at (-5,0.5);
\coordinate (M8) at (-4.2,0.2);
\coordinate (M9) at (-3.55,-0.1);
\coordinate (M10) at (-3.2,-0.2);
\coordinate (M11) at (-2.7,-0.3);


\coordinate (M12) at (-3.45,-0.2);
\coordinate (M13) at (-3.875,-0.4);
\coordinate (M14) at (-3.95,-0.8);
\coordinate (M15) at (-3.55,-1.3);
\coordinate (M16) at (-2.5,-1.9);

%%  
        \coordinate (B12) at (-2.7,2.5);
    \coordinate (B13) at (-3,2);

   \coordinate (X1) at (5,0);
   \coordinate (Y1) at (0,5);
   \coordinate (X2) at (-6,0);
   \coordinate (Y2) at (0,-6);
   %% controls coordinates

   \coordinate (C0) at (0,4.2);
   \coordinate (C01) at (-0.4,3.8);
   \coordinate (C1) at (-0.7,3);
   \coordinate (C2) at (-0.8,2);
   \coordinate (C3) at (-0.95,1);
   \coordinate (C4) at (-1.5,-0.5);
   \coordinate (U1) at (0.3,3.9); 
    \coordinate (U2) at(0.2,3.8);
    \coordinate (U3) at(0.1,3.5);
    \coordinate (U4) at (0.15,2.8);
    \coordinate (U5) at (0.20,2.85);
    \coordinate (U6) at (0.25,2.9);



    \coordinate (p1) at (-.9,1.56); 
    \coordinate  (p2) at (-2,2);
    \coordinate  (p3) at (-2.75,3.25);
    \coordinate  (p4) at (-4,3.8);   
    \coordinate  (p5) at (-4.5,3.75);
    \coordinate  (p6) at (-4.5,3);
    \coordinate  (p7) at (-3.2,1.9);


    \coordinate  (p8) at (-3.199,1.9);
    \coordinate  (p9) at (-2.5,1.2);
    \coordinate  (p10) at (-2.3,0.6);
    \coordinate  (p11) at (-2.6,-0.2);

    \coordinate  (p12) at (-5.8,0.85);
    \coordinate  (p13) at (-5.5,1.25);
    \coordinate (p14) at (-4,1.15);
    \coordinate (p15) at (-3,2);

    \coordinate  (p16) at (-2.3,1.3);
    \coordinate  (p17) at (-3.5,1.65);
    \coordinate (p18) at (-4,1.75);
    \coordinate (p19) at (-4.5,1.65);
    \coordinate  (p20) at (-5,1.6);
    \coordinate (p21) at (-5.5,1.74);
    \coordinate (p22) at (-5.8,1.5);

    \coordinate (p23) at (-5.5,.1);
    \coordinate (p24) at (-4.5,0);
    \coordinate (p25) at (-3.5,-0.3);

    \coordinate (p26) at (-5.6,0.4);
    \coordinate (p27) at (-5.7,0.3);
    \coordinate (p28) at (-5.6,0.1);

    % eixos desenhos   
    %\draw[dashed] (X2) -- (X1)  (Y2) -- (Y1);      

    %% bends para parte inferior e lateral direita da maão

    %% linha das maos (hands)

    \draw[black!70] (B1) to [bend left] (B2);
    \draw[black!70] (B3) to [bend right] (B1);

    \draw[black!70] (B4) to [bend right] (B5);
    \draw[black!70] (B6) to [bend left] (B7);
    \draw[black!70] (B8) to [bend left] (B9);
    \draw[black!70] (B10) to [bend left] (B11);
    \draw[black!70] (B12) to [bend left] (B13);


    \begin{scope}[on background layer]
    %nail 1

    \draw[black!40,fill=gray!70] (B3) .. controls (U1) and (U2) .. (U3)
    .. controls  (U4) and (U5) .. (U6);
        \draw[black!70] (1.2,-1.2) to [bend left] (0.2,-4);


    \end{scope}



    \begin{scope}[on background layer]
    \draw (B3) .. controls  (C0) and (C01) .. (C1) 
.. controls  (C2) and (C3) .. (C4);

    \draw (B2) .. controls  (0,-3.6) and (-1.5,-4) .. (-3.2,-2.53);

    \end{scope}

    %%nail 2
    \draw[black!40,fill=gray!70] (-1.8,-2.6) .. controls (-1.5,-2.2) and (-2.1,-1.8) .. (-2.5,-2) --  cycle;

    %%nail 2



    \filldraw[gray!70] (-2.4,-2.2) to [bend right] (-2.7,-2.7) .. controls (-2.3,-2.60) and (-2.2,-2.6).. (-2.4,-2.2) -- cycle;


    \draw[black!70] (-1.24,-2.7) to [bend right] (-.5,-3.5);

    \draw[black!70] (-3.3,-1.65) to [bend right] (-3.6,-2.1);

    \draw[black!70] (-2.5,-1.2) to [bend right] (-2.7,-1.5);


    %% finger 2



    \draw (M1) .. controls  (M2) and (M3) .. (M4)  
    .. controls  (M5) and (M6) .. (M7);
    \draw (M7) .. controls  (M8) and (M9) .. (M10);

    %% finger 3
    \draw (M10) .. controls  (M11) and (M12) .. (M9) .. controls  (M13) and (M14) .. (M15);

    \draw (M15) .. controls  (M16) and (M16) .. (-2.2,-2.4) .. controls (-1.8,-2.8) and (-1.6,-2.4) .. (-1.6,-2.4);%(-1.4,-1.9);

    \draw (-1.6,-2.4) .. controls  (-1.4,-1.9) and (-1.9,-1) .. (-2.2,-0.85);


    % finger 4
    \draw (M15) .. controls (-4.1,-1.3) and (-4,-1.85) .. (-3.75,-2.2) .. controls (-2.8,-2.8) and (-2.2,-2.9) .. (-2.2,-2.4);



    \begin{scope}[on background layer]

    \draw[black] (p1) .. controls  (p2) and (p3) .. (p4)  
    .. controls  (p5) and (p6) .. (p7);

    \draw[black] (p8) .. controls  (p9) and (p10) .. (p11);  


    \end{scope}


    \draw[black!70,dashed,->] (1,4) to [bend right] (-1,4);

        \draw[line width=1.2pt,->,teal] (0) -- (A) node[left,black] {$\vec{u}$};
    \draw[line width=1.2pt,->,darkmagenta] (0) -- (B) node[left,black] {$\vec{v}$};

    \draw[line width=1.2pt,->] (0) -- (0,5) node[above] {$\vec{u}\times \vec v$};


    \end{tikzpicture}


\end{document}
  • I am no expert on tikz. Instead. Pretty beginner. improving let me know. – Douglas de Albuquerque Sep 24 at 3:26
  • 4
    Welcome to TeX.SX! Note that the OP explicitly asked for a MetaPost solution. Beside that, you could improve your post by adding an image of the rendered output. – siracusa Sep 24 at 3:52

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.