Tikz - create rectangle with same width as the pictureRotate a node but not its content: the case of the...
Specify the range of GridLines
Why did Europeans not widely domesticate foxes?
Retract an already submitted Recommendation Letter (written for an undergrad student)
Protagonist's race is hidden - should I reveal it?
Are these square matrices always diagonalisable?
How to translate "red flag" into Spanish?
Married in secret, can marital status in passport be changed at a later date?
Eigenvalues of the Laplacian of the directed De Bruijn graph
When does Bran Stark remember Jamie pushing him?
Can gravitational waves pass through a black hole?
How to keep bees out of canned beverages?
Simulate round-robin tournament draw
Will I lose my paid in full property
Was there ever a LEGO store in Miami International Airport?
Processing ADC conversion result: DMA vs Processor Registers
Has a Nobel Peace laureate ever been accused of war crimes?
`FindRoot [ ]`::jsing: Encountered a singular Jacobian at a point...WHY
Will I be more secure with my own router behind my ISP's router?
Coin Game with infinite paradox
Israeli soda type drink
Writing a T-SQL stored procedure to receive 4 numbers and insert them into a table
When speaking, how do you change your mind mid-sentence?
How would you suggest I follow up with coworkers about our deadline that's today?
What happened to Viserion in Season 7?
Tikz - create rectangle with same width as the picture
Rotate a node but not its content: the case of the ellipse decorationMake tikzpicture white on blackUML StatediagramHow to define the default vertical distance between nodes?Numerical conditional within tikz keys?Problems with nested TikZpicturesTikZ diagram, placement of nodes, dotted lineHow to align node anchors on text?The TikZ pipeline: A path's 'draw' option has no effect on a 'behind path' nodeTIKZ Matrix nodes filled with colour afterwards and set to background
I have the following MWE:
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=of header1.west, anchor=west] (text1) {Short text};
node[below=of header2.west, anchor=west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east)] {};
end{pgfonlayer}
end{tikzpicture}
end{document}
which produces this: 
However, in addition, I would like to create a rectangle as background for HeaderOne and HeaderTwo, which also spans the width of the entire picture, a bit like this (please ignore the bad painting around the text itself; it should be drawn on the background layer):

I have tried using 'background top' from the pgf manual in conjunction with 'background rectangle', but this does not look good when you want to have drawn a black line (border) around everything as well (the border does not fit the entire picture then).
Thanks.
tikz-pgf backgrounds
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
|
I have the following MWE:
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=of header1.west, anchor=west] (text1) {Short text};
node[below=of header2.west, anchor=west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east)] {};
end{pgfonlayer}
end{tikzpicture}
end{document}
which produces this: 
However, in addition, I would like to create a rectangle as background for HeaderOne and HeaderTwo, which also spans the width of the entire picture, a bit like this (please ignore the bad painting around the text itself; it should be drawn on the background layer):

I have tried using 'background top' from the pgf manual in conjunction with 'background rectangle', but this does not look good when you want to have drawn a black line (border) around everything as well (the border does not fit the entire picture then).
Thanks.
tikz-pgf backgrounds
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Why don't you just use a table for that?
– JouleV
12 hours ago
1
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago
|
I have the following MWE:
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=of header1.west, anchor=west] (text1) {Short text};
node[below=of header2.west, anchor=west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east)] {};
end{pgfonlayer}
end{tikzpicture}
end{document}
which produces this: 
However, in addition, I would like to create a rectangle as background for HeaderOne and HeaderTwo, which also spans the width of the entire picture, a bit like this (please ignore the bad painting around the text itself; it should be drawn on the background layer):

I have tried using 'background top' from the pgf manual in conjunction with 'background rectangle', but this does not look good when you want to have drawn a black line (border) around everything as well (the border does not fit the entire picture then).
Thanks.
tikz-pgf backgrounds
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have the following MWE:
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=of header1.west, anchor=west] (text1) {Short text};
node[below=of header2.west, anchor=west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east)] {};
end{pgfonlayer}
end{tikzpicture}
end{document}
which produces this: 
However, in addition, I would like to create a rectangle as background for HeaderOne and HeaderTwo, which also spans the width of the entire picture, a bit like this (please ignore the bad painting around the text itself; it should be drawn on the background layer):

I have tried using 'background top' from the pgf manual in conjunction with 'background rectangle', but this does not look good when you want to have drawn a black line (border) around everything as well (the border does not fit the entire picture then).
Thanks.
tikz-pgf backgrounds
tikz-pgf backgrounds
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 12 hours ago
PS.PS.
162
162
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
PS. is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Why don't you just use a table for that?
– JouleV
12 hours ago
1
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago
|
Why don't you just use a table for that?
– JouleV
12 hours ago
1
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago
Why don't you just use a table for that?
– JouleV
12 hours ago
Why don't you just use a table for that?
– JouleV
12 hours ago
1
1
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago
|
2 Answers
2
active
oldest
votes
Just add another fit node and do not forget inner sep=0pt.
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}[every node/.style={minimum height=5ex}]
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=0pt of header1.south west, anchor=north west] (text1) {Short text};
node[below=0pt of header2.south west, anchor=north west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east), inner sep=0pt] {};
node [fill=red, draw=black, fit=(header1)(header2)(current bounding box.north east), inner sep=0pt] {};
end{pgfonlayer}
end{tikzpicture}
end{document}

