# Changing paragraph begin/end commands

Is it possible to modify TeX/LaTeX commands so that certain commands are executed before/after a paragraph? For instance, we know that when the LaTeX compiler sees the \par command or a whitespace line, it ends the current paragraph and enters vertical mode (?).

So, I'm looking for a command that I could modify such that I could type

%redefine some commands up here

\begin{document}
Paragraph 1

Paragraph 2
\end{document}

and have it produce the same output as

\begin{document}
$\triangle$Paragraph 1

$\triangle$Paragraph 2
\end{document}

Another related question would be also producing output like

\begin{document}
Paragraph 1$\square$

Paragraph 2$\square$
\end{document}
• – Torbjørn T. Mar 17 '14 at 17:02
• Thank you, that helps a lot. I think I will delete/answer the question. – vmkrish Mar 17 '14 at 17:05

Redefine \par globally is very dangerous. But limited to an environment it could be possible add some elements without writing any command. Example:

(not guarantee of safety in a real document)

\documentclass{article}
\usepackage{xcolor}

\newenvironment{crazypar}{%at begin
\smallskip
\def\par{%
\pdfprimitive\par\noindent\rule{\textwidth}{0.4mm}%
\pdfprimitive\par\makebox[-2em][c]{\color{red}$\triangle$}\hspace{1.5em}
}}%
{%at end
\newline\noindent\rule{\textwidth}{0.4mm}
}

\begin{document}

This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text.

This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text.

This is a dummy text. This is a dummy text.

\begin{crazypar}

This is a dummy text.

This is a dummy text. This is a dummy text. This is a dummy text.

This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text.

This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text.  % no blank line here
\end{crazypar}

This is a dummy text. This is a dummy text. This is a dummy text. This is a dummy text.

\end{document}