Ändern der Befehle für Absatzanfang und Absatzende

Ändern der Befehle für Absatzanfang und Absatzende

Ist es möglich, TeX/LaTeX-Befehle so zu ändern, dass bestimmte Befehle vor/nach einem Absatz ausgeführt werden? Wir wissen beispielsweise, dass der LaTeX-Compiler, wenn er den Befehl \par oder eine Leerzeichenzeile sieht, den aktuellen Absatz beendet und in den vertikalen Modus wechselt (?).

Ich suche also nach einem Befehl, den ich so ändern kann, dass ich

%redefine some commands up here

\begin{document}
Paragraph 1

Paragraph 2
\end{document}

und dieselbe Ausgabe erzeugen wie

\begin{document}
$\triangle$Paragraph 1

$\triangle$Paragraph 2
\end{document}

Eine weitere damit verbundene Frage wäre die Erzeugung von Ausgaben wie

\begin{document}
Paragraph 1$\square$

Paragraph 2$\square$
\end{document}

Antwort1

Globales Neudefinieren \parist sehr gefährlich. Aber beschränkt auf eine Umgebung könnte es möglich sein, einige Elemente hinzuzufügen, ohne einen Befehl zu schreiben. Beispiel:

(keine Sicherheitsgarantie in einem echten Dokument)

MWE

\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}

verwandte Informationen