problem with theorem, tikzpicture and center environment
If you try to place a theorem inside center
environment, you will realize that it doesn't work.
Edit: I mean that the code:
\begin{center}
\begin{theo}
test
\end{theo}
\end{center}
would result to a non-centered theorem.
So, my solution is a "hack" that just indenting your environment as much as needed:
\documentclass[a4paper,11pt,twoside]{book}
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{amsthm}
\usepackage{lipsum}
\usepackage{environ}
\usepackage{tikz}
\usetikzlibrary{shapes,decorations} % Για φάνσι κουτακια
\theoremstyle{plain}
\newtheorem{theo}{Sometheorem}[chapter]
\tikzstyle{BoxDialog} = [draw=black, fill=white, very thick,
rectangle callout, rounded corners, densely dashed,callout relative pointer={(-0.4cm,-0.4cm)}, inner sep=4pt, inner ysep=8pt]
\tikzstyle{TitlTheo} =[fill=white, text=black]
\newsavebox{\theobox}
\newlength{\theoidentlength}
\NewEnviron{dialogtheo}[1]{
\savebox\theobox{\hbox{
\begin{tikzpicture}
\node [BoxDialog] (boxtheo){%
\begin{minipage}{0.6\textwidth}
\BODY
\end{minipage}
};
\node[TitlTheo] at (boxtheo.north) {\textbf{#1}};
\end{tikzpicture}}}
\setlength\theoidentlength{\dimexpr(\textwidth-\wd\theobox)/2\relax}
\noindent\hspace*{\theoidentlength}\usebox{\theobox}
}
\begin{document}
\lipsum[1]
\begin{dialogtheo}{title theorem}
\begin{theo}
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
\end{theo}
\end{dialogtheo}
\end{document}
PS: My solution is just an alternative [that I think could be useful in many cases if centering fails], and just added as such (an alternative) approach.
If your goal is to center the dialog bubble, instead of using the center
environment, you should try to use \centering
with a \par
at the end of the content of your environment:
\NewEnviron{dialogtheo}[1]{
\centering
\begin{tikzpicture}
\node[BoxDialog] (boxtheo){
\begin{minipage}{0.9\textwidth}
\BODY
\end{minipage}
};
\node[TitlTheo] at (boxtheo.north) {\textbf{#1}};
\end{tikzpicture}\par
}
The \par
is important, else the bubble will not be centered at all.