Wrapfig error: Conflicting Environment











up vote
0
down vote

favorite












I have a figure inside of a wrapfigure environment in the body of my paper. However, I am receiving a warning that it is used inside a conflicting environment, even though the environment that it's in is just the document! Is it because of how it floats around, maybe it ends up somewhere else?



Here is the relevant bit of my document:



Text text text text text...

begin{lstlisting}
...some code goes here...
end{lstlisting}

begin{wrapfigure}{L}{0.5textwidth}
centering
includegraphics[width=textwidth]{figures/myfigure.pdf}
caption{Caption for figure}
label{fig:fig-label}
end{wrapfigure}

Bunch more text goes here...


Interestingly, if I move the wrap figure after the paragraph following the listing, there are no warnings.



I hope this doesn't count as a duplicate; I found related questions, but none of the answers worked...










share|improve this question


















  • 1




    I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
    – egreg
    Nov 14 at 18:29










  • I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
    – John Kormylo
    Nov 15 at 5:52















up vote
0
down vote

favorite












I have a figure inside of a wrapfigure environment in the body of my paper. However, I am receiving a warning that it is used inside a conflicting environment, even though the environment that it's in is just the document! Is it because of how it floats around, maybe it ends up somewhere else?



Here is the relevant bit of my document:



Text text text text text...

begin{lstlisting}
...some code goes here...
end{lstlisting}

begin{wrapfigure}{L}{0.5textwidth}
centering
includegraphics[width=textwidth]{figures/myfigure.pdf}
caption{Caption for figure}
label{fig:fig-label}
end{wrapfigure}

Bunch more text goes here...


Interestingly, if I move the wrap figure after the paragraph following the listing, there are no warnings.



I hope this doesn't count as a duplicate; I found related questions, but none of the answers worked...










share|improve this question


















  • 1




    I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
    – egreg
    Nov 14 at 18:29










  • I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
    – John Kormylo
    Nov 15 at 5:52













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a figure inside of a wrapfigure environment in the body of my paper. However, I am receiving a warning that it is used inside a conflicting environment, even though the environment that it's in is just the document! Is it because of how it floats around, maybe it ends up somewhere else?



Here is the relevant bit of my document:



Text text text text text...

begin{lstlisting}
...some code goes here...
end{lstlisting}

begin{wrapfigure}{L}{0.5textwidth}
centering
includegraphics[width=textwidth]{figures/myfigure.pdf}
caption{Caption for figure}
label{fig:fig-label}
end{wrapfigure}

Bunch more text goes here...


Interestingly, if I move the wrap figure after the paragraph following the listing, there are no warnings.



I hope this doesn't count as a duplicate; I found related questions, but none of the answers worked...










share|improve this question













I have a figure inside of a wrapfigure environment in the body of my paper. However, I am receiving a warning that it is used inside a conflicting environment, even though the environment that it's in is just the document! Is it because of how it floats around, maybe it ends up somewhere else?



Here is the relevant bit of my document:



Text text text text text...

begin{lstlisting}
...some code goes here...
end{lstlisting}

begin{wrapfigure}{L}{0.5textwidth}
centering
includegraphics[width=textwidth]{figures/myfigure.pdf}
caption{Caption for figure}
label{fig:fig-label}
end{wrapfigure}

Bunch more text goes here...


Interestingly, if I move the wrap figure after the paragraph following the listing, there are no warnings.



I hope this doesn't count as a duplicate; I found related questions, but none of the answers worked...







warnings wrapfigure






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 14 at 17:45









alan

333




333








  • 1




    I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
    – egreg
    Nov 14 at 18:29










  • I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
    – John Kormylo
    Nov 15 at 5:52














  • 1




    I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
    – egreg
    Nov 14 at 18:29










  • I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
    – John Kormylo
    Nov 15 at 5:52








1




1




I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
– egreg
Nov 14 at 18:29




I don't think there's a way to make lstlisting and wrapfig coexist. Normal text can wrap around pictures, listings can't.
– egreg
Nov 14 at 18:29












I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
– John Kormylo
Nov 15 at 5:52




I don't get your error. I do get an image way too wide. Unlike minpage, wrapfigure does not reset textwidth. Now, if you have another lstlisting before wrapfigure is done, THAT will cause problems.
– John Kormylo
Nov 15 at 5:52















active

oldest

votes











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%2f459988%2fwrapfig-error-conflicting-environment%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f459988%2fwrapfig-error-conflicting-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

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents