1

I have the following piece of brief code. As you see, when I am using verbatism after the wrapfigure in the left mode {l}, the generated pdf file is a mess. But it is ok if I use wrapfigure with {r}. I appreciate any suggestion to solve the issue with the {l} mode. Thanks

\documentclass[a4paper,12pt,onecolumn]{report}
\usepackage{graphicx}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}[9]{l}{0.25\textwidth}
    \includegraphics[width=0.25\textwidth]{figs/Poly}
    \caption{Wrapfigure used to put this figure        here!!}\label{fig:right_fig}
\end{wrapfigure}
Finally, lets try multi-figure commands and see how it works. An example is shown in Fig.~\ref{fig:Multifigure} where we have a $2\times2$ image which  is inserted by the following code.
\begin{verbatim}
\begin{figure}
\begin{subfigure}{.5\textwidth}
  \centering
   \includegraphics[width=.9\linewidth]{figs/Poly}
   \caption{} \label{fig:Multifigure1}
\end{verbatim}

To plot data -- either save in a .txt file or some numbers -- using LaTeX, the "pgfplots" package should be added at the preamble. To import data from a .txt file, the "tikz" package should be added, too. The following is an example...
\end{document}
| improve this question | | | | |
0

As a temporary solution:

\documentclass[a4paper,12pt,onecolumn]{report}
\usepackage{graphicx}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}[5]{l}{0.25\textwidth}
    \includegraphics[width=0.25\textwidth]{Poly}
    \caption{Wrapfigure used to put this figure        here!!}\label{fig:right_fig}
\end{wrapfigure}

Finally, lets try multi-figure commands and see how it works. An example is shown in Fig.~\ref{fig:Multifigure} where we have a $2\times2$ image which  is inserted by the following code.

\hskip -7mm
\begin{minipage}{0.65\textwidth}
\begin{verbatim}
\begin{figure}
\begin{subfigure}{.5\textwidth}
  \centering
   \includegraphics[width=.9\linewidth]{figs/Poly}
   \caption{} \label{fig:Multifigure1}
\end{verbatim}
\end{minipage}

To plot data -- either save in a .txt file or some numbers -- using LaTeX, the "pgfplots" package should be added at the preamble. To import data from a .txt file, the "tikz" package should be added, too. The following is an example...
\end{document}

This is the output: enter image description here

| improve this answer | | | | |
1

Here's how to make the code fit line width, using the tools from fancyvrbto set the font size and the left margin, and package geometry:

\documentclass[a4paper,12pt,onecolumn]{report}
\usepackage{geometry} 
\usepackage[demo]{graphicx}
\usepackage{caption, subcaption}
\usepackage{wrapfig}
\usepackage{fancyvrb}

\begin{document}

\begin{wrapfigure}[9]{l}{0.25\textwidth}
    \includegraphics[width=0.25\textwidth]{figs/Poly}
    \caption{Wrapfigure used to put this figure here!!}\label{fig:right_fig}
\end{wrapfigure}
Finally, lets try multi-figure commands and see how it works. An example is shown in Fig.~\ref{fig:Multifigure} where we have a $2\times2$ image which is inserted by the following code.
\begin{Verbatim}[xleftmargin =-6pt, fontsize=\small]
\begin{figure}
\begin{subfigure}{.5\textwidth}
  \centering
   \includegraphics[width=.9\linewidth]{figs/Poly}
   \caption{} \label{fig:Multifigure1}
\end{Verbatim}

To plot data -- either save in a .txt file or some numbers -- using LaTeX, the "pgfplots" package should be added at the preamble. To import data from a .txt file, the "tikz" package should be added, too. The following is an example...

\end{document}

enter image description here

| improve this answer | | | | |
0

Maybe you are more satisfied with the output if you use fancyvrb's Verbatim environment instead. Nevertheless, keep in mind that the code is too wide and will either overlap with your image or flow into the margin:

enter image description here

\documentclass[a4paper,12pt,onecolumn]{report}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{fancyvrb}

\begin{document}

\begin{wrapfigure}[9]{l}{0.25\textwidth}
    \includegraphics[width=0.25\textwidth]{example-image}
    \caption{Wrapfigure used to put this figure        here!!}\label{fig:right_fig}
\end{wrapfigure}
Finally, lets try multi-figure commands and see how it works. An example is shown in Fig.~\ref{fig:Multifigure} where we have a $2\times2$ image which  is inserted by the following code.
\begin{Verbatim}
\begin{figure}
\begin{subfigure}{.5\textwidth}
  \centering
   \includegraphics[width=.9\linewidth]{figs/Poly}
   \caption{} \label{fig:Multifigure1}
\end{Verbatim}

To plot data -- either save in a .txt file or some numbers -- using LaTeX, the "pgfplots" package should be added at the preamble. To import data from a .txt file, the "tikz" package should be added, too. The following is an example...
\end{document}
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.