Re: [dk-tug] tikz igen
Lars Madsen <[email protected]>
| Newsgroups | gmane.comp.tex.danish |
|---|---|
| Message-ID | <[email protected]> |
On 2011-09-28 10:41, Martin Heller wrote:
> Lars Madsen wrote, on 27-09-2011 22:34:
>> Nogen ideer?
>
> \documentclass{article}
> \usepackage{tikz}
> \newlength\roundedcornerradius
> \pgfkeys{%
> /rounded corner
> rectangle/radius/.code=\pgfmathsetlength{\roundedcornerradius}{#1},
> /rounded corner rectangle/radius=5pt
> }
> \makeatletter
> \pgfdeclareshape{rounded corner rectangle}{%
> \inheritsavedanchors[from=rectangle] % this is nearly a rectangle
> \inheritanchorborder[from=rectangle]
> \foreach \anchor in {center,north west,north,north east,east,south
> east,south,south west,west} {%
> \inheritanchor[from=rectangle]{\anchor}
> }%
> \backgroundpath{%
> \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
> \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
> \pgf@xc=\pgf@xb \advance\pgf@xc by-\roundedcornerradius
> \pgf@yc=\pgf@yb \advance\pgf@yc by-\roundedcornerradius
> \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
> \pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yb}}
> \pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
> \pgfpatharc{90}{0}{\roundedcornerradius}
> \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
> \pgfpathclose
> }%
> }%
> \makeatother
>
> \begin{document}
>
> \begin{tikzpicture}[every node/.style=draw]
> \node[rounded corner rectangle] (x) {Test};
> \node[%
> rounded corner rectangle,below=1cm,
> /rounded corner rectangle/radius=10pt
> ] (y) at (x.south) {Test};
> \end{tikzpicture}
>
> \end{document}
>
Det var meget nyttigt.
Du bør altså holde et foredrag om tikz på et tidspunkt.
/daleif