Previous: Further inline hooks, Up: Overriding LaTeX hooks


4.2.3 Block hooks

It is also possible to override LaTeX environments that are responsible for Texinfo's block environments such as @examples and @displays.

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 @examples 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.

List of all block element hooks
quotationHook
Default: {\begin{quote}}{\end{quote}}
copyingHook
Default: {\begin{quote}}{\end{quote}}
verbatimHook
Default: {\begin{display}[0pt]\ttfamily}{\end{display}}
exampleHook
Default: {\begin{display}\ttfamily}{\end{display}}
lispHook
Default: {\begin{display}\ttfamily}{\end{display}}
displayHook
Default: {\begin{display}\relax}{\end{display}}
formatHook
Default: {\begin{display}[0pt]}{\end{display}}
smallexampleHook
Default:
          {\begin{small}\begin{exampleHook}}%
          {\end{exampleHook}\end{small}}
     

smalldisplayHook
Default:
          {\begin{small}\begin{displayHook}}%
          {\end{displayHook}\end{small}}
     

smallformatHook
Default:
          {\begin{small}\begin{formatHook}}%
          {\end{formatHook}\end{small}}
     

smalllispHook
Default:
          {\begin{small}\begin{lispHook}}%
          {\end{lispHook}\end{small}}
     

flushleftHook
Default: {\begin{flushleft}}{\end{flushleft}}
flushrightHook
Default: {\begin{flushright}}{\end{flushright}}
groupHook
Default: {\begin{samepage}}{\end{samepage}}
cartoucheHook
Default:
          {\begin{center}\shadowbox\bgroup
             \hbox to \hsize\bgroup\begin{minipage}{\hsize}}%
          {\end{minipage}\hss\egroup\egroup\end{center}}
     

\centerHook
Default: \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.