problem with theorem, tikzpicture and center environment












4















I use a dialog-bubble style for some theorems, by using the code below, that works fine.



documentclass[a4paper,11pt,twoside]{book}
usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
usepackage{amsthm}

usepackage{environ}

usepackage{tikz}
usetikzlibrary{shapes,snakes} % Για φάνσι κουτακια

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]

NewEnviron{dialogtheo}[1]{
begin{tikzpicture}
node [BoxDialog] (boxtheo){%
begin{minipage}{0.9textwidth}
BODY
end{minipage}
};
node[TitlTheo] at (boxtheo.north) {textbf{#1}};
end{tikzpicture}
}

begin{document}

begin{dialogtheo}{title theorem}
begin{theo}
theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
end{theo}
end{dialogtheo}

end{document}


enter image description here



But when I wrap center environment around the dialogtheo environment like this:



NewEnviron{dialogtheo}[1]{
begin{center}
begin{tikzpicture}
node [BoxDialog] (boxtheo){%
begin{minipage}{0.9textwidth}
BODY
end{minipage}
};
node[TitlTheo] at (boxtheo.north) {textbf{#1}};
end{tikzpicture}
end{center}
}


I have this error report:




! LaTeX Error: Something's wrong--perhaps a
missing item.




This is the log-file.



What is the problem?



P.S.: If I ceep center environment, but I delete theo, everything is OK again.










share|improve this question



























    4















    I use a dialog-bubble style for some theorems, by using the code below, that works fine.



    documentclass[a4paper,11pt,twoside]{book}
    usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
    usepackage{amsthm}

    usepackage{environ}

    usepackage{tikz}
    usetikzlibrary{shapes,snakes} % Για φάνσι κουτακια

    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]

    NewEnviron{dialogtheo}[1]{
    begin{tikzpicture}
    node [BoxDialog] (boxtheo){%
    begin{minipage}{0.9textwidth}
    BODY
    end{minipage}
    };
    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
    end{tikzpicture}
    }

    begin{document}

    begin{dialogtheo}{title theorem}
    begin{theo}
    theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
    end{theo}
    end{dialogtheo}

    end{document}


    enter image description here



    But when I wrap center environment around the dialogtheo environment like this:



    NewEnviron{dialogtheo}[1]{
    begin{center}
    begin{tikzpicture}
    node [BoxDialog] (boxtheo){%
    begin{minipage}{0.9textwidth}
    BODY
    end{minipage}
    };
    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
    end{tikzpicture}
    end{center}
    }


    I have this error report:




    ! LaTeX Error: Something's wrong--perhaps a
    missing item.




    This is the log-file.



    What is the problem?



    P.S.: If I ceep center environment, but I delete theo, everything is OK again.










    share|improve this question

























      4












      4








      4








      I use a dialog-bubble style for some theorems, by using the code below, that works fine.



      documentclass[a4paper,11pt,twoside]{book}
      usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
      usepackage{amsthm}

      usepackage{environ}

      usepackage{tikz}
      usetikzlibrary{shapes,snakes} % Για φάνσι κουτακια

      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]

      NewEnviron{dialogtheo}[1]{
      begin{tikzpicture}
      node [BoxDialog] (boxtheo){%
      begin{minipage}{0.9textwidth}
      BODY
      end{minipage}
      };
      node[TitlTheo] at (boxtheo.north) {textbf{#1}};
      end{tikzpicture}
      }

      begin{document}

      begin{dialogtheo}{title theorem}
      begin{theo}
      theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
      end{theo}
      end{dialogtheo}

      end{document}


      enter image description here



      But when I wrap center environment around the dialogtheo environment like this:



      NewEnviron{dialogtheo}[1]{
      begin{center}
      begin{tikzpicture}
      node [BoxDialog] (boxtheo){%
      begin{minipage}{0.9textwidth}
      BODY
      end{minipage}
      };
      node[TitlTheo] at (boxtheo.north) {textbf{#1}};
      end{tikzpicture}
      end{center}
      }


      I have this error report:




      ! LaTeX Error: Something's wrong--perhaps a
      missing item.




      This is the log-file.



      What is the problem?



      P.S.: If I ceep center environment, but I delete theo, everything is OK again.










      share|improve this question














      I use a dialog-bubble style for some theorems, by using the code below, that works fine.



      documentclass[a4paper,11pt,twoside]{book}
      usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
      usepackage{amsthm}

      usepackage{environ}

      usepackage{tikz}
      usetikzlibrary{shapes,snakes} % Για φάνσι κουτακια

      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]

      NewEnviron{dialogtheo}[1]{
      begin{tikzpicture}
      node [BoxDialog] (boxtheo){%
      begin{minipage}{0.9textwidth}
      BODY
      end{minipage}
      };
      node[TitlTheo] at (boxtheo.north) {textbf{#1}};
      end{tikzpicture}
      }

      begin{document}

      begin{dialogtheo}{title theorem}
      begin{theo}
      theorem theorem theorem theorem theorem theorem theorem theorem theorem theorem
      end{theo}
      end{dialogtheo}

      end{document}


      enter image description here



      But when I wrap center environment around the dialogtheo environment like this:



      NewEnviron{dialogtheo}[1]{
      begin{center}
      begin{tikzpicture}
      node [BoxDialog] (boxtheo){%
      begin{minipage}{0.9textwidth}
      BODY
      end{minipage}
      };
      node[TitlTheo] at (boxtheo.north) {textbf{#1}};
      end{tikzpicture}
      end{center}
      }


      I have this error report:




      ! LaTeX Error: Something's wrong--perhaps a
      missing item.




      This is the log-file.



      What is the problem?



      P.S.: If I ceep center environment, but I delete theo, everything is OK again.







      tikz-pgf theorems center






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Kώστας ΚούδαςKώστας Κούδας

      38217




      38217






















          2 Answers
          2






          active

          oldest

          votes


















          4














          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.9textwidth}
          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.






          share|improve this answer










          New contributor




          KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




























            3














            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]{
            saveboxtheobox{hbox{
            begin{tikzpicture}
            node [BoxDialog] (boxtheo){%
            begin{minipage}{0.6textwidth}
            BODY
            end{minipage}
            };
            node[TitlTheo] at (boxtheo.north) {textbf{#1}};
            end{tikzpicture}}}
            setlengththeoidentlength{dimexpr(textwidth-wdtheobox)/2relax}
            noindenthspace*{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}


            enter image description here



            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.






            share|improve this answer


























            • I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

              – Kώστας Κούδας
              2 days ago













            • Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

              – koleygr
              2 days ago













            • Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

              – Kώστας Κούδας
              2 days ago











            • No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

              – koleygr
              2 days ago














            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481640%2fproblem-with-theorem-tikzpicture-and-center-environment%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4














            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.9textwidth}
            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.






            share|improve this answer










            New contributor




            KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              4














              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.9textwidth}
              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.






              share|improve this answer










              New contributor




              KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                4












                4








                4







                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.9textwidth}
                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.






                share|improve this answer










                New contributor




                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                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.9textwidth}
                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.







                share|improve this answer










                New contributor




                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer








                edited 2 days ago





















                New contributor




                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 2 days ago









                KersouManKersouMan

                1365




                1365




                New contributor




                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                KersouMan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                    3














                    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]{
                    saveboxtheobox{hbox{
                    begin{tikzpicture}
                    node [BoxDialog] (boxtheo){%
                    begin{minipage}{0.6textwidth}
                    BODY
                    end{minipage}
                    };
                    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
                    end{tikzpicture}}}
                    setlengththeoidentlength{dimexpr(textwidth-wdtheobox)/2relax}
                    noindenthspace*{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}


                    enter image description here



                    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.






                    share|improve this answer


























                    • I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                      – Kώστας Κούδας
                      2 days ago













                    • Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                      – koleygr
                      2 days ago













                    • Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                      – Kώστας Κούδας
                      2 days ago











                    • No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                      – koleygr
                      2 days ago


















                    3














                    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]{
                    saveboxtheobox{hbox{
                    begin{tikzpicture}
                    node [BoxDialog] (boxtheo){%
                    begin{minipage}{0.6textwidth}
                    BODY
                    end{minipage}
                    };
                    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
                    end{tikzpicture}}}
                    setlengththeoidentlength{dimexpr(textwidth-wdtheobox)/2relax}
                    noindenthspace*{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}


                    enter image description here



                    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.






                    share|improve this answer


























                    • I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                      – Kώστας Κούδας
                      2 days ago













                    • Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                      – koleygr
                      2 days ago













                    • Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                      – Kώστας Κούδας
                      2 days ago











                    • No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                      – koleygr
                      2 days ago
















                    3












                    3








                    3







                    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]{
                    saveboxtheobox{hbox{
                    begin{tikzpicture}
                    node [BoxDialog] (boxtheo){%
                    begin{minipage}{0.6textwidth}
                    BODY
                    end{minipage}
                    };
                    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
                    end{tikzpicture}}}
                    setlengththeoidentlength{dimexpr(textwidth-wdtheobox)/2relax}
                    noindenthspace*{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}


                    enter image description here



                    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.






                    share|improve this answer















                    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]{
                    saveboxtheobox{hbox{
                    begin{tikzpicture}
                    node [BoxDialog] (boxtheo){%
                    begin{minipage}{0.6textwidth}
                    BODY
                    end{minipage}
                    };
                    node[TitlTheo] at (boxtheo.north) {textbf{#1}};
                    end{tikzpicture}}}
                    setlengththeoidentlength{dimexpr(textwidth-wdtheobox)/2relax}
                    noindenthspace*{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}


                    enter image description here



                    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.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 2 days ago

























                    answered 2 days ago









                    koleygrkoleygr

                    13.3k11039




                    13.3k11039













                    • I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                      – Kώστας Κούδας
                      2 days ago













                    • Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                      – koleygr
                      2 days ago













                    • Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                      – Kώστας Κούδας
                      2 days ago











                    • No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                      – koleygr
                      2 days ago





















                    • I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                      – Kώστας Κούδας
                      2 days ago













                    • Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                      – koleygr
                      2 days ago













                    • Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                      – Kώστας Κούδας
                      2 days ago











                    • No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                      – koleygr
                      2 days ago



















                    I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                    – Kώστας Κούδας
                    2 days ago







                    I don't agree with you about theorems problem with centering. If I wrap around BODY the command begin{center}Somethingend{center}, like this: begin{center}Somethingend{center}BODYbegin{center}Somethingend{center}, then there is no problem with centering the dialog and the theorem.

                    – Kώστας Κούδας
                    2 days ago















                    Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                    – koleygr
                    2 days ago







                    Γεια σου @ΚώσταςΚούδας (:Hi) : check the edit to see what I mean because possibly I didn't understood your goal or/and you didn't understood what I tried to do.

                    – koleygr
                    2 days ago















                    Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                    – Kώστας Κούδας
                    2 days ago





                    Καλημέρα, @koleygr ! I thought that you meant that if I put a theorem in a center environment, I 'll have errors. So I understand your proposition!

                    – Kώστας Κούδας
                    2 days ago













                    No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                    – koleygr
                    2 days ago







                    No, as you see, it will not give errors, but will just use all the available text width. Something like begin{center} begin{minipage}{0.5textwidth} begin{theo} test end{theo} end{minipage} end{center} would center anyway... My proposal is just a more general approach that could help in similar problems. (Just adding for its idea.) Have a nice day. PS: Replace the library snakes with decorations as your compiler is suggesting.

                    – koleygr
                    2 days ago




















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481640%2fproblem-with-theorem-tikzpicture-and-center-environment%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    數位音樂下載

                    When can things happen in Etherscan, such as the picture below?

                    格利澤436b