If the first line on a page happens to be the first line of a paragraph at the same time, I would like not to indent it (just as if it is the first line of a section). Is there a way to do this automatically? I don't want to use \noindent command, because if this line moves elsewhere, I want to indent it.

Thanks ahead for help!

  • 1
    @Daniel: You may well get a bigger choice of answers over on tex.stackexchange.com Mar 28, 2011 at 12:43
  • @Brent: Thanks for link, haven't known this website :).
    – Daniel Langr
    Mar 28, 2011 at 13:06
  • 8
    That might not be a good idea, as the reader will have no way ot knowing if the text is a continuation from the page before.
    – daleif
    Mar 28, 2011 at 13:16
  • 1
    @Daniel: By this argument, you would never need an paragraph indent. Mar 28, 2011 at 15:54
  • 1
    Ok, ok, I agree with your arguments, will let the indentation there :). Thank a lot. Mar 29, 2011 at 11:45

3 Answers 3


First, I don't think this is a great idea. One problem is that if the previous paragraph ended with a full line, there will be no clue that there is a paragraph break (I suppose you could avoid this by setting \parfillskip=3em plus1fil to ensure an unfilled final line).

Anyway, to answer your question, this will be very tricky, because TeX generates paragraphs before it looks at page breaking, so by the time it knows that the first line starts on a new page it is too late to do anything about it. You will need to write something into the aux file at the beginning of each paragraph (using \everypar) that you can read back on subsequent runs to determine if this paragraph starts a new page, and if it does, to remove the indent. Unfortunately, the new linebreaks may now change the page breaking and you may need to retex repeatedly, and there is no guarantee that this process will converge.

EDIT: here is the core of a solution, to show that it is possible. It will produce a bunch of errors the first time you compile it, and it doesn't redefine \everypar in a way that plays well with other packages, but it shows the basic idea.

EDIT 2: fixed the code up a little (the previous version removed the indent for the first paragraph of the page, no matter if it started on first line of page or not)

\raggedbottom % to allow short pages
\addtolength{\topskip}{0pt plus 10pt} % to help allow short pages
\usepackage{lipsum} % for dummy text
\interlinepenalty=1000 % just for example, to encourage paragraphs to start on new pages
    \ifnum \@nameuse{mypar@b\theparno}=\@nameuse{mypar@e\@arabic{\numexpr\value{parno}-1}}%
\lipsum[1-60]% dummy text
  • How would one go about redefining \everypar in a way that does play well with other packages?
    – Bananguin
    Jul 25, 2014 at 7:54

Right at the begining of the line that you don't want to indent, type:


For example:

This is the introduction.
  • 1
    Sorry, I did not read that you did not want to use noindent ;)
    – Escualo
    Mar 28, 2011 at 16:02
  • 2
    The OP wants automatic detection if the paragraph is at the top of a page. Moreover, after \section you usually don't need \noindent anyway. Mar 28, 2011 at 16:07

ConTeXt provides a \beforeeverypagebody token list that are executed, well, before a page body is constructed. There is also a \aftereverypagebody which is executed after the page body is constructed; and \beforeeveryshipout and \aftereveryshipout that are executed before and after a page is shipped.

To do what you want, you just need to add

\appendtoks \noindentation \to \everybeforepagebody

For some reason, this does not work on the very first page. However, you can just add a \noindentation to get rid of the indent on the first page. Thus, the following gives what you want:

\appendtoks \noindentation \to \everybeforepagebody


\starttext \noindentation

\input knuth 

\input knuth

  • 1
    Does this or a similar function exist for xelatex?
    – Til Hund
    Mar 8, 2017 at 23:22
  • 1
    @TilHund: No, but the solution posted by Lev Bishop should work with xeletax as well
    – Aditya
    Mar 9, 2017 at 0:59

You must log in to answer this question.

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