# Define a command to affect everything until the end of the paragraph?

Is it possible to define a command so that it affects everything until the end of the current paragraph?

As a minimal example, I am trying to define a command using syntax similar to the following:

\documentclass{minimal}
\begin{document}

\fancycommand Laugh, and the world laughs with you.
Weep, and you weep alone.

\end{document}

Where \fancycommand affects all of the following text from the same paragraph including any line-breaks (for example, doing a number of text transformations), but not any subsequent paragraphs. The command cannot use braces around the rest of the paragraph.

If this is not possible, is it possible to do something similar until the end of the current line?

-

You can use \par as delimiter and scan the paragraph as one argument.

\def\fancycommand #1\par{#1\par}

Note, that you need to re-add the \par.

-
Two limitations: \par or an empty line must be given explicitly, it cannot be hidden in other macros. Verbatim stuff makes problems, because the catcodes are already set by the previous reading from \fancycommand. – Heiko Oberdiek Oct 25 '12 at 3:02

A possibility is to say

\def\fancycommand{%
\begingroup\def\par{\endgroup\par}%
% <other setup>
}

It much depends on what you have to do in <other setup>. For instance, here is a version that italicizes, just write \itshape in place of <other setup>

Here the trick is that \endgroup will remove the redefinition of \par, so the inserted \par will be whatever it was when TeX encountered \fancycommand. Of course a \par (or an empty line) should be present in order to terminate properly the special setting.

-