Seite 1 von 1
Tikz: Viereck mit umgeknickter Ecke
Verfasst: Do 25. Sep 2014, 13:23
von sonada
Hi,
ich möchte gerne wie oben beschrieben ein Viereck malen. Dies soll aber an der linken oberen Ecke gefaltet sein, so dass die Spitze nach innen zeigt.
Rechtecke habe ich bisher mit so gezeichnet:
\node[rectangle, draw] (A) at (0,0) {Rechteck}
Kann mir jemand beschreiben, was ich da tun muss?
Vielen Dank schonmal.
Verfasst: Do 25. Sep 2014, 14:42
von esdd
Soll das sich das Ergebnis der Größe des Inhalts anpassen, also dem Text "Rechteck"? Oder möchtest Du eine Zeichnung mit bestimmten Abmessungen?
Gruß
Elke
Verfasst: Do 25. Sep 2014, 15:21
von sonada
Wenn sich das noch dem Inhalt anpasst wäre das super.

Verfasst: Fr 26. Sep 2014, 14:55
von esdd
Hier ist ein Vorschlag, bei dem ich eigentlich nur ein Beispiel aus dem
pgfmanual etwas angepasst habe:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\makeatletter
\pgfdeclareshape{document}{
\inheritsavedanchors[from=rectangle] % this is nearly a rectangle
\inheritanchorborder[from=rectangle]
\foreach \a in {%
center,mid,base,north,south,west,east,%
north west,mid west,base west,south west,%
north east,mid east,base east,south east%
}{\inheritanchor[from=rectangle]{\a}}
\backgroundpath{% this is new
%store lower right in xa/ya and upper right in xb/yb
\southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
\northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
%compute corner of ``flipped page''
\pgf@xc=\pgf@xa \advance\pgf@xc by 5pt% this should be a parameter
\pgf@yc=\pgf@yb \advance\pgf@yc by-5pt
%construct main path
\pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
\pgfpathclose
%add little corner
\pgfpathmoveto{\pgfpoint{\pgf@xc}{\pgf@yb}}
\pgfpathlineto{\pgfpoint{\pgf@xc}{\pgf@yc}}
\pgfpathlineto{\pgfpoint{\pgf@xa}{\pgf@yc}}
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\node[document,
draw,
shade,top color=orange!80,
inner sep=6pt
]{Remark};
\end{tikzpicture}
\end{document}
Verfasst: So 28. Sep 2014, 19:45
von sonada
Cool, danke.
Verfasst: Mo 29. Sep 2014, 10:00
von Besserwisser
Wenn damit deine Frage beantwortet ist, solltest du den Status entsprechend setzen. Ist sie nicht beantwortet, solltest du sie ggf. präzisieren, damit man weiß, was dir noch fehlt.