0

There are a lot of node shapes provided in the shape library, but I didn't find any chamfered triangles, as the picture shows below. Are there any libraries that provide such shape? Or how to define a new node shape in tikz? Yes it's possible to draw it as pic rather than a node, but it seems that the pic is not as convenient as node in drawing diagrams using tikz.

chamfered triangle

2
  • Welcome to TeX.SE!
    – Zarko
    Sep 17 at 9:12
  • Isn't any convex quadrilateral that's not a parallelogram a chamfered triangle? How is that chamfered triangle defined? Declaring a new node shape isn't easy. It's also a mathematical problem: Usually, node shapes are defined in such a way that its border does not cross the node's text. So you need to fit a rectangle of given dimensions (node text + inner sep) inside a triangle and then you take something from this triangle away. That could lead to text overlapping the shape's border. Maybe we start with a rectangle and just move the corners individually? Sep 17 at 12:13

1 Answer 1

1
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,calc}
\newcommand{\ChamferTriangleNode}[1]{
\node[shape=trapezium,trapezium left angle=75](n1){#1};
\draw (n1.bottom right corner) -- ($(n1.bottom right corner)!1.2!(n1.top right corner)$)
-- (n1.top left corner) -- (n1.bottom left corner) -- cycle;
}
\begin{document}
\begin{tikzpicture}
\ChamferTriangleNode{sample}
\end{tikzpicture}
\end{document}

chamfer triangle node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.