5

is it possible to reproduce this schema with tikzpicture ?

enter image description here

This is what I tried :

\documentclass{article}
\usepackage{tikz}%,pgf}
%\usepackage{pgfplots}
%\usetikzlibrary{calc,angles}
\usetikzlibrary{angles}
%\usetikzlibrary{arrows}
%\usetikzlibrary{calendar}
%\usetikzlibrary{through}
%\usetikzlibrary{intersections}
%\usetikzlibrary{shapes,decorations}
%\usetikzlibrary{decorations.pathmorphing}
%\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{decorations.shapes}
%\usetikzlibrary{decorations.markings}
%\usetikzlibrary{decorations.text}
%\usetikzlibrary{positioning,automata,shadows}
%\usetikzlibrary{patterns}
\usetikzlibrary{quotes,arrows.meta}
%\usetikzlibrary{shapes.symbols}

\begin{document}

\begin{tikzpicture}
    % Draw the horizontal line
    \draw[dashed] (-1.5, 0) -- (9, 0);

    % Draw the slopes
    \draw[thick] (0, 0) -- (2.5,1.25);
    \draw[thick] (5.5, 1.25) -- (7.5,0);

    % Draw the vertical dashed lines
    \draw[dashed] (2.5, 0) -- (2.5,1.25);
    \draw[dashed] (5.5, 0) -- (5.5,1.25);

    % Labels for points
    \node at (0, -0.2) {A};
    \node at (2.5, 1.5) {B};
    \node at (2.5, -0.3) {I};
    \node at (5.5, 1.5) {C};
    \node at (5.5, -0.3) {J};
    \node at (7.5, -0.3) {D};

    % Vectors
    \draw[->] (2.5,0) -- (3,0) node[below] {$\overrightarrow{i}$};
    \draw[->] (2.5,0) -- (2.5,0.5) node[left] {$\overrightarrow{j}$};

    % Angle
    \coordinate[label=below:] (A) at (2.5,1.25);
    \coordinate[label=above right:] (B) at (0,0);
    \coordinate[label=above right:] (C) at (2.5,0);
    \draw pic [draw,-,"$\alpha$",angle radius=12pt,angle eccentricity=1.5] {angle = C--B--A};

    % Skier on the slope
    \draw[thick] (1.25, 0.625) circle (0.15); % Head
    \draw[thick] (1.25, 0.625) -- (1.25, 0.1); % Body
    \draw[thick] (1.25, 0.4) -- (1.1, 0.3); % Left arm
    \draw[thick] (1.25, 0.4) -- (1.4, 0.3); % Right arm
    \draw[thick] (1.25, 0.1) -- (1.1, 0); % Left leg
    \draw[thick] (1.25, 0.1) -- (1.4, 0); % Right leg

\end{tikzpicture}

\end{document}

The result :

https://i.sstatic.net/Wxd7ublw.jpg

6
  • 2
    In case you don't need a human skier: there is a ski duck available from github.com/TikZlings/Extravaganza2017/blob/master/… (drawn by @ UlrikeFischer) Commented Jul 15 at 12:10
  • Besides tikz, angles and \usetikzlibrary{quotes,arrows.meta} you don't need any other package to run your code. I'll comment that out for you, as it's very disturbing when compiling your copied code ...
    – MS-SPO
    Commented Jul 15 at 12:28
  • 1
    Do you want the Skier moving up the slope ?? Seems a bit magical to me without seeing history ...
    – MS-SPO
    Commented Jul 15 at 12:31
  • 1
    For the Skier you have several more optiones, e.g. a) Place an image there (\includegraphics as a node's text), b) Use a simple scribble of an abstracte Skier (do it on paper first, then transfer), c) find a SVG drawing, include it (see ctan.org for SVG). // Examples for scribbles: 123rf.com/…
    – MS-SPO
    Commented Jul 15 at 12:37
  • yeah, I want a Skier moving up the slope pls
    – matheux
    Commented Jul 15 at 12:37

5 Answers 5

14

The boring solution:

use a skier from the fontawesome5package:

\documentclass{article}
\usepackage{tikz}%,pgf}
%\usepackage{pgfplots}
%\usetikzlibrary{calc,angles}
\usetikzlibrary{angles}
%\usetikzlibrary{arrows}
%\usetikzlibrary{calendar}
%\usetikzlibrary{through}
%\usetikzlibrary{intersections}
%\usetikzlibrary{shapes,decorations}
%\usetikzlibrary{decorations.pathmorphing}
%\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{decorations.shapes}
%\usetikzlibrary{decorations.markings}
%\usetikzlibrary{decorations.text}
%\usetikzlibrary{positioning,automata,shadows}
%\usetikzlibrary{patterns}
\usetikzlibrary{quotes,arrows.meta}
%\usetikzlibrary{shapes.symbols}

