有没有什么方法可以(强制)将图形放置在 LaTex 文档中的指定位置并让所有文本环绕它?

有没有什么方法可以(强制)将图形放置在 LaTex 文档中的指定位置并让所有文本环绕它?

我正在做一份作业,两天来我一直在断断续续地研究这个特定的排版问题。在谷歌上搜索了很多资料,阅读了很多资料,并尝试了这里发布的很多建议后,我发现我不是第一个寻找这个问题答案的人,但我还没有设法自己解决这个问题,也没有让作业看起来值得提交。

我正在寻找的是一种将图形和图形文本分配给页面上的一组特定像素的方法,并且无论页面上发生什么情况,它们都保持固定位置。

到目前为止我所做的是这样的:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{physics}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage[a4paper, margin={2cm,1.5cm}]{geometry}
\spacing{1.33}

% pictu{picture.png}{right/left}{size}{ref-label}{figure text}
\newcommand{\pictu}[5]{\begin{wrapfigure}{#2}{#350\textwidth}
\includegraphics[width=#350\textwidth]{#1}
\caption{\setstretch{1}\centering\label{#4}#5}
\end{wrapfigure}}

\title{lipsum}
\author{lipsum}
\date{lipsum}
\begin{document}

\maketitle

\section{lipsum mania}
\subsection{subsection 1.1}

\pictu{pic.png}{R}{0.35}{fig:pic1}{figure text.}

Short text here.

\quad
\newline
\lipsum[1]

\subsection{subsection 1.2}

Some more short text here.

\pictu{pic1.png}{L}{0.35}{fig:pic}{Fig text.}

\quad
\newline
\lipsum[1]

\quad
\newline
For some reason the margin set in the beginning doesn't apply to this page... \lipsum[1]

\pictu{picture_related_to_section_1_2.png}{R}{0.35}{fig:pic}{Picture related to subsection 1.2 ... one of which I'd really like to force the placement}

\lipsum[1]

\subsection{Subsection 1.3}

\pictu{picture_with_a_big_fat_unwanted_blank_area_above.png}{R}{0.4}{fig:picx}{Apparently there's a no man's land for text aboce this figure... I assume, it's because the figures are to close, making the program 'think' there's no room for text.}

A bit longer section of short text... which is right now annoying close to the figure text of the misplaced figure.

\lipsum[1]

\subsection{Last subsection so far}

\pictu{picture_related_to_the_last_subsection.png}{R}{0.35}{fig:PnxX}{This picture should preferably be above "Section 2" ... which is it in the code.}

\lipsum[1]

\section{Section 2}

\end{document}

我在本小说的末尾附上了由代码生成的页面当前排版的示例。

为了让代码看起来更简洁,我创建了一个 \newcommand,\图片,据我所知,它的作用就像粘贴包裹图环境——尽管两者都不是理想的)。请随意质疑或更正代码。我不是在寻找修复——我确信我离一个漂亮解决方案的正确轨道还很远。我会毫不犹豫地放弃这个代码,去寻找一些有用的东西。

我经常读到,人们应该让“LaTex 自己做事”,把图表放在与文本其他部分最相配的位置,但这对我的情况不起作用。这就是为什么我最初开始处理包裹图

我需要知道的是,是否有办法强制图像保持固定在页面的特定像素上,或者我是否必须辞职并投资 Microsoft Office 许可证(我确实希望这能够奏效,但到目前为止我还没有能力做到)。

抱歉,我的问题可能存在错误或缺乏知识或礼节 - 我对 latex 和论坛都很陌生。如果这个问题已经得到解答,请告诉我!

提前致谢!

字体示例: 印刷噩梦的第 2 页。

答案1

一旦您修复了不相关的错误,您就会得到一些 pdf 输出,然后如果您准备在每个图形上投入少量的手工工作,通常可以控制每个图形周围的空白,例如:

在此处输入图片描述

\documentclass[draft]{article}
\usepackage[utf8]{inputenc}
%\usepackage{amsmath}\usepackage{relsize}\usepackage{physics}
\usepackage{setspace}
\usepackage{graphicx}
%\usepackage{float}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage[a4paper, margin={2cm,1.5cm}]{geometry}


% pictu{picture.png}[lines]{right/left}{size}{ref-label}{figure text}
\newcommand{\pictu}[6][]{\noindent\begin{wrapfigure}[#1]{#3}{#4\textwidth}
\includegraphics[width=#4\textwidth]{#2}
\caption{\label{#5}#6}
\end{wrapfigure}}

\title{lipsum}
\author{lipsum}
\date{lipsum}

\begin{document}

\begin{spacing}{1.33}

\maketitle
\section{lipsum mania}
\subsection{subsection 1.1}

\pictu[14]{pic.png}{r}{0.35}{fig:pic1}{figure text.}


Short text here.

\indent\lipsum[1]

\subsection{subsection 1.2}

Some more short text here.

\pictu{pic1.png}{l}{0.35}{fig:pic}{Fig text.}


\indent\lipsum[1]


For some reason the margin set in the beginning doesn't apply to this page... 

\indent\lipsum[1]

\pictu[13]{picture_related_to_section_1_2.png}{r}{0.35}{fig:picb}{Picture related to subsection 1.2 ... one of which I'd really like to force the placement}

\indent\lipsum[1]


\subsection{Subsection 1.3}

\pictu[16]{picture_with_a_big_fat_unwanted_blank_area_above.png}{r}{0.4}{fig:picx}{Apparently there's a no man's land for text aboce this figure... I assume, it's because the figures are to close, making the program 'think' there's no room for text.}

A bit longer section of short text... which is right now annoying close to the figure text of the misplaced figure.

\indent\lipsum[1]

\subsection{Last subsection so far}



  Lorem ipsum dolor sit amet, consectetuer
  adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
  adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
  libero, nonummy eget, consectetuer id, vulputate a, magna.
\pictu{picture_related_to_the_last_subsection.png}{r}{0.35}{fig:PnxX}{This picture should preferably be above "Section 2" ... which is it in the code.}
  Donec
  vehicula augue eu neque. Pellentesque habitant morbi tristique
  senectus et netus et malesuada fames ac turpis egestas. Mauris ut
  leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
  fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida
  placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,
  nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.
  Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
  Curabitur auctor semper nulla. Donec varius orci eget risus. Duis
  nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
  eget orci sit amet orci dignissim rutrum.

\section{Section 2}

\end{spacing}
\end{document}

相关内容