Line breaks in theorem heads are removed by showkeys package












2















There are a couple of other questions [1|2] about theorem heads not wrapping properly. I've run across another situation where this happens:



documentclass{article}

usepackage{amsthm}
usepackage{showkeys}

newtheorem{theorem}{Theorem}

begin{document}

begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.]
label{Thm1}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
end{theorem}

end{document}


With either usepackage{showkeys} or label{Thm1} commented out, this produces the expected output, with the theorem head ("Lorem …") wrapped across multiple lines. With both present, the whole head is placed on the same line, and wrapping starts only at the first space in the theorem body:



Image of output document



My main purpose is to record this observation, to save someone else the half hour or so it took me to narrow down the problem. But I do also have a question: Is there any way to work around this, other than just ignoring it? I find the showkeys package very useful, but this (apparent) bug reduces that by changing the layout of the output document.










share|improve this question



























    2















    There are a couple of other questions [1|2] about theorem heads not wrapping properly. I've run across another situation where this happens:



    documentclass{article}

    usepackage{amsthm}
    usepackage{showkeys}

    newtheorem{theorem}{Theorem}

    begin{document}

    begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.]
    label{Thm1}
    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    end{theorem}

    end{document}


    With either usepackage{showkeys} or label{Thm1} commented out, this produces the expected output, with the theorem head ("Lorem …") wrapped across multiple lines. With both present, the whole head is placed on the same line, and wrapping starts only at the first space in the theorem body:



    Image of output document



    My main purpose is to record this observation, to save someone else the half hour or so it took me to narrow down the problem. But I do also have a question: Is there any way to work around this, other than just ignoring it? I find the showkeys package very useful, but this (apparent) bug reduces that by changing the layout of the output document.










    share|improve this question

























      2












      2








      2








      There are a couple of other questions [1|2] about theorem heads not wrapping properly. I've run across another situation where this happens:



      documentclass{article}

      usepackage{amsthm}
      usepackage{showkeys}

      newtheorem{theorem}{Theorem}

      begin{document}

      begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.]
      label{Thm1}
      Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      end{theorem}

      end{document}


      With either usepackage{showkeys} or label{Thm1} commented out, this produces the expected output, with the theorem head ("Lorem …") wrapped across multiple lines. With both present, the whole head is placed on the same line, and wrapping starts only at the first space in the theorem body:



      Image of output document



      My main purpose is to record this observation, to save someone else the half hour or so it took me to narrow down the problem. But I do also have a question: Is there any way to work around this, other than just ignoring it? I find the showkeys package very useful, but this (apparent) bug reduces that by changing the layout of the output document.










      share|improve this question














      There are a couple of other questions [1|2] about theorem heads not wrapping properly. I've run across another situation where this happens:



      documentclass{article}

      usepackage{amsthm}
      usepackage{showkeys}

      newtheorem{theorem}{Theorem}

      begin{document}

      begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.]
      label{Thm1}
      Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      end{theorem}

      end{document}


      With either usepackage{showkeys} or label{Thm1} commented out, this produces the expected output, with the theorem head ("Lorem …") wrapped across multiple lines. With both present, the whole head is placed on the same line, and wrapping starts only at the first space in the theorem body:



      Image of output document



      My main purpose is to record this observation, to save someone else the half hour or so it took me to narrow down the problem. But I do also have a question: Is there any way to work around this, other than just ignoring it? I find the showkeys package very useful, but this (apparent) bug reduces that by changing the layout of the output document.







      line-breaking theorems showkeys






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 1 at 11:33









      Stephen PowellStephen Powell

      1255




      1255






















          1 Answer
          1






          active

          oldest

          votes


















          5














          Putting the label at the start of a paragraph is always slightly tricky (latex has to work quite hard to make that not change the spacing normally, and that interacts with showkeys somewhat badly.....)



          Putting the label more or less anywhere else is better (perhaps showkeys could catch this case and do better, but not today)



          enter image description here



          documentclass{article}

          usepackage{amsthm}
          usepackage{showkeys}

          newtheorem{theorem}{Theorem}

          begin{document}

          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          label{Thm1}]
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          ]
          mbox{}label{Thm2}Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          zzz ref{Thm1} zzz ref{Thm2}
          end{document}





          share|improve this answer


























          • Wow, that was fast. Thanks. (I'll accept shortly.)

            – Stephen Powell
            Feb 1 at 11:50











          • @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

            – Circumscribe
            Feb 1 at 12:13













          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%2f472858%2fline-breaks-in-theorem-heads-are-removed-by-showkeys-package%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5














          Putting the label at the start of a paragraph is always slightly tricky (latex has to work quite hard to make that not change the spacing normally, and that interacts with showkeys somewhat badly.....)



          Putting the label more or less anywhere else is better (perhaps showkeys could catch this case and do better, but not today)



          enter image description here



          documentclass{article}

          usepackage{amsthm}
          usepackage{showkeys}

          newtheorem{theorem}{Theorem}

          begin{document}

          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          label{Thm1}]
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          ]
          mbox{}label{Thm2}Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          zzz ref{Thm1} zzz ref{Thm2}
          end{document}





          share|improve this answer


























          • Wow, that was fast. Thanks. (I'll accept shortly.)

            – Stephen Powell
            Feb 1 at 11:50











          • @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

            – Circumscribe
            Feb 1 at 12:13


















          5














          Putting the label at the start of a paragraph is always slightly tricky (latex has to work quite hard to make that not change the spacing normally, and that interacts with showkeys somewhat badly.....)



          Putting the label more or less anywhere else is better (perhaps showkeys could catch this case and do better, but not today)



          enter image description here



          documentclass{article}

          usepackage{amsthm}
          usepackage{showkeys}

          newtheorem{theorem}{Theorem}

          begin{document}

          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          label{Thm1}]
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          ]
          mbox{}label{Thm2}Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          zzz ref{Thm1} zzz ref{Thm2}
          end{document}





          share|improve this answer


























          • Wow, that was fast. Thanks. (I'll accept shortly.)

            – Stephen Powell
            Feb 1 at 11:50











          • @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

            – Circumscribe
            Feb 1 at 12:13
















          5












          5








          5







          Putting the label at the start of a paragraph is always slightly tricky (latex has to work quite hard to make that not change the spacing normally, and that interacts with showkeys somewhat badly.....)



          Putting the label more or less anywhere else is better (perhaps showkeys could catch this case and do better, but not today)



          enter image description here



          documentclass{article}

          usepackage{amsthm}
          usepackage{showkeys}

          newtheorem{theorem}{Theorem}

          begin{document}

          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          label{Thm1}]
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          ]
          mbox{}label{Thm2}Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          zzz ref{Thm1} zzz ref{Thm2}
          end{document}





          share|improve this answer















          Putting the label at the start of a paragraph is always slightly tricky (latex has to work quite hard to make that not change the spacing normally, and that interacts with showkeys somewhat badly.....)



          Putting the label more or less anywhere else is better (perhaps showkeys could catch this case and do better, but not today)



          enter image description here



          documentclass{article}

          usepackage{amsthm}
          usepackage{showkeys}

          newtheorem{theorem}{Theorem}

          begin{document}

          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          label{Thm1}]
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          begin{theorem}[Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.%
          ]
          mbox{}label{Thm2}Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          end{theorem}


          zzz ref{Thm1} zzz ref{Thm2}
          end{document}






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 1 at 11:51

























          answered Feb 1 at 11:41









          David CarlisleDavid Carlisle

          494k4111381886




          494k4111381886













          • Wow, that was fast. Thanks. (I'll accept shortly.)

            – Stephen Powell
            Feb 1 at 11:50











          • @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

            – Circumscribe
            Feb 1 at 12:13





















          • Wow, that was fast. Thanks. (I'll accept shortly.)

            – Stephen Powell
            Feb 1 at 11:50











          • @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

            – Circumscribe
            Feb 1 at 12:13



















          Wow, that was fast. Thanks. (I'll accept shortly.)

          – Stephen Powell
          Feb 1 at 11:50





          Wow, that was fast. Thanks. (I'll accept shortly.)

          – Stephen Powell
          Feb 1 at 11:50













          @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

          – Circumscribe
          Feb 1 at 12:13







          @StephenPowell: You could also insert either noindent or leavevmode just before label{…}. That will fix the problem by starting the paragraph before the label, but you'll have to remember to this every time…

          – Circumscribe
          Feb 1 at 12:13




















          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%2f472858%2fline-breaks-in-theorem-heads-are-removed-by-showkeys-package%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

          Human spaceflight

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          File:DeusFollowingSea.jpg