3

I have a following code

\documentclass[parskip=half]{scrbook}

\usepackage{tikz,lipsum}
\input{insbox}

\begin{document}

\InsertBoxR{0}{%
\begin{tikzpicture}
\draw (0,0) rectangle(3,3);
\end{tikzpicture}}

\lipsum

\end{document}

and it returns Overfull \hbox. I figured out that parskip option is the culprit. And yes, I know there was a similar question posted, but I do not know how to apply the solution, because my problem is not related to tcolorbox:

"Overfull \hbox" when using tcolorbox with parskip=half KOMA-option

Can you help me with this one?

2
  • If you don't like the \parfillskip setting of parskip=half, try parskip=half-. If you want to keep parskip=half, inxbox has to be changed somehow to work with \parfillskip > 0pt plus 1fil without warning. Maybe patching in a local change of \parfillskip would be possible. BTW: Using wrapfig2 works without overfull \hbox.
    – cabohah
    Commented Jun 17, 2023 at 13:35
  • @cabohah I am aware of half-, but I do not know how will "There is no spacing requirement at the end of the last line of a paragraph." mess with the style of the remaining text.
    – Pygmalion
    Commented Jun 17, 2023 at 13:38

2 Answers 2

2

You could use wrapfig2 instead of insbox:

\documentclass[parskip=half]{scrbook}

\usepackage{tikz,lipsum}
\usepackage{wrapfig2}

\begin{document}
\begin{wrapfigure}{r}
\begin{tikzpicture}
\draw (0,0) rectangle(3,3);
\end{tikzpicture}
\end{wrapfigure}
\lipsum

\end{document}

This also results in

result using wrapfig2

but without Overfull \hbox.

As an alternative you can also try wrapfig:

\documentclass[parskip=half]{scrbook}

\usepackage{tikz,lipsum}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}{r}{0pt}
\begin{tikzpicture}
\draw (0,0) rectangle(3,3);
\end{tikzpicture}
\end{wrapfigure}
\lipsum

\end{document}

result in:

result using wrapfig

also without Overfull \hbox.

To get the same result as with wrapfig2 you need the optional narrow lines argument:

\documentclass[parskip=half]{scrbook}

\usepackage{tikz,lipsum}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}[7]{r}{0pt}
\begin{tikzpicture}
\draw (0,0) rectangle(3,3);
\end{tikzpicture}
\end{wrapfigure}
\lipsum

\end{document}

or

\documentclass[parskip=half]{scrbook}

\usepackage{tikz,lipsum}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}[\dimexpr (3cm+.5\baselineskip)/\baselineskip\relax]{r}{0pt}
\begin{tikzpicture}
\draw (0,0) rectangle(3,3);
\end{tikzpicture}
\end{wrapfigure}
\lipsum

\end{document}
3
  • I guess there was a reason why I used insbox. With wrapfig2 I just get zillion errors in my document and it never compiles to the end :(.
    – Pygmalion
    Commented Jun 17, 2023 at 14:08
  • @Pygmalion If you have a problem with wrapfig2, ask a corresponding question (with MWE). My example works without error. BTW: Zillion error messages are seldom the result of zillion errors. Even a single issue can result in lots of error messages.
    – cabohah
    Commented Jun 17, 2023 at 15:53
  • @Pygmalion As one more alternative, I've also added three examples with wrapfig instead of wrapfig2.
    – cabohah
    Commented Jun 17, 2023 at 16:01
2

It's a standard problem with parskip=half in KoMa classes: this option adds some natural width to \parfillskip.

Solution: don't use parskip. But if you really want to produce a bad looking document 🤭, do

\documentclass[parskip=half-]{scrbook}
7
  • I just tried without parskip and the text is horribly crammed. I am no expert in typography, but it hurts my eyes. I can't believe this is the right way. Between parskip=half and parskip=half- I see no obvious difference.
    – Pygmalion
    Commented Jun 17, 2023 at 18:06
  • @Pygmalion The idea for half is to avoid that paragraphs end too near to the right margin. Anyway, take a book off the shelf and look whether it uses spaced paragraphs.
    – egreg
    Commented Jun 17, 2023 at 19:22
  • You are mostly right, most books with exception of some newer engineering books, do not use spaced paragraphs. I only realised that now, and I have already wrote several books in several languages the "wrong" way. I cannot understand why no designer from any publisher ever complained... I am both sad and angry and who knows what else is wrong with the book I am writing right now. I'd probably fare better if I wrote books in MS Word and then force publishers do all the design, damn it!
    – Pygmalion
    Commented Jun 17, 2023 at 21:34
  • 1
    @Pygmalion I don't like spaced paragraphs, as you have probably realized. But it's not the same as stealing sheep. In the 20's of the 20th century this method became very fashionable, but later the great typographer Jan Tschichold retracted his support to the fashion. Spaced paragraphs can have their use, but in books they're just a waste of space. Experiment: there's no “right way”.
    – egreg
    Commented Jun 17, 2023 at 22:02
  • 1
    @Pygmalion That’s why I said there’s no “right way”. However, the indentation or lack thereof after a math display will tell the reader whether a new paragraph is starting.
    – egreg
    Commented Jun 18, 2023 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .