# [texhax] Flagging when a \parindent falls at top of page (UNIV: Plain XeTeX)

Philip Taylor P.Taylor at Rhul.Ac.Uk
Thu Aug 25 15:41:23 CEST 2016

In a book on which I am currently working, and following the example I established in earlier books, I have adopted the convention of "minimal indentation" -- \parindent is suppressed whenever it adds nothing significant (IMHO) to the page.  So, for example \parindent is suppressed (a) after full-width inserts, (b) at the start of a paragraph that commences at the same level as the top line of an part-width insert floated left, and so on.  And, in particular, \parindent is (manually) suppressed at the top of a new page.  Now, it is (relatively) easy to detect when \parindent suppression occurs in the _/*wrong*/_ place (i.e., when a manually inserted \noindent does /*not*/ end up at the top of a page, using TeX's intrinsic top-of-page discard behaviour w.r.t. leaders) [1], but I have not yet found a way to detect when (automatic) paragraph indentation occurs (wrongly) at the top of a page.  Any suggestions as to how to accomplish this will be gratefully received.  Note that I
am not attempting the impossible -- I know that without a multi-pass approach, or the use of an adjunct programming language such as that offered by LuaTeX,  I cannot automatically /suppress/ paragraph indentation at top of page :  I merely want to be warned (either in the log file, or even in the PDF itself) if such paragraph indentation has in fact occurred.

[1]

\newbox \errorbox

\setbox \errorbox = \leftline {+++ NOT AT TOP OF PAGE +++}

\def \errormsgbox {\copy \errorbox}

\def \assert #1%

{%

\endgraf \leaders \errormsgbox \vskip 2 \ht \errorbox \relax

\noindent \ignorespaces

}

% Usage :  \assert {newpage}

--

Philip Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20160825/5dfd06e2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Signature.jpg
Type: image/jpeg
Size: 12104 bytes
Desc: not available
URL: <http://tug.org/pipermail/texhax/attachments/20160825/5dfd06e2/attachment-0001.jpg>