TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Thanks to this solution, I can draw tangent line to a path. I'd like to zoom a very little part of my drawing.

Here it is the code:

                                     mark=at position #1 with {\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
                                                               \coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
                                                               \coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);}},
         use tangent/.style={shift = (tangent point-#1),
                             x     = (tangent unit vector-#1),
                             y     =(tangent orthogonal unit vector-#1)},
         use tangent/.default = 1


\begin{tikzpicture}[>=angle 45,
                    spy scope = {connect spies,
                                 every spy on node/.style = {circle,draw},
                                 every spy in node/.style = {circle,draw},
                                 magnification            = 15}]

% Terrain parameters

% DRAW %
\coordinate[label=O] (O) at (0,0);

%-> Terrain points 
\coordinate (S1) at ($(O)+(\MaxDepPos,-\ErDepth)$);
\coordinate (S2) at ($(O)+(\SoilWidth,0)$);

%-> Terrain control points
\coordinate (SC1) at ($(O)+(\cdI,0)$);
\coordinate (SC2) at ($(S1)+(-\cdII,0)$);
\coordinate (SC3) at ($(S1)+(\cdIII,0)$);
\coordinate (SC4) at ($(S2)+(-\cdIV,0)$);
\draw[densely dashed] (O)--(S2);

%-> Erosion depth
\draw[tangent=0.1] (O) ..controls (SC1) and
                   (SC2)..(S1)..controls (SC3) and

%%%% PROBLEM HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\LineScale{.2}                                                                  %
\draw[use tangent,                                                                  %
      orange,                                                                       %
      line width= \LineScale*.4pt,                                                  %
      ->] (0,0)--(.1,0)                                                             %
          (0,0)coordinate(SlopedPoint)                                              %
          (0,-.1) -- (0,.1);                                                        %
\coordinate (SlopedPoint1) at (SlopedPoint|-O);                                     %
\draw[line width = \LineScale*.4pt,                                                 %
      decoration = {markings,                                                       %
                    mark=at position 0 with {\arrowreversed[scale=\LineScale]{>}};, %
                    mark=at position 1 with {\arrow[scale=\LineScale]{>}};},        %
      postaction = {decorate}](SlopedPoint1)--(SlopedPoint);                        %

\spy [red,
      height = 4cm,
      width  = 4cm] on ($(SlopedPoint1)!.57!(SlopedPoint)$) in node at (6,3);

      scale = .1] at($(SlopedPoint1)!.5!(SlopedPoint)$){$\delta$};

The problem I encounter is the arrow scaling. How it can be seen on the picture, the result is not so good.

Can somebody explain me how to scale only the line width and the arrows in a proper way?

With transformation canvas I obtain a total scaling, and it is not ok because it translate the lines.

share|improve this question
up vote 2 down vote accepted

I added the following code to solve my problem

\tikzset{arrow size/.code       = {\arrow@size=#1},
         arrow theta/.code      = \def\arrow@theta{#1},
         fd style/.style 2 args = {arrow size=#1,arrow theta = #2}}

\pgfsetdash{}{0pt} % do not dash
\pgfsetroundjoin % fix join
\pgfsetroundcap % fix cap

\draw[help lines] (-3,0)grid(3,15);

\foreach[count=\n] \lw/\l/\ang in {1pt/3pt/10,
\draw[line width=\lw,fd-fd,fd style={\l}{\ang}](-2,3*\n)--(2,3*\n);}

The result is the following

enter image description here

Let me know if you know a better solution.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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