Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

force a figure to be in a certain section when using wrapfigure

77 views
Skip to first unread message

Jason Lewis

unread,
Jan 14, 2004, 1:33:46 AM1/14/04
to
Hi,

I am using Template Toolkit an LaTeX to write a product catalogue for my
business. The LaTeX for my document is all generated from a database using
Template Toolkit.

For an idea of how I want to lay out my catalogue, see the text at the end of
this message.

The problem I am having is getting all the text to line up exactly how I want
it. I have tried many different ways of laying out including minipages,
floatflt, wrapfigure and probably a few others. None of them was able to give
me perfect results but wrapfigure seems to come closest.

The problem i get is when I have a short section, wrapfigure puts my image
about 1-2 sections later, rather than in the short section, making the short
section longer. Thats probably what it was designed to do, but its not the
behaviour I am after.

Is there a way to force wrapfigure to put the image between 2 points of a
document? ie, "this image must be placed between point A and point B" or
something?

Or, is there a better way of flowing text around the image that I should be
aware of? I am willing to compromise and, say, assign a column on the left
hand side of my document that would only have floating images in it, and put
captions on them, but I couldnt work out how to do that either.

Here is a sample of my code currently:
\subsection{Norfolk Punch - Sauces and Relishes}
\begin{wrapfigure}{r}{0pt}
\includegraphics[width=3cm,height=3cm,keepaspectratio=true]{/tmp/LaTeXCatalogueSymlinks/_mnt_ot_images_Norfolk_Punch_Norfolk_Punch_Relishes_and_Sauces_20030514_no_background.jpg}
\end{wrapfigure}

Cu?ious Relish
Has a gentle heat and bite of mild chilli and the smoothness of liquorice
root. Add to rice, soups and stir frys.

St Georges Dragon's Breath Sauce

A warm and spicy sauce containing chilli, ginger, tomato, garlic, cloves, and
dragons blood (spice imported from China which gives the red tinge to this sauce)
\begin{longtable}[l]{p{7cm}|l|r|l|r@{.}l|l|l|l|l|l|l|l|l|l|l|l|l|l} \hline
St Geo Dragon Breath Sauce 150ml & & 24 & 9011302 & 3 & 60 & & & & & & &
& & & & & \\ \hline
Cur?ous Relish 250ml & & 24 & 9011303 & 3 & 50 & & & & & & &
& & & & & \\ \hline
\end{longtable}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this section includes images by the minipage method
% this one tries to put all of the section in the minipage
\subsection{Condiments}

.
.
.
etc....


And here is the layout I am trying to acheive.....

1.3.4 Product Listing
ducts and aThis is a list of oducts and a descrip -------------------------
a descriptilist of my product a description of th | |
ption of thmy products and a iption of them. This | |
m. This is and a description em. This is a lis to | |
s is a listdescription of theis is a list of my p | an included image |
of my produof them. This is a of my products and | |
ducts and aThis is a list of oducts and a descrip | |
a descriptilist of my product a description of th | |
on of them.products and a desion of them. This is ------------------------
his is a lia description of tThis is a list of my products and a description
of my produof them. This is a of my products and a description of them. This
and a descis a list of my prs and a description of them.

this is a longtable
Product1 3.50 | | | | | | | | | | | |
Product2 3.50 | | | | | | | | | | | |
Product3 3.50 | | | | | | | | | | | |
Product4 3.50 | | | | | | | | | | | |
Product5 3.50 | | | | | | | | | | | |
Product6 3.50 | | | | | | | | | | | |
Product7 3.50 | | | | | | | | | | | |
Product8 3.50 | | | | | | | | | | | |
Product9 3.50 | | | | | | | | | | | |


and when its a short bit of text.....

1.3.4 Product Listing
ducts and aThis is a list of mydts and a descrip -------------------------
a descriptilist of my products aescription of th | |
ption of thmy products and a depon of them. This | |
m. This is and a description ofmThis is a lis to | |
| an included image |
this is a longtable | |
Product1 3.50 | | | | | | | | | | | | | |
Product2 3.50 | | | | | | | | | | | | | |
Product3 3.50 | | | | | | | | | | | | ------------------------
Product4 3.50 | | | | | | | | | | | |
Product5 3.50 | | | | | | | | | | | |
Product6 3.50 | | | | | | | | | | | |
Product7 3.50 | | | | | | | | | | | |
Product8 3.50 | | | | | | | | | | | |
Product9 3.50 | | | | | | | | | | | |


But sometimes, i only have 1 or 2 lines in my longtable, so i would like the
following behaviour in that situation


1.3.4 Product Listing
ducts and aThis is a list of my cts and a descrip -------------------------
a descriptilist of my products adescription of th | |
ption of thmy products and a desion of them. This | |
m. This is and a description of This is a lis to | |
| an included image |
this is a longtable | |
Product1 3.50 | | | | | | | | | | | | | |
| |
| |
| |
| |
| |
------------------------


1.3.5 Next Section starts below Image
This is the next section. This is the next section.
This is the next section. This is the next section.
This is the next section. This is the next section.
This is the next section.

Any suggestions would be greatly appreciated.

Thanks,

Jason

PS. I am looking for a workable solution - I'm happy to do things differently
if it will make it easier. Im just really stuck on this.

Jason

Ulrike Fischer

unread,
Jan 14, 2004, 4:10:16 AM1/14/04
to
Jason Lewis <ja...@NOdicksonSPAM.st> schrieb:

