Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass[preview]{standalone}
- usepackage{filecontents}
- usepackage{tikz}
- usetikzlibrary{decorations.markings}
- usetikzlibrary{intersections}
- begin{filecontents}{projection.tikz}
- % tangent: https://tex.stackexchange.com/a/25940/74942
- % intersection: https://tex.stackexchange.com/a/58216/74942
- begin{tikzpicture}[
- tangent/.style={
- decoration={
- markings,% switch on markings
- 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);
- }
- },
- postaction=decorate
- },
- use tangent/.style={
- shift=(tangent point-#1),
- x=(tangent unit vector-#1),
- y=(tangent orthogonal unit vector-#1)
- },
- use tangent/.default=1
- ] % tangent
- draw[help lines,xstep=.5,ystep=.5] (0,0) grid (4,3); %grid
- draw [
- name path=curve,
- tangent=0.4
- ] (0,0)
- to [out=60,in=180] (2,2)
- to [out=0, in=160] (3,1.75)
- to [out=-20, in=-120] (4,3);
- draw [blue, name path=tangent, use tangent] (-1,0) -- (2,0)
- node[sloped,inner sep=0cm,below,pos=.8,
- anchor=north west,
- minimum height=1cm,
- minimum width=1cm](N){a};
- path [name path=proj] (N.north west)% intersection
- node (P) {b} -- (N.south west);
- draw [name intersections={of=curve and proj}, blue] (P.center)
- --
- (intersection-1);
- end{tikzpicture}
- end{filecontents}
- begin{document}
- input{./projection.tikz}
- end{document}
- documentclass[preview]{standalone}
- usepackage{filecontents}
- usepackage{tikz}
- usetikzlibrary{decorations.markings}
- usetikzlibrary{decorations.text}
- usetikzlibrary{intersections}
- begin{filecontents}{projection.tikz}
- % tangent: https://tex.stackexchange.com/a/25940/74942
- % intersection: https://tex.stackexchange.com/a/58216/74942
- % text along path: https://tex.stackexchange.com/a/22316/74942
- begin{tikzpicture}[
- tangent/.style={
- decoration={
- markings,% switch on markings
- 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);
- }
- },
- postaction=decorate
- },
- use tangent/.style={
- shift=(tangent point-#1),
- x=(tangent unit vector-#1),
- y=(tangent orthogonal unit vector-#1)
- },
- use tangent/.default=1
- ] % tangent
- draw[help lines,xstep=.5,ystep=.5] (0,0) grid (4,3); %grid
- defmyshift#1{raisebox{-2.5ex}} %text along path - height from line
- draw [
- name path=curve,
- tangent=0.4, % where tangent is set (percent of total curve)
- postaction={decorate,
- decoration={text along path,
- text align=center,
- text={|sffamilyfootnotesizemyshift| and maybe here too }
- }
- } %text command
- ] (0,0)
- to [out=60,in=180] (2,2)
- to [out=0, in=160] (3,1.75)
- to [out=-20, in=-120] (4,3);
- defmyshift#1{raisebox{1ex}} %text along path - height from line
- draw [blue,
- name path=tangent,
- use tangent,
- postaction={decorate,
- decoration={text along path,
- text align=center,
- text={|sffamilyfootnotesizemyshift| I want some text here }
- }
- } %text command
- ] (-1,0) -- (2,0)
- node[sloped,inner sep=0cm,below,pos=.8,
- anchor=north west,
- minimum height=1cm,
- minimum width=1cm](N){a};
- path [name path=proj] (N.north west)% intersection
- node (P) {b} -- (N.south west);
- draw [ name intersections={of=curve and proj},
- blue,
- postaction={decorate,
- decoration={text along path,
- text align=center,
- text={|sffamilytinymyshift| and here }
- }
- } %text command
- ] (P.center)
- --
- (intersection-1);
- end{tikzpicture}
- end{filecontents}
- begin{document}
- input{./projection.tikz}
- end{document}
Add Comment
Please, Sign In to add comment