I have checked No indent in the first paragraph in a section? but I think my question warrants a new thread, because my question is about Plain TeX.
I am using Plain TeX. I would like to write a \mysection macro that indents the paragraph following it, regardless of the whitespace that occurs between the invocation of \mysection and the paragraph.
As you can see below, \finickysection works but only if I am sure to put the % comments between its use and the paragraph. I would like \mysection to work with the invocation as written.
My MWE is:
\def\mysection#1{\vskip\baselineskip\noindent #1\vskip\baselineskip\everypar={\noindent\everypar={}}}
\def\finickysection#1{ \vskip\baselineskip \noindent #1 \vskip\baselineskip%
\noindent}
\finickysection{Hello}%
%
This is my first paragraph. Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\mysection{Hi}
This is my third paragraph. It should not be indented. Lorem ipsum dolor sit
amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.
This is my fourth paragraph. Lorem ipsum dolor sit amet, consectetur adipisicing
elit, sed do eiusmod tempor.
\bye
\nobreak. It's surely needed in your macro. You may also want to say\goodbreakinstead of\vskip\baselineskipbefore the section title – egreg Dec 06 '12 at 18:09\goodbreakyou're encouraging TeX to break a page. Actually I was thinking to\bigbreak, but I wrote\goodbreak: with\bigbreakyou get a flexible space\bigskipamountthat has natural width 12pt and some stretchability and shrinkability, in addition to a negative penalty. – egreg Dec 06 '12 at 21:32