如何使用 Latex 修复特定页面上的图像,

如何使用 Latex 修复特定页面上的图像,

我想使用 Latex 固定特定页面上图像的位置。这是我的问题的 latex 代码:latex 代码的输出作为图片附加。您可以看到,图像要么移到文本的后面,要么移到文本的前面并隐藏文本。此外,如果增加“\begin{tikzpicture}”命令之前的段落数或文本量,那么猫的图像将流到下一页(我没有在这里显示,在 pdf 页面的图像中)。

\documentclass[a4paper,10pt]{article}

\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}

\usepackage{caption}
\usepackage{wrapfig}
 % for labeling the figure wrapped with caption
%
\captionsetup[figure]{name=Fig., labelsep=period, labelfont=bf, font={small, stretch=1}}
\usepackage[capbesideposition={bottom, right}, capbesidesep=quad]{floatrow}

\begin{document}
\lipsum[1-4]
        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=south east,inner sep=-50pt] at ($(current page.south east)+(-4.0cm,5cm)$) {
            \includegraphics[width=6cm,height=9cm]{a1}
        };
    \end{tikzpicture}

 \lipsum[1-12]
        \begin{tikzpicture}[remember picture,overlay]
        \node[anchor=south east,inner sep=-50pt] at ($(current page.south east)+(-4.0cm,5cm)$) {
            \includegraphics[width=6cm,height=9cm]{a1}
        };
    \end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

您可以在段落中间插入环绕图,但在本例中不需要。请注意\intextsep图像上方的间隙。

\documentclass[a4paper,10pt]{article}

\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}

\usepackage{caption}
\usepackage{wrapfig}
 % for labeling the figure wrapped with caption
%
\captionsetup[figure]{name=Fig., labelsep=period, labelfont=bf, font={small, stretch=1}}
%\usepackage[capbesideposition={bottom, right}, capbesidesep=quad]{floatrow}% are caption and floatrow compatible?
% see https://tex.stackexchange.com/questions/351561/subcaption-caption-beside-figure

\begin{document}
\lipsum[1-5]

\begin{wrapfigure}[23]{r}{6cm}
\includegraphics[width=6cm,height=9cm]{example-image}
\end{wrapfigure}

\lipsum[6-9]

\end{document}

\nopar此版本使用 flowfram。请注意列宽变化时的用法。

\documentclass[a4paper,10pt]{article}

\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}

\usepackage{caption}
%\usepackage{wrapfig}
 % for labeling the figure wrapped with caption
%
\captionsetup[figure]{name=Fig., labelsep=period, labelfont=bf, font={small, stretch=1}}
%\usepackage[capbesideposition={bottom, right}, capbesidesep=quad]{floatrow}% are caption and floatrow compatible?
% see https://tex.stackexchange.com/questions/351561/subcaption-caption-beside-figure

\usepackage{flowfram}
\newstaticframe[1]{6cm}{9cm}{\dimexpr \textwidth-6cm}{0pt}% page 1 only
\begin{staticcontents}{1}% IDN=1
  \includegraphics[width=6cm,height=9cm]{example-image}
\end{staticcontents}
\newflowframe[1]{\textwidth}{\dimexpr \textheight-9cm-\intextsep}{0pt}{\dimexpr 9cm+\intextsep}
\newflowframe[1]{\dimexpr \textwidth-6cm-\columnsep}{\dimexpr 9cm+\intextsep}{0pt}{0pt}

\newcommand{\nopar}{{\parfillskip=0pt\par}\framebreak\noindent}

\begin{document}
\lipsum[1-5]

Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, laoreet vitae, arcu. Aenean\nopar
faucibus pede eu ante. Praesent enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus eros,
malesuada sit amet, fermentum eu, sodales cursus, magna. Donec eu purus. Quisque vehicula, urna sed
ultricies auctor, pede lorem egestas dui, et convallis elit erat sed nulla. Donec luctus. Curabitur et nunc.
Aliquam dolor odio, commodo pretium, ultricies non, pharetra in, velit. Integer arcu est, nonummy in,
fermentum faucibus, egestas vel, odio.

\lipsum[7]

Pellentesque habitant morbi tristique senectus et netus et
malesuada fames ac turpis egestas. Donec odio elit, dictum in,
hendrerit sit amet, egestas sed, leo. Praesent feugiat sapien\nopar
aliquet odio. Integer vitae justo. Aliquam vestibulum fringilla
lorem. Sed neque lectus, consectetuer at, consectetuer sed, eleifend
ac, lectus. Nulla facilisi. Pellentesque eget lectus. Proin
eu metus. Sed porttitor. In hac habitasse platea dictumst.
Suspendisse eu lectus. Ut mi mi, lacinia sit amet, placerat et,
mollis vitae, dui. Sed ante tellus, tristique ut, iaculis eu, malesuada
ac, dui. Mauris nibh leo, facilisis non, adipiscing quis,
ultrices a, dui.

\lipsum[9]
\end{document}

相关内容