verbatism
我有以下一段简短的代码。如您所见,当我在左侧模式 {l}中使用时wrapfigure
,生成的 pdf 文件很乱。但如果我使用wrapfigure
{r},则没问题。我很感激任何解决 {l} 模式问题的建议。谢谢
\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}
答案1
临时解决方案:
\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}
答案2
下面介绍了如何使代码适合线宽,使用来自的工具fancyvrb
来设置字体大小和左边距,以及包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}
答案3
fancyvrb
如果您改用环境 ,也许您会对输出更满意Verbatim
。不过,请记住,代码太宽,要么会与您的图像重叠,要么会流入边距:
\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}