\usepackage{fontawesome5}

\begin{document}

\begin{tikzpicture}
    % Draw the horizontal line
    \draw[dashed] (-1.5, 0) -- (9, 0);

    % Draw the slopes
    \draw[thick] (0, 0) -- (2.5,1.25);
    \draw[thick] (5.5, 1.25) -- (7.5,0);

    % Draw the vertical dashed lines
    \draw[dashed] (2.5, 0) -- (2.5,1.25);
    \draw[dashed] (5.5, 0) -- (5.5,1.25);

    % Labels for points
    \node at (0, -0.2) {A};
    \node at (2.5, 1.5) {B};
    \node at (2.5, -0.3) {I};
    \node at (5.5, 1.5) {C};
    \node at (5.5, -0.3) {J};
    \node at (7.5, -0.3) {D};

    % Vectors
    \draw[->] (2.5,0) -- (3,0) node[below] {$\overrightarrow{i}$};
    \draw[->] (2.5,0) -- (2.5,0.5) node[left] {$\overrightarrow{j}$};

    % Angle
    \coordinate[label=below:] (A) at (2.5,1.25);
    \coordinate[label=above right:] (B) at (0,0);
    \coordinate[label=above right:] (C) at (2.5,0);
    \draw pic [draw,-,"$\alpha$",angle radius=12pt,angle eccentricity=1.5] {angle = C--B--A};

    \node[rotate=55] at (1,0.7) {\Large\faSkiing};

\end{tikzpicture}

\end{document}

enter image description here

The more fun variation:

Take Ulrike's ski duck from https://raw.githubusercontent.com/TikZlings/Extravaganza2017/master/ulrikes-duck-pond/ski-duck-UF.tex

\usepackage[svgnames,x11names]{xcolor}
\definecolor{finnlandblue}{RGB}{0,53,128}
\usepackage{tikzducks}
\usetikzlibrary{angles}
\usetikzlibrary{quotes,arrows.meta}

\begin{document}

