Tikz: Viereck mit umgeknickter Ecke

Tabellen und Grafiken erstellen und anordnen


sonada
Forum-Anfänger
Forum-Anfänger
Beiträge: 10
Registriert: Di 10. Jul 2012, 18:17

Tikz: Viereck mit umgeknickter Ecke

Beitrag 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.
Interpunktion und Orthographie dieses Beitrages sind frei erfunden.
Eine Übereinstimmung mit aktuellen oder ehemaligen Regeln wäre rein zufällig und ist nicht beabsichtigt.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag 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

sonada
Forum-Anfänger
Forum-Anfänger
Beiträge: 10
Registriert: Di 10. Jul 2012, 18:17

Beitrag von sonada »

Wenn sich das noch dem Inhalt anpasst wäre das super. :)

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag 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}

sonada
Forum-Anfänger
Forum-Anfänger
Beiträge: 10
Registriert: Di 10. Jul 2012, 18:17

Beitrag von sonada »

Cool, danke.
Interpunktion und Orthographie dieses Beitrages sind frei erfunden.
Eine Übereinstimmung mit aktuellen oder ehemaligen Regeln wäre rein zufällig und ist nicht beabsichtigt.

Besserwisser

Beitrag 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.

Antworten