1

I was wondering how I can justify the text without making it indenting with \justifying. I'm using

\usepackage[parfill]{parskip}

Secondary question:

Any way how to increase the parskip distance, by the way?

Thanks!

FSJ963
  • 529
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Oct 04 '14 at 18:47
  • What exactly do you mean by "justify the text without making it indenting with \justifying? Do you maybe want the lines of a paragraph be typeset ragged-right? – Mico Oct 04 '14 at 18:53
  • Well, I want the text to be justified, i.e. nice aligned with left and right margin, but don't want the first line to be intended. – FSJ963 Oct 04 '14 at 19:04

2 Answers2

3

Text is justified to both margins by default. To control the indentation of the first line and spaces between paragraphs you need only set respectively \parindent and \parskip lenghts, without any package.

An example with some exaggerated values to see clearly the result:

\documentclass{article}
\usepackage{lipsum} % for example dummy text
\setlength{\parskip}{2cm}
\setlength{\parindent}{5em}
\begin{document}
\lipsum[1-3] 
\end{document}

MWE

Note that often in LaTex you can use extensible ans/or shrinkable lenghts (see What is glue stretching?) so one can use some like:

\setlength{\parskip}{2cm plus 1.9cm minus 1.9cm}

or

\setlength{\parskip}{2cm plus 1 fill minus 0 cm}

Experiment adding a paragraphs in the MWE (e.g. change \lipsum[1-3] to \lipsum[1-4]) and see the effect with this or another settings.

A more reasonable settings could be:

\setlength\parskip{.5\baselineskip plus .1\baselineskip minus .1\baselineskip}
\setlength\parindent{0pt}

(These are exactly the setting for the artikel3 document class, cited in the parskip documentation)

Fran
  • 80,769
  • Not 100% an answer to my question, but I can derive what I need from your answer; thanks. – FSJ963 Oct 04 '14 at 19:23
  • @MichaëlHenrotte You're welcome. Just curiosity: Could you explain what is not answered? – Fran Oct 04 '14 at 19:31
  • Your sourcecode includes indentation of 5em ;) I just put it to 0 to remove it. – FSJ963 Oct 04 '14 at 19:47
  • @MichaëlHenrotte It was only a example of what to change, obviously an indent of 5em is really ugly, but note that below I already included "reasonable settings" ;) with \parindent=0pt – Fran Oct 04 '14 at 20:09
  • Oh God, I'm blind... Forgive me D: – FSJ963 Oct 04 '14 at 20:18
  • @MichaëlHenrotte It would be better to use the parskip package since that package makes additional adjustments to prevent the increased parskip having unwanted side-effects. That is, the point of the package is precisely that it does not just adjust the parskip and parindent but also configures other aspects of layout appropriately in light of those changes. – cfr Oct 04 '14 at 20:45
3

It is better to use the parskip package (as shown in the question) than to just adjust the parskip and parindent yourself unless you are also prepared to make the kinds of adjustments required to avoid the side-effects of these changes.

In addition to adjusting these lengths, parskip does some basic work to avoid excessive spacing in list environments. Even if you do not think you use lists, you probably do since many LaTeX environments are based on lists. For example, quotation is a trivial list environment and there are many others.

Here is a document which just adjusts the lengths by hand based on Fran's answer:

\documentclass{article}
\usepackage{lipsum} % for example dummy text
\setlength\parskip{.5\baselineskip plus .1\baselineskip minus .1\baselineskip}
\setlength\parindent{0pt}
\begin{document}
  \lipsum[1]

  \begin{quotation}
    \lipsum[2]
  \end{quotation}

  \lipsum[3]

  \begin{itemize}
    \item This is the first item in a list of several items, which is preceded by none but followed by some.
    \item This is the second item in a list of several items, which is preceded by some and followed by some.
    \item This is the third item in a list of several items, which is preceded by some and followed by some.
    \item This is the fourth item in a list of several items, which is preceded by some but followed by none.
  \end{itemize}

  \lipsum[4]
\end{document}

excessive spacing of lists

As can be seen, excessive spacing is left around the quotation and list, in comparison with that which is left between regular paragraphs.

Here is the same document using parskip with default adjustments:

\documentclass{article}
\usepackage{lipsum} % for example dummy text
\usepackage[parfill]{parskip}
\begin{document}
  \lipsum[1]

  \begin{quotation}
    \lipsum[2]
  \end{quotation}

  \lipsum[3]

  \begin{itemize}
    \item This is the first item in a list of several items, which is preceded by none but followed by some.
    \item This is the second item in a list of several items, which is preceded by some and followed by some.
    \item This is the third item in a list of several items, which is preceded by some and followed by some.
    \item This is the fourth item in a list of several items, which is preceded by some but followed by none.
  \end{itemize}

  \lipsum[4]
