Page LayoutTitlesec and wrapfig produces too much white spots.

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Coanda
Posts: 2
Joined: Mon Mar 21, 2011 2:32 pm

Titlesec and wrapfig produces too much white spots.

Post by Coanda »

Using the titlesec package, I want to remove the whitespace above the chapter heading. Using the code below the whitespace is removed, but there is a problem when using the wrapfig package. The area that is reserved for the wrapfig environment is copied to every paragraph. I.e. every paragraph has a large empty spot. How can I remove these extra white spots?

Code: Select all

\documentclass{book}

\usepackage[pdftex]{graphicx}
\usepackage{lipsum}
\usepackage[compact]{titlesec}
\usepackage{wrapfig}

\titlespacing{\chapter}{0pt}{-40pt}{20pt}[0pt]
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

\begin{document}

\chapter{test}
\begin{wrapfigure}{r}{0.60\textwidth}
    \includegraphics[width=0.58\textwidth]{figures/test.jpg}
\end{wrapfigure}

\lipsum

\end{document}

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

Coanda
Posts: 2
Joined: Mon Mar 21, 2011 2:32 pm

Titlesec and wrapfig produces too much white spots.

Post by Coanda »

It seems that the problem only occurs on my computer and not on other computers. I've attached a screenshot of the example in the previous post.

The following example does work on my computer, although the text is not aligned nicely close to the figure:

Code: Select all

\documentclass{book}

\usepackage[pdftex]{graphicx}
\usepackage{lipsum}
\usepackage[compact]{titlesec}
\usepackage[rflt]{floatflt}

\titlespacing{\chapter}{0pt}{-40pt}{20pt}[0pt]
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

\begin{document}

\chapter{test}
\begin{floatingfigure}[r]{0.60\textwidth}
    \includegraphics[width=0.58\textwidth]{figures/test.jpg}
\end{floatingfigure}

\lipsum

\end{document}
Attachments
Screenshot of the example in the previous post.
Screenshot of the example in the previous post.
screenshotLaTeX.PNG (67.31 KiB) Viewed 1824 times
Post Reply