2

I am trying to add a label on the top of the rectangle with an \overbrace and the letter 'q' on top of it. I am not able to achieve this. Help is appreciated. Thank you.

\usetikzlibrary {shapes.multipart, positioning}
\begin{tikzpicture}[
  queue/.style={rectangle split, rectangle split horizontal,rectangle split draw splits = false,rectangle split part fill = {green!100,#1} , rectangle split parts=3, draw, anchor=center, minimum height = 0.5cm}]

\node[minimum width=4.5cm, queue = {orange!90, blue!30}, label=north: {$\overbrace{}^q$}](queue1) {\nodepart[text width=3.3cm, align=center]{one} \nodepart[text width=0.5cm, align=center]{two} $e_1$ \nodepart[text width=0.7cm, align=center]{three}$p_1$};
\end{tikzpicture} 
1
  • 1
    Welcome to TeX.SE. Commented Nov 11, 2024 at 6:49

1 Answer 1

5

You could use calligraphic brace from calligraphy library with decoration from decorations.pathreplacing:

\documentclass[border=1cm,tikz]{standalone}
\usetikzlibrary {shapes.multipart, positioning}
\usetikzlibrary{decorations.pathreplacing, calligraphy}
\begin{document}
\begin{tikzpicture}[
  queue/.style={rectangle split, rectangle split horizontal,rectangle split draw splits = false,rectangle split part fill = {green!100,#1} , rectangle split parts=3, draw, anchor=center, minimum height = 0.5cm}]

  \node[minimum width=4.5cm, queue = {orange!90, blue!30}] (queue1) {\nodepart[text width=3.3cm, align=center]{one} \nodepart[text width=0.5cm, align=center]{two} $e_1$ \nodepart[text width=0.7cm, align=center]{three}$p_1$};
  \draw[decorate, decoration={calligraphic brace, amplitude=8pt}]
    (queue1.north west) node[midway, above=11pt] {$^q$}  -- (queue1.north east);
\end{tikzpicture} 
\end{document}

Output

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.