2

I would like to indent the first paragraph after a new section, but I don't want indent new lines.... I know indentfirst and parskip packages but they don't work together! I would like to combine the features of both, but parskip overrides indentfirst....

Thank you in advance!


Here it is a code example:

\documentclass[a4paper, oneside]{report}
\usepackage{indentfirst}
\begin{document}
%This is going to indent (ok):

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.

%This is going to indent (bad):

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.
\end{document}          


\documentclass[a4paper, oneside]{report}
\usepackage{parskip}
\begin{document}
%This is not going to indent (bad):
This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.

%This is not going to indent (ok):

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.
\end{document}
8
  • 1
    what do you mean by " don't want indent new lines." ? please always provide a small sample document and say what the intended output is. Aug 18, 2014 at 20:30
  • Do you want parskip instead for highlight the paragraphs?
    – dawu
    Aug 18, 2014 at 20:30
  • 2
    It's a bad typographical habit to use both. You may add some vertical skip for special paragraphs, of course, but not systematically if you indent first line of paragraph.
    – Bernard
    Aug 18, 2014 at 20:49
  • Let me add that for special paragraphs you would want to highlight, you can use an asterism, see this thread: tex.stackexchange.com/questions/194898/…
    – Bernard
    Aug 18, 2014 at 20:56
  • I added a code example, thank you in advance!
    – Kevin
    Aug 18, 2014 at 20:59

3 Answers 3

6

Background

Well, in the usual typographic practice is common to distinguish between classic paragraph: one that uses indentation (usually) as a mark of distinction between one and other. And the modern paragraph: one that dispenses with indents and instead distinguishes paragraphs with a blank line between them.

Of course, there are other types of paragraphs but are not so popular and understand the differences between the above two is enough. None is better than another, but the truth is that no matter what you have to decide to use, you need to be consistent about it and never mix them.

Normally in LaTeX text is composed in classic paragraphs, unless the preamble otherwise specified.

Now regarding indents, they are a visual marker to show where one paragraph ends and another begins. However, it is redundant in opening paragraphs and sometimes after some floating objects if the blank behind them is enough to give the reader understand that it is a new paragraph and not a continuation of the previous one. As in the case you are asking for.

The reason

The rule is simple: never indent a paragraph just after a head, whatever it is.

Because it is redundant and unnecessary. The header itself tells you that then starts a new paragraph, hence the bleeding is superfluous.

Sometimes I remove indents in other locations, for example in mini pages when used to compose legal pages.

On the automation of this task with a package, it would be interesting to know, I've done very shallow tests long time ago and I was not satisfied.

In a nutshell

What you ask is possible to do in LaTeX, but it is not recommended. There is a tradition of publishing for more than five centuries that has embodied certain canons not on the whim or the imposition of a few, but by the reason and functionality proven over time.

In other words, do not indent the first line after a header, there is not need for it and no reason to justify it the sake of readability, which should be the reason why could do this. And ironically, is what would be most affected.

Regards.

2
  • Down vote as you've written a long polemic which does nothing to answer the original question.
    – richard
    Dec 10, 2022 at 20:53
  • Well, thank you... I guess. I wrote this many years ago, I'll have to reread it and reflect on it.
    – Aradnix
    Dec 13, 2022 at 3:25
3

Although I think Aradnix is absolutely right with what he's saying at a conceptional level (you shouldn't use what you are asking for), I'll give you another possibility of realizing it.

I extended skpblack's answer and appended his \ind to \section, so don't have to call it manually. I used Werner's answer from How to append code to a section? to do this.

Code

\documentclass[a4paper, oneside]{report}

\newlength{\oldparindent}
\setlength{\oldparindent}{\parindent} % Save \parindent before of change

\setlength{\parskip}{0.5\baselineskip \advance\parskip by 0pt plus 2pt} % Definition of `parskip`

\setlength{\parindent}{0pt}

\newcommand{\ind}{\hspace*{\oldparindent}} % Command to indent manually

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@xsect} % <cmd>
  {\ignorespaces}  % <search>
  {\ind}           % <replace>
  {}{}             % <success><failure>
\makeatother

\begin{document}

\section{First}
This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing. 

\section{First}
This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing. 

\end{document}

Document

Result

Advice

As I said: Follow Aradnix's description and avoid this strange way of indention. One rule I had to learn when I started using LaTeX, was only to change its defaults when I have a rational and justifyable reason for doing that. And I don't see any reason to do what you want to do. Or do you?

4
  • I was looking for something like this but maybe not searched enough.
    – skpblack
    Aug 19, 2014 at 0:37
  • I understood your point of views, but this is a long thesis and not an article or short report. I am in an early stage and I have to write a lot of things and conceptually separate, often I have to leave unfinished paragraphs. So in this stage, for mental organization, I have to use in the editor a lot of vertical spaces with enter key. In the end the temporary result is a lot of unwanted indentation. So I would like avoid indentation in this stage but not the first one, because I personally like it.
    – Kevin
    Aug 19, 2014 at 8:22
  • I have got a different file for different chapters and the command \patchcmd{\@xsect} doesn't find sections in these different files. Is there any workaround? Thank you so much!
    – Kevin
    Aug 19, 2014 at 9:14
  • @Vincenzo well I'm writing a long thesis too and I don't need additional indentation. I don't use the patchcmd package, I prefer to use todonotes and add notes in this stage for temporary results. If you enjoy to avoid the indentation in the paragraphs but in the first is ok, but then perhaps you should use modern paragraphs and blank lines for separate them, although it increases the paper requirements.
    – Aradnix
    Aug 19, 2014 at 17:28
1

As you want to indent only the beginning of the section, I think it's easier to do it manually (since it is not at all paragraph), so I created a new command \ind (like \indent but it works with \oldparindent) for it and to copy the definitions of parskip.sty saving \parindent (in \oldparindent) before of change it.

Here my code

\documentclass[a4paper, oneside]{report}
\newlength{\oldparindent}
\setlength{\oldparindent}{\parindent} % Save \parindent before of change
\setlength{\parskip}{0.5\baselineskip \advance\parskip by 0pt plus 2pt} % Definition of `parskip`
\setlength{\parindent}{0pt}
\newcommand{\ind}{\hspace*{\oldparindent}} %Command to indent manually
\begin{document}
\section{First}
\ind This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing.

This life, which had been the tomb of his virtue and of his honour, is but a walking shadow; a poor player, that struts and frets his hour upon the stage, and then is heard no more: it is a tale told by an idiot, full of sound and fury, signifying nothing. 
\end{document}

enter image description here

So what you should do is put \ind after each \section{}.

0

You must log in to answer this question.

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