\documentclass[tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path node[inner sep=0,draw,text width=40mm]
{ \parbox{\hsize}
{ \parshape 4 0mm 40mm 5mm 35mm 10mm 30mm 15mm 25mm
\fboxrule0.1pt
\fboxsep0pt
\fbox{hello world}\newline
\fbox{hello world}\newline
\fbox{hello world}
\vspace{-\lineskip} % WHY AFTER THE PICTURE THAT FOLLOWS, NOT BEFORE?
\begin{tikzpicture}
\path node[draw,text width=24mm]
{ \parbox{\hsize}
{ \begin{gather*}
2+2=4
\end{gather*}
}
};
\end{tikzpicture}
}
};
\end{tikzpicture}
\end{document}
The third line is split because it doesn't fit. But every \vspace
material in a paragraph will be inserted after the line in which the command happens to fall (it uses \vadjust
).
Just add \newline
. And don't overcomplicate things.
\documentclass[border=2]{standalone}
\usepackage{amsmath}
\setlength{\fboxrule}{0.1pt}
\setlength{\fboxsep}{0pt}
\begin{document}
\fbox{%
\parbox{40mm}{
\parshape 4 0mm 40mm 5mm 35mm 10mm 30mm 15mm 25mm
\fbox{hello world}\newline
\fbox{hello world}\newline
\fbox{hello world}
\vspace{-\lineskip}\newline
\fbox{%
\parbox{24mm}{
\begin{gather*}
2+2=4
\end{gather*}
}%
}
}
}
\end{document}
It is unrelated to tikz, if you use \vspace
in horizontal mode it is inserted after linebreaking.
aaa\vspace{1cm}bbb
adds the space after bbb
You possibly wanted to have blank line before the \vspace
so that the space is added in vertical mode at the point it appears in the source.
\savebox
es to properly nesttikzpicture
s, see tex.stackexchange.com/q/47377/121799. – user121799 Jun 10 '19 at 18:31gather
here which is a vertical mode display environment, but you do not need\parbox
basically if you usetext width
on a node it is a parbox already (actually it is aminipage
but that is almost the same thing, mostly using the same code.) – David Carlisle Jun 10 '19 at 20:24\strut
in an earlier question – David Carlisle Jun 10 '19 at 23:36}
I get indented boxes when I added linebreaks to your code from the comment, not really tikz, you would get the same from any group. – David Carlisle Jun 12 '19 at 6:59