1

I tried to use this (via):

\everypar{\looseness=-1}

However, I'm not exactly sure where to put it. If I put it somewhere before \begin{document}, it doesn't seem to have any effect. If I put it after some \section{}, it has an effect but it removes all the space up to the title of the following section, and it seems to apply only for the current section.

Is that expected? I want that it is applied to the whole document. And I don't want to alter the space before section titles.

How can I achieve this?

3
  • You probably want to increase \linepenalty from its default value of 10 to, say, 200. This way, long paragraphs will tend to use less lines.
    – egreg
    Commented Mar 30, 2016 at 8:13
  • As @egreg suggests , If the real question is "how do I force latex to use a more compact setting to reduce the page count" then that's a reasonable question but it's a different question to this one. Commented Mar 30, 2016 at 8:25
  • Yes I know, but I guess this question would be the relevant then.
    – Albert
    Commented Mar 30, 2016 at 8:29

1 Answer 1

3

You need

\everypar{\looseness=-1 }

with a space to terminate the number, otherwise if the paragraph started with 3 \looseness would be set to -13...

Are you sure that you want to apply it to a whole document? It really isn't designed to be used that way, it is designed for final tweaks of page/line breaking (there are other better ways of trying to force a compact setting if that is the intention).

Also you can not set \everypar in LaTeX without taking note of the current setting, after headings and in lists latex is using \everypar to control indentation, or insert the list label etc.

that is why the comments on the referenced answer suggest

\everypar\expandafter{\the\everypar\looseness=-1 }

To re-insert the previous value of \everypar, however this is still likely to break something. Setting \looseness automatically to a fixed non-zero value just isn't really anything that should be supported.

6
  • I tried with the space but that doesn't change anything for me. The space before the next section title is still removed.
    – Albert
    Commented Mar 30, 2016 at 7:54
  • @Albert yes as I say you can not just over-write \everypar discarding its previous value as that will remove spaces, item labels, paragraph shape settings and anything else latex had set in \everypar. Commented Mar 30, 2016 at 7:55
  • @Albert see the comments on the answer that you quote. Barbara was using understatement by "may be side effects" she means "this will destroy your document settings" Commented Mar 30, 2016 at 7:58
  • @Albert that is why there is a suggestion to use \expandafter{\the\everypar to re-insert the previous value, I updated the answer a bit. Commented Mar 30, 2016 at 8:04
  • Ah, it sounds like you said that \everypar{\looseness=-1 } with the space should work to terminate the number, but it does not.
    – Albert
    Commented Mar 30, 2016 at 8:08

You must log in to answer this question.

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