Page Layoutpicins | Image off the Page in multi-columned Environment

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
GPress
Posts: 1
Joined: Mon Aug 22, 2011 7:32 pm

picins | Image off the Page in multi-columned Environment

Post by GPress »

Hello,

Before my question, some background information.

I’ve created an algorithm (not latex) which will generate a catalog for a collection of books dynamically. A user supplies information to query an SQL database to retrieve book information and also defines the structure of the catalog in an XML file. Finally, through a series of automated steps, .tex files are generated which are then run through latex to create the catalog PDF file.

Everything works well except for adding images in which through trial and error I’ve discovered that the package picins works easily and well with the multicol package and looks great too. The only trouble I am encountering is that it appears that the picins package does not calculate when an image will appear off the page, so from time to time images appear off the page in the catalog.

Since these catalogs are generated automatically, the less human interaction the better. Adding \columnbreak prior to a paragraph which is textwrapped by parpic, does fix the issue, however performing this manually is not a solution since there are hundreds (perhaps thousands) of books which will make up each catalog.

Surrounding the paragraph and image in a \parbox will keep the image from going off the page; however it creates a lot of white space and adds pages to the catalog. Since this catalog will be printed, extra pages means more money, so white space must be kept to a minimum.

I'm quite stuck on a solution, I aplogize but my questions are broad. I appreciate your suggestions.

Would it make sense / is it possible to calculate the lines remaining in a column and use the IfThen package to insert a \columnbreak automatically?

Is there a better solution than picins which works nicely with the multicol package that will automatically break the column if the image will not fit?

Thank you for your help,
-Doug

For this MWE, I have supplied the image dog.png to be used with the example.

Code: Select all

\documentclass[english]{book}
\usepackage{multicol}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[includeheadfoot,top=.25in,bottom=.25in,left=.5in,right=.5in]{geometry}
\usepackage{graphicx}
\usepackage{picins}
\usepackage{blindtext}

\setlength{\columnsep}{0.375in}
	
\begin{document}
\begin{multicols*}{2}
\noindent\blindtext[5]\\
\pichskip{.25in}\noindent\parpic[sr][r]{\includegraphics[width=2in]{dog.png}\picskip{15}}
\blindtext
\end{multicols*}
\end{document}
Attachments
To be used with the MWE
To be used with the MWE
dog.PNG (116.92 KiB) Viewed 2422 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply