Problem inserting C snippet











up vote
1
down vote

favorite












I am trying to insert an snippet like this
enter image description here



But when I write



usepackage{listings}
lstset{language=C}
begin{document}
begin{lstlisting}
typedef double real_t; // Esto casi seguro necesita ser tipo doble
real_t UpdatePID(SPid * pid, real_t error, real_t position)
{
.
.
.
}
end{lstlisting}
end{document}


I get this out of margin. Is this a package problem or a problem in my page setup?



enter image description here



First line of LOG file:



This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6880 64-bit) (preloaded format=pdflatex 2018.11.27) 2 DEC 2018 22:42
entering extended mode









share|improve this question









New contributor




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
























    up vote
    1
    down vote

    favorite












    I am trying to insert an snippet like this
    enter image description here



    But when I write



    usepackage{listings}
    lstset{language=C}
    begin{document}
    begin{lstlisting}
    typedef double real_t; // Esto casi seguro necesita ser tipo doble
    real_t UpdatePID(SPid * pid, real_t error, real_t position)
    {
    .
    .
    .
    }
    end{lstlisting}
    end{document}


    I get this out of margin. Is this a package problem or a problem in my page setup?



    enter image description here



    First line of LOG file:



    This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6880 64-bit) (preloaded format=pdflatex 2018.11.27) 2 DEC 2018 22:42
    entering extended mode









    share|improve this question









    New contributor




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






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am trying to insert an snippet like this
      enter image description here



      But when I write



      usepackage{listings}
      lstset{language=C}
      begin{document}
      begin{lstlisting}
      typedef double real_t; // Esto casi seguro necesita ser tipo doble
      real_t UpdatePID(SPid * pid, real_t error, real_t position)
      {
      .
      .
      .
      }
      end{lstlisting}
      end{document}


      I get this out of margin. Is this a package problem or a problem in my page setup?



      enter image description here



      First line of LOG file:



      This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6880 64-bit) (preloaded format=pdflatex 2018.11.27) 2 DEC 2018 22:42
      entering extended mode









      share|improve this question









      New contributor




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











      I am trying to insert an snippet like this
      enter image description here



      But when I write



      usepackage{listings}
      lstset{language=C}
      begin{document}
      begin{lstlisting}
      typedef double real_t; // Esto casi seguro necesita ser tipo doble
      real_t UpdatePID(SPid * pid, real_t error, real_t position)
      {
      .
      .
      .
      }
      end{lstlisting}
      end{document}


      I get this out of margin. Is this a package problem or a problem in my page setup?



      enter image description here



      First line of LOG file:



      This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6880 64-bit) (preloaded format=pdflatex 2018.11.27) 2 DEC 2018 22:42
      entering extended mode






      listings sourcecode






      share|improve this question









      New contributor




      Xavier Pacheco Paulino 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 question









      New contributor




      Xavier Pacheco Paulino 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 question




      share|improve this question








      edited 24 mins ago









      Kurt

      34.1k846157




      34.1k846157






      New contributor




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









      asked 1 hour ago









      Xavier Pacheco Paulino

      133




      133




      New contributor




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





      New contributor





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






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






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          Just add the option breaklines=true to lstset like



          lstset{breaklines=true,language=C}


          I added package showframe to visualize the typing area and margins.



          The following MWE



          documentclass{article}

          usepackage{listings}
          usepackage{showframe} % <========= to visualize typing area and margins
          lstset{breaklines=true,language=C} % <=================================


          begin{document}
          begin{lstlisting}
          typedef double real_t; // Esto casi seguro necesita ser tipo doble
          real_t UpdatePID(SPid * pid, real_t error, real_t position)
          {
          .
          .
          .
          }
          end{lstlisting}
          end{document}


          gives you



          enter image description here






          share|improve this answer





















          • I added breaklines=true but still getting the same. My document class is book, does this affect?
            – Xavier Pacheco Paulino
            45 mins ago










          • @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
            – Kurt
            40 mins ago










          • Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
            – Xavier Pacheco Paulino
            35 mins ago










          • By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
            – Xavier Pacheco Paulino
            31 mins ago










          • @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
            – Kurt
            26 mins 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',
          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
          });


          }
          });






          Xavier Pacheco Paulino is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462898%2fproblem-inserting-c-snippet%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








          up vote
          1
          down vote













          Just add the option breaklines=true to lstset like



          lstset{breaklines=true,language=C}


          I added package showframe to visualize the typing area and margins.



          The following MWE



          documentclass{article}

          usepackage{listings}
          usepackage{showframe} % <========= to visualize typing area and margins
          lstset{breaklines=true,language=C} % <=================================


          begin{document}
          begin{lstlisting}
          typedef double real_t; // Esto casi seguro necesita ser tipo doble
          real_t UpdatePID(SPid * pid, real_t error, real_t position)
          {
          .
          .
          .
          }
          end{lstlisting}
          end{document}


          gives you



          enter image description here






          share|improve this answer





















          • I added breaklines=true but still getting the same. My document class is book, does this affect?
            – Xavier Pacheco Paulino
            45 mins ago










          • @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
            – Kurt
            40 mins ago










          • Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
            – Xavier Pacheco Paulino
            35 mins ago










          • By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
            – Xavier Pacheco Paulino
            31 mins ago










          • @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
            – Kurt
            26 mins ago















          up vote
          1
          down vote













          Just add the option breaklines=true to lstset like



          lstset{breaklines=true,language=C}


          I added package showframe to visualize the typing area and margins.



          The following MWE



          documentclass{article}

          usepackage{listings}
          usepackage{showframe} % <========= to visualize typing area and margins
          lstset{breaklines=true,language=C} % <=================================


          begin{document}
          begin{lstlisting}
          typedef double real_t; // Esto casi seguro necesita ser tipo doble
          real_t UpdatePID(SPid * pid, real_t error, real_t position)
          {
          .
          .
          .
          }
          end{lstlisting}
          end{document}


          gives you



          enter image description here






          share|improve this answer





















          • I added breaklines=true but still getting the same. My document class is book, does this affect?
            – Xavier Pacheco Paulino
            45 mins ago










          • @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
            – Kurt
            40 mins ago










          • Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
            – Xavier Pacheco Paulino
            35 mins ago










          • By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
            – Xavier Pacheco Paulino
            31 mins ago










          • @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
            – Kurt
            26 mins ago













          up vote
          1
          down vote










          up vote
          1
          down vote









          Just add the option breaklines=true to lstset like



          lstset{breaklines=true,language=C}


          I added package showframe to visualize the typing area and margins.



          The following MWE



          documentclass{article}

          usepackage{listings}
          usepackage{showframe} % <========= to visualize typing area and margins
          lstset{breaklines=true,language=C} % <=================================


          begin{document}
          begin{lstlisting}
          typedef double real_t; // Esto casi seguro necesita ser tipo doble
          real_t UpdatePID(SPid * pid, real_t error, real_t position)
          {
          .
          .
          .
          }
          end{lstlisting}
          end{document}


          gives you



          enter image description here






          share|improve this answer












          Just add the option breaklines=true to lstset like



          lstset{breaklines=true,language=C}


          I added package showframe to visualize the typing area and margins.



          The following MWE



          documentclass{article}

          usepackage{listings}
          usepackage{showframe} % <========= to visualize typing area and margins
          lstset{breaklines=true,language=C} % <=================================


          begin{document}
          begin{lstlisting}
          typedef double real_t; // Esto casi seguro necesita ser tipo doble
          real_t UpdatePID(SPid * pid, real_t error, real_t position)
          {
          .
          .
          .
          }
          end{lstlisting}
          end{document}


          gives you



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 50 mins ago









          Kurt

          34.1k846157




          34.1k846157












          • I added breaklines=true but still getting the same. My document class is book, does this affect?
            – Xavier Pacheco Paulino
            45 mins ago










          • @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
            – Kurt
            40 mins ago










          • Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
            – Xavier Pacheco Paulino
            35 mins ago










          • By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
            – Xavier Pacheco Paulino
            31 mins ago










          • @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
            – Kurt
            26 mins ago


















          • I added breaklines=true but still getting the same. My document class is book, does this affect?
            – Xavier Pacheco Paulino
            45 mins ago










          • @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
            – Kurt
            40 mins ago










          • Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
            – Xavier Pacheco Paulino
            35 mins ago










          • By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
            – Xavier Pacheco Paulino
            31 mins ago










          • @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
            – Kurt
            26 mins ago
















          I added breaklines=true but still getting the same. My document class is book, does this affect?
          – Xavier Pacheco Paulino
          45 mins ago




          I added breaklines=true but still getting the same. My document class is book, does this affect?
          – Xavier Pacheco Paulino
          45 mins ago












          @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
          – Kurt
          40 mins ago




          @XavierPachecoPaulino no, should be the same with class book. To avoid problems like this we like to get a compilable MWE :-) Did you copy my code to your computer and run it? Result? Could it be your system is outdated? Please add the first line of your log file to your question ...
          – Kurt
          40 mins ago












          Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
          – Xavier Pacheco Paulino
          35 mins ago




          Yes, I copied your code and I'm getting the same result. Well, my .text file is really long. I can't post the whole code here. But the main issue is just with the C snippet. I added the first line of my log file to my question.
          – Xavier Pacheco Paulino
          35 mins ago












          By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
          – Xavier Pacheco Paulino
          31 mins ago




          By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
          – Xavier Pacheco Paulino
          31 mins ago












          @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
          – Kurt
          26 mins ago




          @XavierPachecoPaulino well, then check your long code, search for definitions for listings and copy them into your code given in your answer. I`m sure you have used some option(s) resulting in your issue you did not show us ...
          – Kurt
          26 mins ago










          Xavier Pacheco Paulino is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Xavier Pacheco Paulino is a new contributor. Be nice, and check out our Code of Conduct.













          Xavier Pacheco Paulino is a new contributor. Be nice, and check out our Code of Conduct.












          Xavier Pacheco Paulino is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f462898%2fproblem-inserting-c-snippet%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

          サソリ

          広島県道265号伴広島線

          Setup Asymptote in Texstudio