Environment decorators
Have a look at the etoolbox
package, in particular to its \AtBeginEnvironment
command. This allows you to add aditional code to the begin of environment.
\documentclass{book}
\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\hrule}
\begin{document}
\begin{quote}
test
\end{quote}
\end{document}
The LaTeX kernel provides \g@addto@macro
which works for the environment starter command as well, i.e. for the environment quote
the start macro is \quote
, so say \g@addto@macro\quote{foo}
etc.
No extra packages are needed for this, apart from the specific additions that are to be made, but that depends on personal choices of the O.P, but in general 'anything' can be placed in \g@addto@macro\quote{...}
.
\let\oldquote\quote
\renewcommand{\quote}{fooaddition\oldquote}
would work as well, but this may fail for other environments that have optional arguments. In this case, \LetLtxMacro
from letltxmacro
package is needed, which means another package, however.
\documentclass{book}
\makeatletter
\g@addto@macro\quote{\hrule
\medskip
\textit{be careful}
\medskip
Now the real stuff begins\dots
}
\makeatother
\begin{document}
\begin{quote}
test
\end{quote}
\end{document}