# wrapfigure and curly braces

\documentclass{article}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{r}{3cm}
\centering
\rule{3cm}{3cm}
\end{wrapfigure}
g,sd; agmgts bsgfs shgsnhg  {\bf snhbfx} fdbhsmn jnnsndg ndsngas gngdfznagk dfhbf
gsgfsh shgfs

{Here is the problem!} "Observe that after using the wrapfigure command, when I am writing something which has to be kept inside the curly braces something unsusal happening." How to resolve this?

\end{document}

• Just copy paste the whole code and see the problem – G_0_pi_i_e Feb 12 '16 at 10:36

Problems are expected, actually.

In order to flow several paragraphs around the image, wrapfig needs to use \everypar in order to pass new paragraphs some code to execute, until it is sure that the text has more lines than needed for going past the image.

What happens in your case? The second paragraph starts inside a group, so the settings for the paragraph shape get lost when the group ends.

How to solve the issue? I guess it happened because you wanted something like

{\bf Here is the problem!}


but you're the cause for your problems. The two letter font changing commands have been deprecated for more than twenty years.

Never ever use \bf, \it or similar commands. They have been deprecated for more than twenty years. Unexpected problems can show when you use commands that have been deprecated for more than twenty years.

I could go on with this rant, but I hope that three times is enough. ;-)

\documentclass{article}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{r}{3cm}
\centering
\rule{3cm}{3cm}
\end{wrapfigure}

g,sd; agmgts bsgfs shgsnhg  \textbf{snhbfx} fdbhsmn jnnsndg ndsngas gngdfznagk dfhbf
gsgfsh shgfs

\textbf{Here is the problem!} "Observe that after using the wrapfigure command, when I am writing
something which has to be kept inside the curly braces something unsusal happening." How to resolve
this?

\end{document}


If you really need {...} for some other purpose, just add \mbox{} in front of the opening brace, if it happens at the start of a paragraph in connection with a wrapfigure.

• @G_0_pi_i_e I hope you didn't take it personally. It's very curious that, notwithstanding the fact that those commands have been deprecated long ago, they still find their way in document and people teach them. So, whenever I have the occasion, I stress that they must not be used. – egreg Feb 12 '16 at 11:08