\begin{tikzpicture}
    % Draw the horizontal line
    \draw[dashed] (-1.5, 0) -- (9, 0);

    % Draw the slopes
    \draw[thick] (0, 0) -- (2.5,1.25);
    \draw[thick] (5.5, 1.25) -- (7.5,0);

    % Draw the vertical dashed lines
    \draw[dashed] (2.5, 0) -- (2.5,1.25);
    \draw[dashed] (5.5, 0) -- (5.5,1.25);

    % Labels for points
    \node at (0, -0.2) {A};
    \node at (2.5, 1.5) {B};
    \node at (2.5, -0.3) {I};
    \node at (5.5, 1.5) {C};
    \node at (5.5, -0.3) {J};
    \node at (7.5, -0.3) {D};

    % Vectors
    \draw[->] (2.5,0) -- (3,0) node[below] {$\overrightarrow{i}$};
    \draw[->] (2.5,0) -- (2.5,0.5) node[left] {$\overrightarrow{j}$};

    % Angle
    \coordinate[label=below:] (A) at (2.5,1.25);
    \coordinate[label=above right:] (B) at (0,0);
    \coordinate[label=above right:] (C) at (2.5,0);
    \draw pic [draw,-,"$\alpha$",angle radius=12pt,angle eccentricity=1.5] {angle = C--B--A};

    % from https://raw.githubusercontent.com/TikZlings/Extravaganza2017/master/ulrikes-duck-pond/ski-duck-UF.tex
    \begin{scope}[scale=0.1,xscale=-1,rotate=-33,xshift=-15cm,yshift=-1.3cm]
    \path[draw=LightPink,fill=Silver] (7.352, 1.5683).. controls (7.4712, 1.5799) and (7.5811, 1.5204) .. (7.5974, 1.4352).. controls (7.6137, 1.3501) and (7.5304, 1.2715) .. (7.4112, 1.2599) -- (0.1723, 0.5274).. controls (0.169, 0.5271) and (0.1627, 0.5264) .. (0.1534, 0.5255).. controls (-0.0506, 0.5056) and (-1.658, 0.3693) .. (-2.2261, 0.963).. controls (-2.294, 1.034) and (-2.2685, 1.1308) .. (-2.1691, 1.1793).. controls (-2.0697, 1.2278) and (-1.9342, 1.2096) .. (-1.8663, 1.1386).. controls (-1.5009, 0.7567) and (-0.3176, 0.7906) .. (0.1104, 0.8355) -- cycle;
    \duck[santa=finnlandblue!80!black, jacket=gray, tshirt=white,body=LightGoldenrod2!70!RosyBrown1,scale=3]
    \path[draw=LightPink,fill=Silver] (7.202, 0.9722).. controls (7.3269, 0.9846) and (7.442, 0.9211) .. (7.4592, 0.8302).. controls (7.4763, 0.7394) and (7.3889, 0.6557) .. (7.264, 0.6432) -- (-0.3196, -0.138).. controls (-0.323, -0.1384) and (-0.3296, -0.1391) .. (-0.3394, -0.1401).. controls (-0.5531, -0.1613) and (-2.237, -0.3067) .. (-2.8321, 0.3266).. controls (-2.9033, 0.4023) and (-2.8765, 0.5056) .. (-2.7725, 0.5573).. controls (-2.6683, 0.6091) and (-2.5264, 0.5896) .. (-2.4553, 0.514).. controls (-2.0724, 0.1065) and (-0.8327, 0.1427) .. (-0.3844, 0.1906) -- cycle;
    \end{scope}

\end{tikzpicture}

\end{document}

enter image description here

7
  • @JohnKormylo Is there an advantage of sloped for a standalone node which is not part of path? Commented Jul 15 at 13:44
  • This would only work if the node was part of the path Commented Jul 15 at 13:46
  • @JohnKormylo (which would be an interesting alternative approach in case you feel like writing an answer) Commented Jul 15 at 13:47
  • It turns out that \faSkiing is alreacy rotated, so you would still have to guess the angle to compensate. Commented Jul 15 at 13:53
  • @JohnKormylo \faSkiingNordic :) (but doesn't look as dynamic as the alpine skier) Commented Jul 15 at 13:56
2

As suggested by SamCarter...

\documentclass{article}
\usepackage{tikz}%,pgf}
%\usepackage{pgfplots}
%\usetikzlibrary{calc,angles}
\usetikzlibrary{angles}
%\usetikzlibrary{arrows}
%\usetikzlibrary{calendar}
%\usetikzlibrary{through}
%\usetikzlibrary{intersections}
%\usetikzlibrary{shapes,decorations}
%\usetikzlibrary{decorations.pathmorphing}
%\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{decorations.shapes}
%\usetikzlibrary{decorations.markings}
%\usetikzlibrary{decorations.text}
%\usetikzlibrary{positioning,automata,shadows}
%\usetikzlibrary{patterns}
\usetikzlibrary{quotes,arrows.meta}
%\usetikzlibrary{shapes.symbols}

\usepackage{fontawesome5}

\begin{document}

