Problem inserting C snippet
up vote
1
down vote
favorite
I am trying to insert an snippet like this
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?
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
SOLVED:
I followed this link: Problems with the lstlisting environment (margin and white line)
listings sourcecode
New contributor
add a comment |
up vote
1
down vote
favorite
I am trying to insert an snippet like this
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?
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
SOLVED:
I followed this link: Problems with the lstlisting environment (margin and white line)
listings sourcecode
New contributor
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am trying to insert an snippet like this
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?
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
SOLVED:
I followed this link: Problems with the lstlisting environment (margin and white line)
listings sourcecode
New contributor
I am trying to insert an snippet like this
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?
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
SOLVED:
I followed this link: Problems with the lstlisting environment (margin and white line)
listings sourcecode
listings sourcecode
New contributor
New contributor
edited 49 mins ago
New contributor
asked 2 hours ago
Xavier Pacheco Paulino
133
133
New contributor
New contributor
add a comment |
add a comment |
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
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino no, should be the same with classbook
. 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino well, then check your long code, search for definitions forlistings
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
1 hour ago
add a comment |
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
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino no, should be the same with classbook
. 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino well, then check your long code, search for definitions forlistings
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
1 hour ago
add a comment |
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
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino no, should be the same with classbook
. 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino well, then check your long code, search for definitions forlistings
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
1 hour ago
add a comment |
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
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
answered 1 hour ago
Kurt
34.2k846157
34.2k846157
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino no, should be the same with classbook
. 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino well, then check your long code, search for definitions forlistings
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
1 hour ago
add a comment |
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino no, should be the same with classbook
. 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
@XavierPachecoPaulino well, then check your long code, search for definitions forlistings
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
1 hour ago
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour ago
I added breaklines=true but still getting the same. My document class is book, does this affect?
– Xavier Pacheco Paulino
1 hour 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
1 hour 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
1 hour 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
1 hour 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
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour ago
By mistake I edited your comment. Please, fix it. I have already added the log code to my question.
– Xavier Pacheco Paulino
1 hour 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
1 hour 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
1 hour ago
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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