\end{document}

default adjustments with <code>parskip</code>

It is still very possible to adjust the parskip while benefiting from the package's improved layout of list environments. This example uses the same parskip as that in the first document and as specified in Fran's 'reasonable' settings:

\documentclass{article}
\usepackage{lipsum} % for example dummy text
\usepackage[parfill]{parskip}
\setlength\parskip{.5\baselineskip plus .1\baselineskip minus .1\baselineskip}
\begin{document}
  \lipsum[1]

  \begin{quotation}
    \lipsum[2]
  \end{quotation}

  \lipsum[3]

  \begin{itemize}
    \item This is the first item in a list of several items, which is preceded by none but followed by some.
    \item This is the second item in a list of several items, which is preceded by some and followed by some.
    \item This is the third item in a list of several items, which is preceded by some and followed by some.
    \item This is the fourth item in a list of several items, which is preceded by some but followed by none.
  \end{itemize}

  \lipsum[4]
\end{document}

<code>parskip</code> package with manual set of <code>parskip</code> length

As can be seen, the manual adjustment of the parskip length does not undermine the enhancements to layout achieved by loading the parskip package. So this option offers the best results with standard classes.

That is, some classes are designed to accommodate non-zero parskip and zero parindent in their design, and these will likely have more fine-grained tuning. But for classes which are not so designed, loading the package parskip instead of, or in addition to, setting the parskip length explicitly will give the best results.

To avoid the oddity of the indented paragraph in the quotation, either use quote rather than quotation or let the latter environment be equal to the former one:

\documentclass{article}
\usepackage{lipsum} % for example dummy text
\usepackage[parfill]{parskip}
\setlength\parskip{.5\baselineskip plus .1\baselineskip minus .1\baselineskip}
\let\quotation\quote
\begin{document}
  \lipsum[1]

  \begin{quotation}
    \lipsum[2]
  \end{quotation}

  \lipsum[3]

  \begin{itemize}
    \item This is the first item in a list of several items, which is preceded by none but followed by some.
    \item This is the second item in a list of several items, which is preceded by some and followed by some.
    \item This is the third item in a list of several items, which is preceded by some and followed by some.
    \item This is the fourth item in a list of several items, which is preceded by some but followed by none.
  \end{itemize}

  \lipsum[4]
\end{document}

<code>parskip</code>, adjusted <code>parskip</code> and fixed <code>quotation</code>

cfr
  • 198,882
  • Very nice answer. Thank you for the completeness. – FSJ963 Oct 04 '14 at 21:44
  • @cfr The lists were not in the question, but BTW the "excessive spacing" is rather a matter of taste. One can also change this, and not necessarily the best for everyone is set \parsep = \parskip, \itemsep = \z@, \topsep = \z@ and \partopsep = \z@. – Fran Oct 04 '14 at 22:25
  • @Fran Of course. You can replicate what any package does in your document if you wish. That's why I say that you shouldn't just adjust things manually 'unless you are also prepared to make the kinds of adjustments required to avoid the side-effects of these changes.' Obviously, if you are so prepared, that is different. And while parskip's choices may not be ideal, many people do seem to find the results less ideal if no additional adjustments are made. Lists were not in the question because it is an MWE. Most documents use lists in some way. – cfr Oct 04 '14 at 22:41
  • Replacing parskip with manual adjustments is likely to give unexpected results. Obviously, if somebody actually prefers what I referred to as 'excessive spacing', that is their prerogative. They are free to eschew the parskip package as you suggest. – cfr Oct 04 '14 at 22:42
  • @cfr I agree that this package have their utility, but citing a comment of parskip.sty: "This package is no more than quick fix; the `proper' way to achieve effects as far-reaching as this is to create a new class. An example class is to be found in the ntgclass set: artikel3.cls" – Fran Oct 04 '14 at 23:06
  • @Fran Indeed. That's why I said that this was best *unless using a class designed with options for non-zero parskip and zero parindent in mind. Classes which provide such options will typically give superior results. The recommendation is to use parskip rather than merely setting the lengths manually* - not to use it rather than a class designed to support this layout. So, yes, artikel3.cls almost certainly would give better results. But switching class is a lot more disruptive - hence Robin Fairbairns provides parskip. – cfr Oct 04 '14 at 23:11