Centering ornaments from `pgfornaments` around a theorem environment?











up vote
2
down vote

favorite












Here is my minimal code:



documentclass[12pt,letterpaper]{article}

usepackage{lmodern}
usepackage[T1]{fontenc}
usepackage{amsmath}
usepackage{amsthm}
usepackage{pgfornament}

newtheorem{thm}{Theorem}

newcommand*{centeredornament}{begin{center}pgfornament{88}end{center}}
newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

begin{document}
begin{theorem}[This is a sentence. ]
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
end{theorem}

end{document}


It produces the following as output:



enter image description here



The black portions mark the width of the page. See how the ornaments are shifted to the right, rather than actually being "centered" on the page width? How can I fix this?










share|improve this question


























    up vote
    2
    down vote

    favorite












    Here is my minimal code:



    documentclass[12pt,letterpaper]{article}

    usepackage{lmodern}
    usepackage[T1]{fontenc}
    usepackage{amsmath}
    usepackage{amsthm}
    usepackage{pgfornament}

    newtheorem{thm}{Theorem}

    newcommand*{centeredornament}{begin{center}pgfornament{88}end{center}}
    newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

    begin{document}
    begin{theorem}[This is a sentence. ]
    This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
    end{theorem}

    end{document}


    It produces the following as output:



    enter image description here



    The black portions mark the width of the page. See how the ornaments are shifted to the right, rather than actually being "centered" on the page width? How can I fix this?










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Here is my minimal code:



      documentclass[12pt,letterpaper]{article}

      usepackage{lmodern}
      usepackage[T1]{fontenc}
      usepackage{amsmath}
      usepackage{amsthm}
      usepackage{pgfornament}

      newtheorem{thm}{Theorem}

      newcommand*{centeredornament}{begin{center}pgfornament{88}end{center}}
      newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

      begin{document}
      begin{theorem}[This is a sentence. ]
      This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
      end{theorem}

      end{document}


      It produces the following as output:



      enter image description here



      The black portions mark the width of the page. See how the ornaments are shifted to the right, rather than actually being "centered" on the page width? How can I fix this?










      share|improve this question













      Here is my minimal code:



      documentclass[12pt,letterpaper]{article}

      usepackage{lmodern}
      usepackage[T1]{fontenc}
      usepackage{amsmath}
      usepackage{amsthm}
      usepackage{pgfornament}

      newtheorem{thm}{Theorem}

      newcommand*{centeredornament}{begin{center}pgfornament{88}end{center}}
      newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

      begin{document}
      begin{theorem}[This is a sentence. ]
      This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
      end{theorem}

      end{document}


      It produces the following as output:



      enter image description here



      The black portions mark the width of the page. See how the ornaments are shifted to the right, rather than actually being "centered" on the page width? How can I fix this?







      horizontal-alignment amsthm pgfornament






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      user89

      1,5122931




      1,5122931






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          You should add option [width=13cm] to your used command pgfornament like



          pgfornament[width=13cm]{88}


          Without this width the ornament is to long to fit into the textwidth of your text.



          You can use



          usepackage{showframe}


          to visualize the typing area and margins.



          With the complete MWE



          documentclass[12pt,letterpaper]{article}

          usepackage{showframe} % <==============================================
          usepackage{lmodern}
          usepackage[T1]{fontenc}
          usepackage{amsmath}
          usepackage{amsthm}
          usepackage{pgfornament}

          newtheorem{thm}{Theorem}

          newcommand*{centeredornament}{begin{center}pgfornament[width=13cm]{88}end{center}} % 88
          newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

          begin{document}
          begin{theorem}[This is a sentence. ]
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence. This is a sentence. This is a sentence.
          This is a sentence. This is a sentence. This is a sentence. This is a
          sentence. This is a sentence.
          end{theorem}

          end{document}


          you get this result:



          enter image description here



          Without [width=13cm] you get the following result (see the ornament line reaching the margin):



          enter image description here






          share|improve this answer




























            up vote
            2
            down vote













            Your ornaments are actually stretching beyond the margins, as the overfull vbox warnings your code issues, tell you.



            enter image description here



            So, you could set things up better with a makebox also taking care of indent with:



            newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}


            The [width=1.1textwidth] for the ornament is there to deliberately have it a little larger than textwidth (but centered), as it seems to be your intent. But you can set this value as you please, of course.



            In full:



            documentclass[12pt,letterpaper]{article}

            usepackage{lmodern}
            usepackage[T1]{fontenc}
            usepackage{amsmath}
            usepackage{amsthm}
            usepackage{pgfornament}
            usepackage{showframe}

            newtheorem{thm}{Theorem}

            newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}

            newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}vspace{-1ex}centeredornament}

            begin{document}

            begin{theorem}[This is a sentence. ]
            This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
            end{theorem}

            end{document}


            enter image description here






            share|improve this answer























              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',
              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%2f462891%2fcentering-ornaments-from-pgfornaments-around-a-theorem-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








              up vote
              2
              down vote



              accepted










              You should add option [width=13cm] to your used command pgfornament like



              pgfornament[width=13cm]{88}


              Without this width the ornament is to long to fit into the textwidth of your text.



              You can use



              usepackage{showframe}


              to visualize the typing area and margins.



              With the complete MWE



              documentclass[12pt,letterpaper]{article}

              usepackage{showframe} % <==============================================
              usepackage{lmodern}
              usepackage[T1]{fontenc}
              usepackage{amsmath}
              usepackage{amsthm}
              usepackage{pgfornament}

              newtheorem{thm}{Theorem}

              newcommand*{centeredornament}{begin{center}pgfornament[width=13cm]{88}end{center}} % 88
              newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

              begin{document}
              begin{theorem}[This is a sentence. ]
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence. This is a sentence. This is a sentence.
              This is a sentence. This is a sentence. This is a sentence. This is a
              sentence. This is a sentence.
              end{theorem}

              end{document}


              you get this result:



              enter image description here



              Without [width=13cm] you get the following result (see the ornament line reaching the margin):



              enter image description here






              share|improve this answer

























                up vote
                2
                down vote



                accepted










                You should add option [width=13cm] to your used command pgfornament like



                pgfornament[width=13cm]{88}


                Without this width the ornament is to long to fit into the textwidth of your text.



                You can use



                usepackage{showframe}


                to visualize the typing area and margins.



                With the complete MWE



                documentclass[12pt,letterpaper]{article}

                usepackage{showframe} % <==============================================
                usepackage{lmodern}
                usepackage[T1]{fontenc}
                usepackage{amsmath}
                usepackage{amsthm}
                usepackage{pgfornament}

                newtheorem{thm}{Theorem}

                newcommand*{centeredornament}{begin{center}pgfornament[width=13cm]{88}end{center}} % 88
                newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

                begin{document}
                begin{theorem}[This is a sentence. ]
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence. This is a sentence. This is a sentence.
                This is a sentence. This is a sentence. This is a sentence. This is a
                sentence. This is a sentence.
                end{theorem}

                end{document}


                you get this result:



                enter image description here



                Without [width=13cm] you get the following result (see the ornament line reaching the margin):



                enter image description here






                share|improve this answer























                  up vote
                  2
                  down vote



                  accepted







                  up vote
                  2
                  down vote



                  accepted






                  You should add option [width=13cm] to your used command pgfornament like



                  pgfornament[width=13cm]{88}


                  Without this width the ornament is to long to fit into the textwidth of your text.



                  You can use



                  usepackage{showframe}


                  to visualize the typing area and margins.



                  With the complete MWE



                  documentclass[12pt,letterpaper]{article}

                  usepackage{showframe} % <==============================================
                  usepackage{lmodern}
                  usepackage[T1]{fontenc}
                  usepackage{amsmath}
                  usepackage{amsthm}
                  usepackage{pgfornament}

                  newtheorem{thm}{Theorem}

                  newcommand*{centeredornament}{begin{center}pgfornament[width=13cm]{88}end{center}} % 88
                  newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

                  begin{document}
                  begin{theorem}[This is a sentence. ]
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence.
                  end{theorem}

                  end{document}


                  you get this result:



                  enter image description here



                  Without [width=13cm] you get the following result (see the ornament line reaching the margin):



                  enter image description here






                  share|improve this answer












                  You should add option [width=13cm] to your used command pgfornament like



                  pgfornament[width=13cm]{88}


                  Without this width the ornament is to long to fit into the textwidth of your text.



                  You can use



                  usepackage{showframe}


                  to visualize the typing area and margins.



                  With the complete MWE



                  documentclass[12pt,letterpaper]{article}

                  usepackage{showframe} % <==============================================
                  usepackage{lmodern}
                  usepackage[T1]{fontenc}
                  usepackage{amsmath}
                  usepackage{amsthm}
                  usepackage{pgfornament}

                  newtheorem{thm}{Theorem}

                  newcommand*{centeredornament}{begin{center}pgfornament[width=13cm]{88}end{center}} % 88
                  newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}centeredornament}

                  begin{document}
                  begin{theorem}[This is a sentence. ]
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence. This is a sentence. This is a sentence.
                  This is a sentence. This is a sentence. This is a sentence. This is a
                  sentence. This is a sentence.
                  end{theorem}

                  end{document}


                  you get this result:



                  enter image description here



                  Without [width=13cm] you get the following result (see the ornament line reaching the margin):



                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 hours ago









                  Kurt

                  34.2k846157




                  34.2k846157






















                      up vote
                      2
                      down vote













                      Your ornaments are actually stretching beyond the margins, as the overfull vbox warnings your code issues, tell you.



                      enter image description here



                      So, you could set things up better with a makebox also taking care of indent with:



                      newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}


                      The [width=1.1textwidth] for the ornament is there to deliberately have it a little larger than textwidth (but centered), as it seems to be your intent. But you can set this value as you please, of course.



                      In full:



                      documentclass[12pt,letterpaper]{article}

                      usepackage{lmodern}
                      usepackage[T1]{fontenc}
                      usepackage{amsmath}
                      usepackage{amsthm}
                      usepackage{pgfornament}
                      usepackage{showframe}

                      newtheorem{thm}{Theorem}

                      newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}

                      newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}vspace{-1ex}centeredornament}

                      begin{document}

                      begin{theorem}[This is a sentence. ]
                      This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
                      end{theorem}

                      end{document}


                      enter image description here






                      share|improve this answer



























                        up vote
                        2
                        down vote













                        Your ornaments are actually stretching beyond the margins, as the overfull vbox warnings your code issues, tell you.



                        enter image description here



                        So, you could set things up better with a makebox also taking care of indent with:



                        newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}


                        The [width=1.1textwidth] for the ornament is there to deliberately have it a little larger than textwidth (but centered), as it seems to be your intent. But you can set this value as you please, of course.



                        In full:



                        documentclass[12pt,letterpaper]{article}

                        usepackage{lmodern}
                        usepackage[T1]{fontenc}
                        usepackage{amsmath}
                        usepackage{amsthm}
                        usepackage{pgfornament}
                        usepackage{showframe}

                        newtheorem{thm}{Theorem}

                        newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}

                        newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}vspace{-1ex}centeredornament}

                        begin{document}

                        begin{theorem}[This is a sentence. ]
                        This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
                        end{theorem}

                        end{document}


                        enter image description here






                        share|improve this answer

























                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          Your ornaments are actually stretching beyond the margins, as the overfull vbox warnings your code issues, tell you.



                          enter image description here



                          So, you could set things up better with a makebox also taking care of indent with:



                          newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}


                          The [width=1.1textwidth] for the ornament is there to deliberately have it a little larger than textwidth (but centered), as it seems to be your intent. But you can set this value as you please, of course.



                          In full:



                          documentclass[12pt,letterpaper]{article}

                          usepackage{lmodern}
                          usepackage[T1]{fontenc}
                          usepackage{amsmath}
                          usepackage{amsthm}
                          usepackage{pgfornament}
                          usepackage{showframe}

                          newtheorem{thm}{Theorem}

                          newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}

                          newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}vspace{-1ex}centeredornament}

                          begin{document}

                          begin{theorem}[This is a sentence. ]
                          This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
                          end{theorem}

                          end{document}


                          enter image description here






                          share|improve this answer














                          Your ornaments are actually stretching beyond the margins, as the overfull vbox warnings your code issues, tell you.



                          enter image description here



                          So, you could set things up better with a makebox also taking care of indent with:



                          newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}


                          The [width=1.1textwidth] for the ornament is there to deliberately have it a little larger than textwidth (but centered), as it seems to be your intent. But you can set this value as you please, of course.



                          In full:



                          documentclass[12pt,letterpaper]{article}

                          usepackage{lmodern}
                          usepackage[T1]{fontenc}
                          usepackage{amsmath}
                          usepackage{amsthm}
                          usepackage{pgfornament}
                          usepackage{showframe}

                          newtheorem{thm}{Theorem}

                          newcommand*{centeredornament}{noindentmakebox[textwidth][c]{pgfornament[width=1.1textwidth]{88}}}

                          newenvironment{theorem}[1]{centeredornamentbegin{thm}[#1]upshape}{end{thm}vspace{-1ex}centeredornament}

                          begin{document}

                          begin{theorem}[This is a sentence. ]
                          This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
                          end{theorem}

                          end{document}


                          enter image description here







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 2 hours ago

























                          answered 2 hours ago









                          gusbrs

                          6,3192838




                          6,3192838






























                              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.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • 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%2f462891%2fcentering-ornaments-from-pgfornaments-around-a-theorem-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

                              Eastern Orthodox Church

                              Zagreb

                              Understanding the information contained in the Deep Space Network XML data?