parskip package, keep the indents

That may be a stupid question but is there a way to keep the indent while using the parskip package? I use parskip to keep spacing between my paragraphs while leaving the table of contents and lists intacts but I would like to keep the indents in my text.

Code 1 :

\usepackage{parskip}

\tableofcontents

\section{Section 1}
\subsection{Sub 1}

Paragraph 1

Paragraph 2


Code 2

\setlength{\parskip}{10pt}

\tableofcontents

\section{Section 1}
\subsection{Sub 1}

Paragraph 1

Paragraph 2


Basically I want the aspect of the table of contents (and possible lists) from the code 1 while keeping the indent like in the code 2. The package parskip works great but I just don't like that it deletes the indents and I'd like to find a way to prevent it from doing that.

Thank you.

• Please, show us a minimal code so we can compile and see what you want. – Sigur May 31 '14 at 14:53
• I've added the code. – AdrienNK May 31 '14 at 15:02
• – barbara beeton May 31 '14 at 19:24

Package parskip sets \parindent to zero. The following example saves the old value, loads parskip and restores \parindent:

\documentclass{article}

\edef\restoreparindent{\parindent=\the\parindent\relax}
\usepackage{parskip}
\restoreparindent

\begin{document}
\tableofcontents

\section{Section 1}
\subsection{Sub 1}

Paragraph 1

Paragraph 2
\end{document}


• Wouldn't it be better to save the old value of \parindent in another register and then restore it, instead of using \the? This is a genuine question: is the output from \the precise enough to set a register to the original value? – Kalrish Sep 15 '16 at 20:53
• @Kalrish The output of \the has enough decimal places to restore the old value correctly. The smallest unit in TeX is: 1 sp = 1/65536 pt ≈ 0.000015258789 pt. Compare with the smallest unit of five decimal places, the "precision" of \the: 0.00001 pt. – Heiko Oberdiek Sep 15 '16 at 21:43

There seems to be no reason for the parskip package to set \parindent to zero, except its author's preferences.

The simplest way to have parskip behave in accordance with its name is to comment this "feature" in parskip.sty — and as suggested by musarithmia, preferably have it saved as a new whatever.sty file in your texmf tree (then use (sudo) texhash to have it seen by LaTeX and of course \usepackage{whatever}) :

% \parindent=\z@

• I don't think it's a good idea to start changing package code directly. For one, this site depends on the assumption that everyone is using the same code base. This is what \renewcommand is for. Also, the parskip package is so minimal that you might as well copy the code into a separate file in your home texmf tree, change it how you like, and call it parsep.sty or whatever you like. – musarithmia Sep 5 '17 at 13:21
• @musarithmia Right, still commenting this line is by far the simplest solution. Thanks for the comment, see edited answer. – Skippy le Grand Gourou Sep 5 '17 at 13:55
• No need for texhash if you put it in ~/texmf/tex/latex/local/ or in the same directory as the .tex file. – musarithmia Sep 5 '17 at 15:16