# How to take the following paragraph

I'm new to TeX and I'm a bit lost. Could someone tell me how this should be written (marked 'PROBLEM HERE' in the code)

Situation: When argument #2 is space (empty paragraph), I want to use next paragraph

\def\adjustParagraph#1\par{...some code here (which works ok)...}

\if #2 {\adjustParagraph}   % if argument #2 is a space (empty paragraph) <= PROBLEM HERE
\else{\adjustParagraph#2\par}   % argument #2 is text
\fi}

Lorem ipsum dolor sit amet consectetuer ...

This time, argument 2 is that blank space above this line...

• egreg's answer here is plain tex (some of the others assume latex) tex.stackexchange.com/questions/89365/… (by the way if you are new, using plain TeX is a slightly odd choice: most people use a format designed for document production such as latex or context) – David Carlisle Dec 13 '13 at 22:53

I wouldn't use delimited arguments. Moreover \headline conflicts with the output routine, so I used \Headline for your macro instead.

\def\adjustParagraph#1\par{...some code here (which works ok)...}

\expandafter\ifx\space#2
\else
\adjustParagraph#2\par   % argument #2 is text
\fi
}

Lorem ipsum dolor sit amet consectetuer ...


1. \expandafter\ifx\space#2 will detect if #2 starts with a space token (and the rest will be ignored in case it doesn't.
2. \expandafter\adjustParagraph must be used in the “true” branch to get rid of \else.
• It didn't work with (1.). However, without (1.) and with (2.) (\if #2 \expandafter\adjustParagraph...) works, so thanks a lot. – McLayn Dec 14 '13 at 1:15