我从 SVG 导入一个图形并将其插入我的书中。环境wrapfigure
无法正常工作。LaTeX 将其放在文本下方:
\documentclass{book}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{wrapfig}
\begin{document}
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
\begin{wrapfigure}{l}{0.3\linewidth}
\centering
\def\svgwidth{6.5cm}
\input{minimal_figure}
\caption{Name of the figure}
\end{wrapfigure}
\end{document}
minimal_figure.tex
如下:
%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'Derivative_of_a_function.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{252bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.95238095)%
\put(0,0){\includegraphics[width=\unitlength,page=1]{minimal_figure.pdf}}%
\put(0.5476904,0.79852081){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ F $}}%
\put(1.26829466,1.74983366){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.1122392\unitlength}\raggedright \end{minipage}}}%
\put(1.28849768,1.68697974){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{}}}%
\put(0.22597206,0.49316367){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ \Delta y$} }%
\put(0.03709135,0.67054268){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ f(x) $}}%
\put(0.01307867,0.29686375){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ f(x_0) $}}%
\put(0.50275777,0.18562398){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ \Delta x $}}%
\put(1.7262304,1.71616192){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.13917663\unitlength}\raggedright \end{minipage}}}%
\put(0.72001973,0.44786182){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ \alpha $}}%
\put(1.46134596,1.29414276){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.12346308\unitlength}\raggedright \end{minipage}}}%
\put(0.43543939,0.06447172){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ x_0 $}}%
\put(1.60725699,1.2716948){\color[rgb]{0,0,0}\makebox(0,0)[lt]{\begin{minipage}{0.20427537\unitlength}\raggedright \end{minipage}}}%
\put(0.59936523,0.06444614){\color[rgb]{0,0,0}\makebox(0,0)[lb]{$ x $}}%
\put(0,0){\includegraphics[width=\unitlength,page=3]{minimal_figure.pdf}}%
\end{picture}%
\endgroup%
结果是
答案1
在某种程度上,wrapfig
暗示代码中wrapfigure
(或)环境的位置wraptable
文档(部分1 放置和浮动):
浮动时,LaTeX 会尝试应用这些规则。更具体地说,浮动包装环境只会开始...
- 在段落的开头,
- ...
并且,即使从 TeX 的角度来看段落是作为一个整体读入的,您也需要将适当的wrap*
环境放在段落的开头,而不是结尾。
\documentclass{book}
\usepackage{graphicx,wrapfig}
\begin{document}
\begin{wrapfigure}{l}{6.7cm}
\centering
\includegraphics[width=6.5cm]{example-image}%
\caption{Name of the figure}
\end{wrapfigure}
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
Some text here. Some text here. Some text here. Some text here.Some text here. Some text here. Some text here. Some text here.
\end{document}