如何将自动宽度设置为浮动图形?

如何将自动宽度设置为浮动图形?

我正在尝试用文本包裹生成的图形。但我找不到要替换的内容,6cm以便\begin{floatingfigure}[l]{6cm}让 LaTeX 指定正确的宽度(就像高度一样)。

\documentclass[10pt]{article}
\usepackage{pstricks-add}
\usepackage{floatflt}
\pagestyle{empty}
\begin{document}
 text text text text text text text text text text text text text text text text text text

\begin{floatingfigure}[l]{6cm}
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt
0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-1,-1)(5,4)
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=1,Dy=1,ticksize=-2pt 0,subticks=2]{->}(0,0)(-1,-1)(5,4)[AAA,140] [BBB,-40]
\begin{scriptsize}
\psdots[dotstyle=*,linecolor=blue](2.48,3.3)
\rput[bl](2.56,3.42){\blue{$A$}}
\end{scriptsize}
\end{pspicture*}
\end{floatingfigure}
text text text text text text text text text text text text text text text text text text 
\end{document}

哎呀,我遇到了一个新问题,如果最后的文本太短,并且后面有新的部分或子部分,新部分中的文本会覆盖图形。有解决方案吗,还是我只能避免这种情况?

\documentclass[10pt]{article}
\usepackage{pstricks-add}
\usepackage{floatflt}

\newsavebox{\floatbox}

\pagestyle{empty}
\begin{document}
 text text text text text text text text text text text text text text text text text text

\sbox{\floatbox}{%
\psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,
linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-1.2,-1.2)(5,4)
\psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=1,Dy=1,ticksize=-2pt 0,
subticks=2]{->}(0,0)(-1,-1)(5,4)[AAA,140] [BBB,-40]
\scriptsize
\psdots[dotstyle=*,linecolor=blue](2.48,3.3)
\rput[bl](2.56,3.42){\blue{$A$}}
\end{pspicture*}}

\begin{floatingfigure}[l]{1.1\wd\floatbox}
\usebox{\floatbox}
\end{floatingfigure}
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
\section{New section}
text text text
\end{document}

答案1

您可以在使用之前测量一下盒子的尺寸:

\documentclass[10pt]{article}
\usepackage{pstricks-add}
\usepackage{floatflt}

\newsavebox{\floatbox}

\pagestyle{empty}
\begin{document}
 text text text text text text text text text text text text text text text text text text

\sbox{\floatbox}{%
  \psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dotstyle=o,dotsize=3pt 0,
    linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
  \begin{pspicture*}(-1.2,-1.2)(5,4)
  \psaxes[labelFontSize=\scriptstyle,xAxis=true,yAxis=true,Dx=1,Dy=1,ticksize=-2pt 0,
    subticks=2]{->}(0,0)(-1,-1)(5,4)[AAA,140] [BBB,-40]
  \scriptsize
  \psdots[dotstyle=*,linecolor=blue](2.48,3.3)
  \rput[bl](2.56,3.42){\blue{$A$}}
\end{pspicture*}}

\begin{floatingfigure}[l]{1.1\wd\floatbox}
\usebox{\floatbox}
\end{floatingfigure}
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
text text text text text text text text text text text text text text text text text text
\end{document}

我对图片主体做了一些更改;为了设置我使用的宽度1.1\wd\floatbox,但也

\dimexpr\wd\floatbox+1em\relax

可用于已知间隙。箱式容器\floatbox可以以同样的方式随意重复使用。

相关内容