\begin{tikzpicture}
    % Draw the horizontal line
    \draw[dashed] (-1.5, 0) -- (9, 0);

    % Draw the slopes
    \draw[thick] (0, 0) -- (2.5,1.25);
    \draw[thick] (5.5, 1.25) -- (7.5,0);

    % Draw the vertical dashed lines
    \draw[dashed] (2.5, 0) -- (2.5,1.25);
    \draw[dashed] (5.5, 0) -- (5.5,1.25);

    % Labels for points
    \node at (0, -0.2) {A};
    \node at (2.5, 1.5) {B};
    \node at (2.5, -0.3) {I};
    \node at (5.5, 1.5) {C};
    \node at (5.5, -0.3) {J};
    \node at (7.5, -0.3) {D};

    % Vectors
    \draw[->] (2.5,0) -- (3,0) node[below] {$\overrightarrow{i}$};
    \draw[->] (2.5,0) -- (2.5,0.5) node[left] {$\overrightarrow{j}$};

    % Angle
    \coordinate[label=below:] (A) at (2.5,1.25);
    \coordinate[label=above right:] (B) at (0,0);
    \coordinate[label=above right:] (C) at (2.5,0);
    \draw pic [draw,-,"$\alpha$",angle radius=12pt,angle eccentricity=1.5] {angle = C--B--A};

    \path (A) -- (B) node[midway, sloped, above, inner sep=0pt] {\Large\faSkiingNordic};

\end{tikzpicture}

\end{document}
1

is it possible to reproduce this schema with tikzpicture ?

Yes, as you've seen already. Here is a way to do it via my SVG suggestion C)

Now, this one is simple, as it has been asked and answered before specifically for a skier, AND exhaustively for SVG to Tikz, see e.g. herein.

(For sake of completeness and for not getting lost inside comments I put this as a separate solution approach.)

1

is it possible to reproduce this schema with tikzpicture ?

Yes, as you've seen already. Here is a way to do it via my answer in comment A)

1. Get an image

So I found an uphill skier on a sign. Cur it out, filled white with black, deleted background to make it transparent. Saved as skierimg.png :

skier

BTW, it's no big deal to redraw such a line art with some drawing tool or TikZ.

2. Adjusting your code

  • using package graphicx
  • calling the image inside a \node
  • and yes, you could rotate it a few degrees via node or includeimage ...

enter image description here

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{graphicx}


    %%\documentclass{article}
\usepackage{tikz}%,pgf}
%\usepackage{pgfplots}
%\usetikzlibrary{calc,angles}
\usetikzlibrary{angles}
%\usetikzlibrary{arrows}
%\usetikzlibrary{calendar}
%\usetikzlibrary{through}
%\usetikzlibrary{intersections}
%\usetikzlibrary{shapes,decorations}
%\usetikzlibrary{decorations.pathmorphing}
%\usetikzlibrary{decorations.pathreplacing}
%\usetikzlibrary{decorations.shapes}
%\usetikzlibrary{decorations.markings}
%\usetikzlibrary{decorations.text}
%\usetikzlibrary{positioning,automata,shadows}
%\usetikzlibrary{patterns}
\usetikzlibrary{quotes,arrows.meta}
%\usetikzlibrary{shapes.symbols}

\begin{document}

\begin{tikzpicture}
    % Draw the horizontal line
    \draw[dashed] (-1.5, 0) -- (9, 0);

    % Draw the slopes
    \draw[thick] (0, 0) -- (2.5,1.25);
    \draw[thick] (5.5, 1.25) -- (7.5,0);

    % Draw the vertical dashed lines
    \draw[dashed] (2.5, 0) -- (2.5,1.25);
    \draw[dashed] (5.5, 0) -- (5.5,1.25);

    % Labels for points
    \node at (0, -0.2) {A};
    \node at (2.5, 1.5) {B};
    \node at (2.5, -0.3) {I};
    \node at (5.5, 1.5) {C};
    \node at (5.5, -0.3) {J};
    \node at (7.5, -0.3) {D};

    % Vectors
    \draw[->] (2.5,0) -- (3,0) node[below] {$\overrightarrow{i}$};
    \draw[->] (2.5,0) -- (2.5,0.5) node[left] {$\overrightarrow{j}$};

    % Angle
    \coordinate[label=below:] (A) at (2.5,1.25);
    \coordinate[label=above right:] (B) at (0,0);
    \coordinate[label=above right:] (C) at (2.5,0);
    \draw pic [draw,-,"$\alpha$",angle radius=12pt,angle eccentricity=1.5] {angle = C--B--A};

    % Skier on the slope
