I want to draw this kind of rectangle using tikzpicture
environment:
a
could change to b
, c
, d
, etc.
We should also be able to insert a new line.
If MWE is needed please let me know.
Thanks!
There are already folder symbols on the market that do something like this, e.g. here. That is, if you want to define a new shape, there are answers that give you good start. However, if you want to do it the quick and dirty way, you could do
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[fluffy with corner/.style={draw,inner ysep=3mm,inner
xsep=3mm,align=center,
path picture={
\draw ([xshift=3mm]path picture bounding box.north west)
-- ([yshift=-3mm]path picture bounding box.north west);
\node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east)
{#1};}},fluffy/.style={draw,inner ysep=3mm,inner xsep=3mm,align=center,
path picture={
\node[anchor=north east,inner sep=2pt] at (path picture bounding box.north east) {#1};}}]
\node[fluffy=b] at (0,0){text here};
\node[fluffy with corner=a] at (4,0){text here\\ second line\\ third line};
\end{tikzpicture}
\end{document}
tikzpicture
? What does the 'optional' bit mean? Nodes are rectangular by default and they adjust to the width of the text by default, so the only even slight complication seems to be placing the label in the corner. You need to use another node for that. At least, that'd be simplest.