I have very often a situation when I want that the center environment is glued to the preceding text, something like that:
Some text
%
\begin{center}
\begin{tikzpicture}
some commands
\end{tikzpicture}
\end{center}
Is it possible to make a general solution for that, for example defining new environment based on center or completely new environment to do the task?
Thanks for answers!

%by\nopagebreak– David Carlisle Jul 23 '18 at 10:07\nopagebreakdoes not work. – Pygmalion Jul 23 '18 at 10:19