%    \draw[thick] (1.25, 0.625) circle (0.15); % Head
%    \draw[thick] (1.25, 0.625) -- (1.25, 0.1); % Body
%    \draw[thick] (1.25, 0.4) -- (1.1, 0.3); % Left arm
%    \draw[thick] (1.25, 0.4) -- (1.4, 0.3); % Right arm
%    \draw[thick] (1.25, 0.1) -- (1.1, 0); % Left leg
%    \draw[thick] (1.25, 0.1) -- (1.4, 0); % Right leg

    \node at (1,.9) {\includegraphics[width=1cm]{skierimg.png}};

\end{tikzpicture}

\end{document}
1

is it possible to reproduce this schema with tikzpicture ?

Yes, as you've seen already. Here is a way to do it via my scribble suggestion B)

1. Scribble the skier uphill

I did what I wrote: sketched it with pen on paper. Though I could have scanned it, I just recreated it as a bitmap, with focus on upslope and relevant posture, and with mouse jitter, without smoothing:

scribble

2. Converting it to TikZ

It's a bit tricky, as pixel coordinates increase to the right AND downwards, while TikZ uses mathematical conventions (to the right AND upwards). To simplify my work I:

  • mirrored the image at the horizon (so it's upside down)
  • read pixel coordinates with the mouse cursor (e.g. 109/227px) and simply divided by 100 (1.1/2.3cm) for TikZ

Now you have a tikzle as a kind of line art ...

  • to reuse certain coordinates I put (A) and (C) for hip and head
  • and a variable shoulder coordinate at (B)

tikzle

\documentclass[10pt,border=3mm,tikz]{standalone}


\begin{document}
 % ~~~ sketch copy: inverted bmp, px/100 ~~~~~~~
 \begin{tikzpicture}[
    sh/.style={pos=.7,inner sep=0},
    hd/.style={draw,fill=black,circle,
               inner sep=0,minimum size=1mm},
 ]
    % ~~~ skies ~~~~~~~
    \draw (  0,  0) -- (2.3,1.3);
    \draw (0.5,0.5) -- (2.3,1.9);
 
    % ~~~ feet + legs ~~~
    \draw (1.3,0.9) -- (1.1,0.8) -- 
          (1.3,1.4) -- (1.3, 1.9) coordinate(A);
    \draw (1.7,1.5) -- (1.4,1.3) -- (A);
 
    % ~~~ spine ~~~~~~~~
    \draw (A) -- node[sh] (B) {} (2,2.8) coordinate (C);
    
    % ~~~ arms+sticks ~~~~
    \draw (B) -- (3.2,2.5) -- (2.6,1.1);
    \draw (B) -- (2.8,2.7) -- (2.1,2);
    
    % ~~~ head ~~~~~~~
    \node[hd] at (C) {}; 
 \end{tikzpicture}
\end{document}

3. Where to go from here?

Many options. E.g. you could:

  • put the code inside a \pic, so you can place myrades of skiers
  • parametrize it more, e.g. assign each absolute coordinate to \coordinate, so you can manipulate it easier
  • impact on line widths, perhaps even schange its line style with decorate or so (though that's more limited than from using brushes in raster-drawings)
  • introduce caps or tips at line ends
  • turn straight lines into bends, e.g. by replacing some -- with to[out=,in=]
  • ... the sky's the limit, not the skier ;-)

EXAMPLE:

curved

    % ~~~ spine ~~~~~~~~
    \draw (A) to[out=70,in=190] node[sh] (B) {} (2,2.8) coordinate (C);
    
    % ~~~ arms+sticks ~~~~
    \draw (B) to[out=2,in=130] (3.2,2.5) -- (2.6,1.1);
    \draw (B) to[out=2,in=130] (2.8,2.7) -- (2.1,2);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .