Graphics, Figures & TablesGraphics - margin and wrapping around

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
krz
Posts: 63
Joined: Thu Jul 22, 2010 5:03 pm

Graphics - margin and wrapping around

Post by krz »

Hi!
I still fight with my book and another problem appeared. I need to place some pictures. So, I've used this of course:

Code: Select all

\begin{figure}[t]
\begin{center}
\includegraphics[width=120mm]{photo1.jpg}
\caption{Photo}
\end{center}
\end{figure}
The pictures is set, but the whole text on this page moves down about 5 mm. The bottom margin is smaller than on the other pages and the lines on this page don't agree with the lines on the other pages (I hope I explain it clear). Do you know how to set the bottom margin permanently for every page? By the way I use geometry package to set page and textsize.

Code: Select all

\usepackage[
  centering,
  headheight=24pt,
  headsep=11pt,
  includeheadfoot,
  papersize={160mm,235mm},
  text={120mm,195mm},
]{geometry}
And second problem is wrapping the text around the picture. I use the package wrapfig and this:

Code: Select all

\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{picture.jpg}
  \end{center}
  \caption{picture}
\end{wrapfigure}
but the text doesn't wrap it around but it's on the picture. Nothing happens with the text. It doesn't move right or left.
Thanks for your help!
krz
Last edited by krz on Wed Dec 29, 2010 9:12 am, edited 3 times in total.

Recommended reading 2024:

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

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

meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Graphics - margin and wrapping around

Post by meho_r »

As you can see, nothing unexpected happened:

Code: Select all

\documentclass{book}

\usepackage[
  centering,
  headheight=24pt,
  headsep=11pt,
  includeheadfoot,
  papersize={160mm,235mm},
  text={120mm,195mm},
]{geometry}

\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\usepackage{lipsum}% just to generate dummy text

\begin{document}

\lipsum[1-3]% dummy text

\begin{figure}[t]
\begin{center}
\includegraphics[width=120mm]{photo1.jpg}
\caption{Photo}
\end{center}
\end{figure}

\lipsum[1-6]% dummy text

\clearpage

\lipsum[1]% dummy text

\begin{wrapfigure}{r}{0.5\textwidth}
  \begin{center}
    \includegraphics[width=0.48\textwidth]{picture.jpg}
  \end{center}
  \caption{picture}
\end{wrapfigure}

\lipsum[1]% dummy text

\end{document}
So, please start from here and provide a Minimal Working Example (MWE) which shows the issue clearly.
Attachments
test.pdf
(25.03 KiB) Downloaded 270 times
krz
Posts: 63
Joined: Thu Jul 22, 2010 5:03 pm

Graphics - margin and wrapping around

Post by krz »

So, I'm not sure if I caught the idea of MWE, but I used a building up method (as I understood it) and... it works! :)
The problem was

Code: Select all

\setlength{\parskip}{0pt}
Thanks!
krz
Posts: 63
Joined: Thu Jul 22, 2010 5:03 pm

Re: Graphics - margin and wrapping around

Post by krz »

Unfortunatelly it isn't the end of troubles. I delete \setlength{\parskip}{0pt} and spaces between paragraphs appeard (now I remember I used it to delete this space). Do you know how I can fix it without \parskip?
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Graphics - margin and wrapping around

Post by meho_r »

I can guess. If you remove \setlength{\parskip}{0pt}, you get spacing between paragraphs on some pages, but not all. If that is the case, try adding into the preamble

Code: Select all

\raggedbottom
This command would change LaTeX's default behaviour which is to add a little space between paragraphs, after sectioning units etc. to keep "squared pages", i.e., the last lines on pages to be "in line". \raggedbottom prevents additional space to be added, but you might pay that in terms of non-squared pages.
krz
Posts: 63
Joined: Thu Jul 22, 2010 5:03 pm

Re: Graphics - margin and wrapping around

Post by krz »

Thank you, meho_r! I added it and spaces disappeared. Could you explain me what do you mean by "non-squared" pages?
As going to my fighting with this spaces I noticed the problem is in {geometry}. When I started to build document with minimal amount of packages and options, problems appeared when use {geometry} (even in the pdf that you generated I could see a bit wider space between two paragraphs). So, I used this package, because I needed to get not typical size (a bit smaller than B5 format). Mabye you know how to do this without {geometry}? I tried \special{papersize=...}, \paperwidth but it didn't work.
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

Graphics - margin and wrapping around

Post by meho_r »

By "squared pages" I mean the case when the last lines on two consecutive pages (the spread) are aligned and whole space on a page (vertically) is filled (with text, images, tables etc.), from top to bottom. It happens that TeX, with \raggedbottom option active, leaves a page one or two lines short and moves them to the next page (e.g., in case of widows and orphans), which breaks squared look of text blocks on a spread.

I don't know in which way geometry package may be the cause of this issue of yours, but if you really want to avoid it, you may give memoir document class a go, it has its own way to define page geometry.
krz
Posts: 63
Joined: Thu Jul 22, 2010 5:03 pm

Re: Graphics - margin and wrapping around

Post by krz »

Thank you for explanation. Yes, I could see in my book empty line because of widows and orphans, but on the other hand, I don't know if there is other method to avoid it.
So, now it looks good. I hope it's ok until the end of it.
Thanks for the information about memoir class. I'll study it later, but this book I'm going to finish with method I used (if no surprises happen).
Post Reply