Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to wrap an generated graphic with text. But I cannot find what I have to put instead of 6cm in \begin{floatingfigure}[l]{6cm} to let LaTeX designate correct width like it does with height.

\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}

Ouch, I have a new problem, if last text is too short and there's a new section or subsection following, text in new section overwrite graphic. There is solution for this or only should I avoid this kind of situations?

\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}
share|improve this question
    
Welcome to TeX.SE. I took the liberty to format your post a little. See this link for more details on available formatting. –  tohecz May 2 '12 at 12:58
1  
Wrapping text around a figure can be justified only if there's enough text to go past the figure. Leave such adjustments for the final revision of your document, when you're sure that the text won't change substantially. –  egreg May 3 '12 at 7:49
    
Ok, it's just I'm trying to make the document indenpedent of paper size (A4 and Kindle's size mostly) and I began with latex a few days ago :). –  AsVHEn May 3 '12 at 10:35

1 Answer 1

up vote 5 down vote accepted

You can measure the box before using it:

\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}

I've made some changes to the body of the picture; for setting the width I used 1.1\wd\floatbox, but also

\dimexpr\wd\floatbox+1em\relax

could be used to have a known clearance. The box bin \floatbox can be reused at will in the same way.

share|improve this answer
    
Perfect :), ty so much. –  AsVHEn May 2 '12 at 13:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.