@JouleV That depends onbelow of, I'll improve soon.
– CarLaTeX
12 hours ago
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
|
Why don't use a simple table for that?
documentclass[margin=3]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
renewcommand{arraystretch}{1.5}
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}
end{document}

If you want to use this table inside a TikZ picture, simply place it inside a node.
documentclass[margin=3,tikz]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
tikznode{renewcommand{arraystretch}{1.5}%
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}};
end{document}
With pure TikZ it is also not that complicated. No need of PGF layers. However, I don't recommend this way.
documentclass[margin=3,tikz]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[node distance=0pt,inner sep=7pt]
node[text width=3cm,font=largecolor{white},fill=red] (header1) {HeaderOne};
node[text width=3cm,below=of header1,fill=gray!20] (text1) {Short text};
node[text width=13cm,font=largecolor{white},fill=red,right=-pgflinewidth of header1] (header2) {HeaderTwo};
node[text width=13cm,below=of header2,fill=gray!20] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
draw (header1.north west) -- (header2.north east)
(header1.south west) -- (header2.south east)
(text1.south west) -- (text2.south east);
end{tikzpicture}
end{document}

|
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just add another fit node and do not forget inner sep=0pt.
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}[every node/.style={minimum height=5ex}]
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=0pt of header1.south west, anchor=north west] (text1) {Short text};
node[below=0pt of header2.south west, anchor=north west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east), inner sep=0pt] {};
node [fill=red, draw=black, fit=(header1)(header2)(current bounding box.north east), inner sep=0pt] {};
end{pgfonlayer}
end{tikzpicture}
end{document}

@JouleV That depends onbelow of, I'll improve soon.
– CarLaTeX
12 hours ago
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
|
Just add another fit node and do not forget inner sep=0pt.
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}[every node/.style={minimum height=5ex}]
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=0pt of header1.south west, anchor=north west] (text1) {Short text};
node[below=0pt of header2.south west, anchor=north west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east), inner sep=0pt] {};
node [fill=red, draw=black, fit=(header1)(header2)(current bounding box.north east), inner sep=0pt] {};
end{pgfonlayer}
end{tikzpicture}
end{document}

@JouleV That depends onbelow of, I'll improve soon.
– CarLaTeX
12 hours ago
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
|
Just add another fit node and do not forget inner sep=0pt.
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}[every node/.style={minimum height=5ex}]
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=0pt of header1.south west, anchor=north west] (text1) {Short text};
node[below=0pt of header2.south west, anchor=north west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east), inner sep=0pt] {};
node [fill=red, draw=black, fit=(header1)(header2)(current bounding box.north east), inner sep=0pt] {};
end{pgfonlayer}
end{tikzpicture}
end{document}

Just add another fit node and do not forget inner sep=0pt.
documentclass[]{standalone}
usepackage{tikz}
usetikzlibrary{positioning,fit,shapes.geometric,calc,backgrounds}
begin{document}
begin{tikzpicture}[every node/.style={minimum height=5ex}]
% Headers
node (header1) {large HeaderOne};
node[right=of header1] (header2) {large HeaderTwo};
% Text
node[below=0pt of header1.south west, anchor=north west] (text1) {Short text};
node[below=0pt of header2.south west, anchor=north west] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
% Background
begin{pgfonlayer}{background}
node [fill=gray!20, draw=black, fit=(current bounding box.north west) (current bounding box.south east), inner sep=0pt] {};
node [fill=red, draw=black, fit=(header1)(header2)(current bounding box.north east), inner sep=0pt] {};
end{pgfonlayer}
end{tikzpicture}
end{document}

edited 11 hours ago
answered 12 hours ago
CarLaTeXCarLaTeX
35.6k555153
35.6k555153
@JouleV That depends onbelow of, I'll improve soon.
– CarLaTeX
12 hours ago
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
|
@JouleV That depends onbelow of, I'll improve soon.
– CarLaTeX
12 hours ago
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
@JouleV That depends on
below of, I'll improve soon.– CarLaTeX
12 hours ago
@JouleV That depends on
below of, I'll improve soon.– CarLaTeX
12 hours ago
1
1
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@JouleV Yes, that's also a good solution, see my now.
– CarLaTeX
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@CarLaTeX: Thanks for your solution - exactly what I needed.
– PS.
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
@PS. You're welcome! Thank you for accepting my answer!
– CarLaTeX
11 hours ago
|
Why don't use a simple table for that?
documentclass[margin=3]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
renewcommand{arraystretch}{1.5}
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}
end{document}

