Why \vspace{-\lineskip} removes space after tikz picture although it stands before the picture?

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.


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}

enter image description here

Tags:

Spacing

Vspace