Bei dem beigefügten Minimalbeispiel reicht der Pfeil nicht bis an die Umrandung des nodes. Ich gehe davon aus, dass es dafür eine Einstellung o. Ä. gibt, aber ich finde sie derzeit nicht. Könnt Ihr mir weiterhelfen? Open in Online-Editor
\documentclass{scrartcl} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node[rectangle,draw,rounded corners=5pt,minimum width=5cm] (A) {foo}; \draw[arrows=->] ($(A)+(-5,-1)$) -- (A.south west); \end{tikzpicture} \end{document} |
Ich habe die Lösung von Sašo Živanović (2012) genommen und noch die zusätzlichen Anker Open in Online-Editor
\documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \makeatletter % https://tex.stackexchange.com/questions/1357/ \pgfkeys{/pgf/.cd, rectangle corner radius/.initial=3pt } \newif\ifpgf@rectanglewrc@donecorner@ \def\pgf@rectanglewithroundedcorners@docorner#1#2#3#4{% \edef\pgf@marshal{% \noexpand\pgfintersectionofpaths {% \noexpand\pgfpathmoveto{\noexpand\pgfpoint{\the\pgf@xa}{\the\pgf@ya}}% \noexpand\pgfpathlineto{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% }% {% \noexpand\pgfpathmoveto{\noexpand\pgfpointadd {\noexpand\pgfpoint{\the\pgf@xc}{\the\pgf@yc}}% {\noexpand\pgfpoint{#1}{#2}}}% \noexpand\pgfpatharc{#3}{#4}{\cornerradius}% }% }% \pgf@process{\pgf@marshal\pgfpointintersectionsolution{1}}% \pgf@process{\pgftransforminvert\pgfpointtransformed{}}% \pgf@rectanglewrc@donecorner@true } \pgfdeclareshape{rectangle with rounded corners} { \inheritsavedanchors[from=rectangle] % this is nearly a rectangle \inheritanchor[from=rectangle]{north} \inheritanchor[from=rectangle]{north west} \inheritanchor[from=rectangle]{north east} \inheritanchor[from=rectangle]{center} \inheritanchor[from=rectangle]{west} \inheritanchor[from=rectangle]{east} \inheritanchor[from=rectangle]{mid} \inheritanchor[from=rectangle]{mid west} \inheritanchor[from=rectangle]{mid east} \inheritanchor[from=rectangle]{base} \inheritanchor[from=rectangle]{base west} \inheritanchor[from=rectangle]{base east} \inheritanchor[from=rectangle]{south} \inheritanchor[from=rectangle]{south west} \inheritanchor[from=rectangle]{south east} \savedmacro\cornerradius{% \edef\cornerradius{\pgfkeysvalueof{/pgf/rectangle corner radius}}% } \backgroundpath{% \northeast\advance\pgf@y-\cornerradius\relax \pgfpathmoveto{}% \pgfpatharc{0}{90}{\cornerradius}% \northeast\pgf@ya=\pgf@y\southwest\advance\pgf@x\cornerradius\relax\pgf@y=\pgf@ya \pgfpathlineto{}% \pgfpatharc{90}{180}{\cornerradius}% \southwest\advance\pgf@y\cornerradius\relax \pgfpathlineto{}% \pgfpatharc{180}{270}{\cornerradius}% \northeast\pgf@xa=\pgf@x\advance\pgf@xa-\cornerradius\southwest\pgf@x=\pgf@xa \pgfpathlineto{}% \pgfpatharc{270}{360}{\cornerradius}% \northeast\advance\pgf@y-\cornerradius\relax \pgfpathlineto{}% } \anchor{south west}{% \southwest \pgfmathparse{\cornerradius*(1-1/sqrt(2))} \advance\pgf@x\pgfmathresult pt \advance\pgf@y\pgfmathresult pt} \anchor{north east}{% \northeast \pgfmathparse{\cornerradius*(1-1/sqrt(2))} \advance\pgf@x-\pgfmathresult pt \advance\pgf@y-\pgfmathresult pt} \anchor{north west}{% \southwest\pgf@xa=\pgf@x \northeast\pgf@x=\pgf@xa \pgfmathparse{\cornerradius*(1-1/sqrt(2))} \advance\pgf@x\pgfmathresult pt \advance\pgf@y-\pgfmathresult pt} \anchor{south east}{% \southwest\pgf@ya=\pgf@y \northeast\pgf@y=\pgf@ya \pgfmathparse{\cornerradius*(1-1/sqrt(2))} \advance\pgf@x-\pgfmathresult pt \advance\pgf@y\pgfmathresult pt} \anchor{before north east}{\northeast\advance\pgf@y-\cornerradius} \anchor{after north east}{\northeast\advance\pgf@x-\cornerradius} \anchor{before north west}{\southwest\pgf@xa=\pgf@x\advance\pgf@xa\cornerradius \northeast\pgf@x=\pgf@xa} \anchor{after north west}{\northeast\pgf@ya=\pgf@y\advance\pgf@ya-\cornerradius \southwest\pgf@y=\pgf@ya} \anchor{before south west}{\southwest\advance\pgf@y\cornerradius} \anchor{after south west}{\southwest\advance\pgf@x\cornerradius} \anchor{before south east}{\northeast\pgf@xa=\pgf@x\advance\pgf@xa-\cornerradius \southwest\pgf@x=\pgf@xa} \anchor{after south east}{\southwest\pgf@ya=\pgf@y\advance\pgf@ya\cornerradius \northeast\pgf@y=\pgf@ya} \anchorborder{% \pgf@xb=\pgf@x% xb/yb is target \pgf@yb=\pgf@y% \southwest% \pgf@xa=\pgf@x% xa/ya is se \pgf@ya=\pgf@y% \northeast% \advance\pgf@x by-\pgf@xa% \advance\pgf@y by-\pgf@ya% \pgf@xc=.5\pgf@x% x/y is half width/height \pgf@yc=.5\pgf@y% \advance\pgf@xa by\pgf@xc% xa/ya becomes center \advance\pgf@ya by\pgf@yc% \edef\pgf@marshal{% \noexpand\pgfpointborderrectangle {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}} {\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% }% \pgf@process{\pgf@marshal}% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% \pgfextract@process\borderpoint{}% % \pgf@rectanglewrc@donecorner@false % % do southwest corner \southwest\pgf@xc=\pgf@x\pgf@yc=\pgf@y \advance\pgf@xc\cornerradius\relax\advance\pgf@yc\cornerradius\relax \borderpoint \ifdim\pgf@x<\pgf@xc\relax\ifdim\pgf@y<\pgf@yc\relax \pgf@rectanglewithroundedcorners@docorner{-\cornerradius}{0pt}{180}{270}% \fi\fi % % do southeast corner \ifpgf@rectanglewrc@donecorner@\else \southwest\pgf@yc=\pgf@y\relax\northeast\pgf@xc=\pgf@x\relax \advance\pgf@xc-\cornerradius\relax\advance\pgf@yc\cornerradius\relax \borderpoint \ifdim\pgf@x>\pgf@xc\relax\ifdim\pgf@y<\pgf@yc\relax \pgf@rectanglewithroundedcorners@docorner{0pt}{-\cornerradius}{270}{360}% \fi\fi \fi % % do northeast corner \ifpgf@rectanglewrc@donecorner@\else \northeast\pgf@xc=\pgf@x\relax\pgf@yc=\pgf@y\relax \advance\pgf@xc-\cornerradius\relax\advance\pgf@yc-\cornerradius\relax \borderpoint \ifdim\pgf@x>\pgf@xc\relax\ifdim\pgf@y>\pgf@yc\relax \pgf@rectanglewithroundedcorners@docorner{\cornerradius}{0pt}{0}{90}% \fi\fi \fi % % do northwest corner \ifpgf@rectanglewrc@donecorner@\else \northeast\pgf@yc=\pgf@y\relax\southwest\pgf@xc=\pgf@x\relax \advance\pgf@xc\cornerradius\relax\advance\pgf@yc-\cornerradius\relax \borderpoint \ifdim\pgf@x<\pgf@xc\relax\ifdim\pgf@y>\pgf@yc\relax \pgf@rectanglewithroundedcorners@docorner{0pt}{\cornerradius}{90}{180}% \fi\fi \fi } } \makeatother \begin{document} \begin{tikzpicture} \node[rectangle with rounded corners,draw,rectangle corner radius=5pt,minimum width=5cm] (A) {foo}; \draw[->] ($(A)+(-5,-1)$) -- (A.south west); \end{tikzpicture} \end{document} beantwortet 07 Jul '16, 14:49 Henri |
https://tex.stackexchange.com/questions/1357/rounded-corners-in-tikz-trees https://tex.stackexchange.com/questions/150545/line-arrow-to-node-with-rounded-corners
Willkommen auf TeXwelt!
@ Henri: Ich hatte zwar auf stackexchange gesucht, auch mit den richtigen Begriffen, bin aber leider trotzdem nicht auf diese Quellen gestoßen. Insbesondere 1357 kann als Lösung dieses Problems empfohlen werden.