If you want to use this table inside a TikZ picture, simply place it inside a node.
documentclass[margin=3,tikz]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
tikznode{renewcommand{arraystretch}{1.5}%
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}};
end{document}
With pure TikZ it is also not that complicated. No need of PGF layers. However, I don't recommend this way.
documentclass[margin=3,tikz]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[node distance=0pt,inner sep=7pt]
node[text width=3cm,font=largecolor{white},fill=red] (header1) {HeaderOne};
node[text width=3cm,below=of header1,fill=gray!20] (text1) {Short text};
node[text width=13cm,font=largecolor{white},fill=red,right=-pgflinewidth of header1] (header2) {HeaderTwo};
node[text width=13cm,below=of header2,fill=gray!20] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
draw (header1.north west) -- (header2.north east)
(header1.south west) -- (header2.south east)
(text1.south west) -- (text2.south east);
end{tikzpicture}
end{document}

|
Why don't use a simple table for that?
documentclass[margin=3]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
renewcommand{arraystretch}{1.5}
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}
end{document}

If you want to use this table inside a TikZ picture, simply place it inside a node.
documentclass[margin=3,tikz]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
tikznode{renewcommand{arraystretch}{1.5}%
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}};
end{document}
With pure TikZ it is also not that complicated. No need of PGF layers. However, I don't recommend this way.
documentclass[margin=3,tikz]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[node distance=0pt,inner sep=7pt]
node[text width=3cm,font=largecolor{white},fill=red] (header1) {HeaderOne};
node[text width=3cm,below=of header1,fill=gray!20] (text1) {Short text};
node[text width=13cm,font=largecolor{white},fill=red,right=-pgflinewidth of header1] (header2) {HeaderTwo};
node[text width=13cm,below=of header2,fill=gray!20] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
draw (header1.north west) -- (header2.north east)
(header1.south west) -- (header2.south east)
(text1.south west) -- (text2.south east);
end{tikzpicture}
end{document}

|
Why don't use a simple table for that?
documentclass[margin=3]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
renewcommand{arraystretch}{1.5}
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}
end{document}

If you want to use this table inside a TikZ picture, simply place it inside a node.
documentclass[margin=3,tikz]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
tikznode{renewcommand{arraystretch}{1.5}%
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}};
end{document}
With pure TikZ it is also not that complicated. No need of PGF layers. However, I don't recommend this way.
documentclass[margin=3,tikz]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[node distance=0pt,inner sep=7pt]
node[text width=3cm,font=largecolor{white},fill=red] (header1) {HeaderOne};
node[text width=3cm,below=of header1,fill=gray!20] (text1) {Short text};
node[text width=13cm,font=largecolor{white},fill=red,right=-pgflinewidth of header1] (header2) {HeaderTwo};
node[text width=13cm,below=of header2,fill=gray!20] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
draw (header1.north west) -- (header2.north east)
(header1.south west) -- (header2.south east)
(text1.south west) -- (text2.south east);
end{tikzpicture}
end{document}

Why don't use a simple table for that?
documentclass[margin=3]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
renewcommand{arraystretch}{1.5}
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}
end{document}

If you want to use this table inside a TikZ picture, simply place it inside a node.
documentclass[margin=3,tikz]{standalone}
usepackage{colortbl}
usepackage{xcolor}
begin{document}
tikznode{renewcommand{arraystretch}{1.5}%
begin{tabular}{ll}
hline
rowcolor{red}large HeaderOne & large HeaderTwo\hline
rowcolor{gray!20} Short text & A long line of text. A long line of text. A long line of text. A long line of text.\
hline
end{tabular}};
end{document}
With pure TikZ it is also not that complicated. No need of PGF layers. However, I don't recommend this way.
documentclass[margin=3,tikz]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}[node distance=0pt,inner sep=7pt]
node[text width=3cm,font=largecolor{white},fill=red] (header1) {HeaderOne};
node[text width=3cm,below=of header1,fill=gray!20] (text1) {Short text};
node[text width=13cm,font=largecolor{white},fill=red,right=-pgflinewidth of header1] (header2) {HeaderTwo};
node[text width=13cm,below=of header2,fill=gray!20] (text2) {A long line of text. A long line of text. A long line of text. A long line of text.};
draw (header1.north west) -- (header2.north east)
(header1.south west) -- (header2.south east)
(text1.south west) -- (text2.south east);
end{tikzpicture}
end{document}

edited 11 hours ago
answered 12 hours ago
JouleVJouleV
15.3k22667
15.3k22667
|
|
Why don't you just use a table for that?
– JouleV
12 hours ago
1
I have further elements in my actual tikz picture (i.e. code which is inherent to tikz, and would not fit into a table). Sorry I didnt mention that.
– PS.
12 hours ago
My suggestion is to make a table and place this table inside a node
– JouleV
12 hours ago