Previous: Further inline hooks, Up: Overriding LaTeX hooks
It is also possible to override LaTeX environments that are
responsible for Texinfo's block environments such as @example
s
and @display
s.
As you can see in the following list, the default values for most block
hooks derive from the LaTeX environment `{display}'. See
preamble.mod.xsl for its definition. It assures proper
indentation in a nested environment (such as an enumeration). Moreover,
it allows for additional indentation via its optional parameter in
[...]
. The default indentation is \standardmargin
(equal
to \parindent
).
If you want to override the block hook name, say
\renewenvironment{nameHook}{opening commands}% {closing commands}
It is advisable, though not necessary, to use the {display}
environment somewhere in the new definition.
As an example, let's assume you wanted to give all @example
s a
grey background. You achieve this by adding this to your LaTeX
config file:
\usepackage{color,framed} \definecolor{shadecolor}{gray}{0.75} \renewenvironment{exampleHook}{% \begin{shaded}\begin{display}\ttfamily}% {\end{display}\end{shaded}}
You can also re-define the {display}
environment itself to
change the layout of most block types. However, you must be careful
with that. See its definition in preamble.mod.xsl for further
information.
quotationHook
{\begin{quote}}{\end{quote}}
copyingHook
{\begin{quote}}{\end{quote}}
verbatimHook
{\begin{display}[0pt]\ttfamily}{\end{display}}
exampleHook
{\begin{display}\ttfamily}{\end{display}}
lispHook
{\begin{display}\ttfamily}{\end{display}}
displayHook
{\begin{display}\relax}{\end{display}}
formatHook
{\begin{display}[0pt]}{\end{display}}
smallexampleHook
{\begin{small}\begin{exampleHook}}% {\end{exampleHook}\end{small}}
smalldisplayHook
{\begin{small}\begin{displayHook}}% {\end{displayHook}\end{small}}
smallformatHook
{\begin{small}\begin{formatHook}}% {\end{formatHook}\end{small}}
smalllispHook
{\begin{small}\begin{lispHook}}% {\end{lispHook}\end{small}}
flushleftHook
{\begin{flushleft}}{\end{flushleft}}
flushrightHook
{\begin{flushright}}{\end{flushright}}
groupHook
{\begin{samepage}}{\end{samepage}}
cartoucheHook
{\begin{center}\shadowbox\bgroup \hbox to \hsize\bgroup\begin{minipage}{\hsize}}% {\end{minipage}\hss\egroup\egroup\end{center}}
\centerHook
\centerline{#1}
Attention! Although this is a block hook by layout, it is not so in terms of its LaTeX realisation. In fact it is a LaTeX macro as those inline hooks, see Overriding LaTeX hooks.
Note that if you activate syntax highlighting (see Command line options), some @lisp
and @smalllisp
blocks will be typeset
using LaTeX's `listings' package. This cannot be included in a
hook. However, the `lispHook' is still wrapped around it.