> Hi,
>
> I am using Template Toolkit an LaTeX to write a product catalogue for
> my business. The LaTeX for my document is all generated from a
> database using Template Toolkit.
>
> For an idea of how I want to lay out my catalogue, see the text at the
> end of this message.
>
> The problem I am having is getting all the text to line up exactly how
> I want it. I have tried many different ways of laying out including
> minipages, floatflt, wrapfigure and probably a few others. None of
> them was able to give me perfect results but wrapfigure seems to come
> closest.
>
> The problem i get is when I have a short section, wrapfigure puts my
> image about 1-2 sections later, rather than in the short section,
> making the short section longer. Thats probably what it was designed
> to do, but its not the behaviour I am after.
>
> Is there a way to force wrapfigure to put the image between 2 points
> of a document? ie, "this image must be placed between point A and
> point B" or something?
>
> Or, is there a better way of flowing text around the image that I
> should be aware of? I am willing to compromise and, say, assign a
> column on the left hand side of my document that would only have
> floating images in it, and put captions on them, but I couldnt work
> out how to do that either.

You could perhaps make a large margin and use \marginpar.


>
> Here is a sample of my code currently:

You shouldn't sent snippets of code. Make a complete (but minimal)
document. Replace graphics by e.g. \rule{3cm}{3cm}. So that everybody
can test your code and see the problem.


> \subsection{Norfolk Punch - Sauces and Relishes}
> \begin{wrapfigure}{r}{0pt}
> \includegraphics[width=3cm,height=3cm,keepaspectratio=true]{/tmp/LaTeXC
> atalogueSymlinks/_mnt_ot_images_Norfolk_Punch_Norfolk_Punch_Relishes_an
> d_Sauces_20030514_no_background.jpg}
> \end{wrapfigure}
>
> Cu?ious Relish
> Has a gentle heat and bite of mild chilli and the smoothness of
> liquorice root. Add to rice, soups and stir frys.
>

Do you agree, that this is not easy to read? Why didn't you at least
replace the path with a shorter one?

If I remember it right, wrapfigure place the figure in the current
paragraph. So don't put a blank line between the figure and the text
following.

I don't delete the rest of your post so that you can see that is really
not possible to see what you want.

--
Ulrike Fischer
e-mail: zusätzlich meinen Vornamen vor dem @ einfügen.
e-mail: add my first name between the news and the @.

Donald Arseneau

unread,
Jan 14, 2004, 6:18:28 AM1/14/04
to
Jason Lewis <ja...@NOdicksonSPAM.st> writes:

> The problem i get is when I have a short section, wrapfigure puts my image
> about 1-2 sections later, rather than in the short section,

Utterly misleading description. Wrapfigure puts the figure where you
told it to.

I am surprised I read all the way down to:

> 1.3.5 Next Section starts below Image

So you want to skip down to below the figure and terminate wrapping
text. I have a macro for that,

\makeatletter
\def\wrapfill{\par
\ifx\parshape\WF@fudgeparshape
\nobreak
\ifnum\c@WF@wrappedlines>\@ne
\advance\c@WF@wrappedlines\m@ne
\vskip\c@WF@wrappedlines\baselineskip
\global\c@WF@wrappedlines\z@
\fi
\allowbreak
\WF@finale
\fi
}
\makeatother

Everyone: Please tell me if the fill function should be added to \WFclear,
or if a new command (\wrapfill) should be added.

Donald Arseneau as...@triumf.ca

Jason Lewis

unread,
Jan 14, 2004, 6:41:24 AM1/14/04
to
Ulrike,

You are correct, it is unreadable. I'll try and come up with a way of
making it more readable and repost.

Jason

Paul Thompson

unread,
Jan 14, 2004, 10:23:47 AM1/14/04
to
Have you looked into building minipages with the figure and text? That
way, you bind them together.

Christophe Jorssen

unread,
Jan 18, 2004, 6:46:43 AM1/18/04
to

"Donald Arseneau" <as...@triumf.ca> a écrit

> > 1.3.5 Next Section starts below Image
>
> So you want to skip down to below the figure and terminate wrapping
> text. I have a macro for that,
>
> \makeatletter
> \def\wrapfill{
[snip]

> }
> \makeatother
>
> Everyone: Please tell me if the fill function should be added to \WFclear,
> or if a new command (\wrapfill) should be added.

Thanks Donald for the macro. It is exaclty what I was looking for! In my
opinion, your new command \wrapfill should be added to your package.

Best regards

Kristof


Donald Arseneau

unread,
Jan 20, 2004, 9:52:48 PM1/20/04
to
"Christophe Jorssen" <christoph...@libre.fr> writes:

> "Donald Arseneau" <as...@triumf.ca> a écrit

> > Everyone: Please tell me if the fill function should be added to \WFclear,


> > or if a new command (\wrapfill) should be added.
>
> Thanks Donald for the macro. It is exaclty what I was looking for! In my
> opinion, your new command \wrapfill should be added to your package.

Something else I was thinking about would be an incompatible change:
The wraping could synchronize the line-count between paragraphs
(and only between paragraphs) by looking at the \pagetotal parameter.
Then, a big tabular could be counted as 10 lines for the wrapping.
I could even make it so it only synchronizes if there was no
explicit line-count parameter.

Donald Arseneau as...@triumf.ca

igo...@gmail.com

unread,
Jul 19, 2018, 2:06:11 PM7/19/18
to
On Wednesday, January 14, 2004 at 2:18:28 PM UTC+3, Donald Arseneau wrote:
> Donald Arseneau a..@triumf.ca



> Everyone: Please tell me if the fill function should be added to \WFclear,
> or if a new command (\wrapfill) should be added.
>
> Donald Arseneau

IMHO, both of them deserve being added and documented :) . Without them, user should place `wrapfigures` with a great care, as demonstrated here: https://tex.stackexchange.com/a/442369/143086 .

0 new messages