Suggestions
Search:
 
Next:
admon.graphic
Up:
Admonitions admonition.mod.xsl
Reference Section

Name

latex.admonition.environment — Declares a new environment to be used for admonitions

Synopsis

<xsl:param name="latex.admonition.environment">
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>% Define a new LaTeX environment (adminipage)
</xsl:text>
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>\newenvironment{admminipage}%
</xsl:text>
		<xsl:text>{ % this code corresponds to the \begin{adminipage} command
</xsl:text>
		<xsl:text> \begin{Sbox}%
</xsl:text>
		<xsl:text> \begin{minipage}%
</xsl:text>
		<xsl:text>} %done
</xsl:text>
		<xsl:text>{ % this code corresponds to the \end{adminipage} command
</xsl:text>
		<xsl:text> \end{minipage}
</xsl:text>
		<xsl:text> \end{Sbox}
</xsl:text>
		<xsl:text> \fbox{\TheSbox}
</xsl:text>
		<xsl:text>} %done
</xsl:text>
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>% Define a new LaTeX length (admlength)
</xsl:text>
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>\newlength{\admlength}
</xsl:text>
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>% Define a new LaTeX environment (admonition)
</xsl:text>
		<xsl:text>% With 2 parameters:
</xsl:text>
		<xsl:text>% #1 The file (e.g. note.pdf)
</xsl:text>
		<xsl:text>% #2 The caption
</xsl:text>
		<xsl:text>% ----------------------------------------------
</xsl:text>
		<xsl:text>\newenvironment{admonition}[2] 
</xsl:text>
		<xsl:text>{ % this code corresponds to the \begin{admonition} command
</xsl:text>
		<xsl:text> \hspace{0mm}\newline\hspace*\fill\newline
</xsl:text>
		<xsl:text> \noindent
</xsl:text>
		<xsl:text> \setlength{\fboxsep}{5pt}
</xsl:text>
		<xsl:text> \setlength{\admlength}{\linewidth}
</xsl:text>
		<xsl:text> \addtolength{\admlength}{-10\fboxsep}
</xsl:text>
		<xsl:text> \addtolength{\admlength}{-10\fboxrule}
</xsl:text>
		<xsl:text> \admminipage{\admlength}
</xsl:text>
		<xsl:text> {</xsl:text>
		<xsl:value-of select="$latex.admonition.title.style"/>
		<xsl:text>{#2}}</xsl:text>
		<xsl:text> \newline
</xsl:text>
		<xsl:text> \\[1mm]
</xsl:text>
		<xsl:text> \sffamily
</xsl:text>
		<!--
		If we cannot find the admon.graphics.path;
		Comment out the next line (\includegraphics).
		This tactic is to avoid deleting the \includegraphics
		altogether, as that could confuse a person trying to
		find the use of parameter #1 in the environment.
		-->
		<xsl:if test="$admon.graphics.path=''">
			<xsl:text>%</xsl:text>
		</xsl:if>
		<xsl:text> \includegraphics[</xsl:text> <xsl:value-of select="$latex.admonition.imagesize"/> <xsl:text>]{#1}
</xsl:text>
		<xsl:text> \addtolength{\admlength}{-1cm}
</xsl:text>
		<xsl:text> \addtolength{\admlength}{-20pt}
</xsl:text>
		<xsl:text> \begin{minipage}[lt]{\admlength}
</xsl:text>
		<xsl:text> \parskip=0.5\baselineskip \advance\parskip by 0pt plus 2pt
</xsl:text>
		<xsl:text>} %done
</xsl:text>
		<xsl:text>{ % this code corresponds to the \end{admonition} command
</xsl:text>
		<xsl:text> \vspace{5mm} 
</xsl:text>
		<xsl:text> \end{minipage}
</xsl:text>
		<xsl:text> \endadmminipage
</xsl:text>
		<xsl:text> \vspace{.5em}
</xsl:text>
		<xsl:text> \par
</xsl:text>
		<xsl:text>}
</xsl:text>
	</xsl:param>

A. Description

This LaTeX environment is emitted during the preamble. That environment has two mandatory parameters. Instances of the environment are customised for each admonition via those parameters. Instances will be typeset as boxed areas in the document flow.

The first argument is the filename for graphics (e.g. $admon.graphics.path/warning). The second argument is the admonition title or the associated generic text.

Example 1. Processing the warning [2.0.9] admonition

When processing the admonition, the following code is generated:

				\begin{admonition}{figures/warning}{My WARNING}
...
\end{admonition}
				

D. DocBook Compliance and LaTeX Notes

The environment uses graphics by default. This may generate errors or warnings if LaTeX cannot find the graphics. If necessary, graphics may be disabled via admon.graphics.path.

B. Pertinent Variables

G. Uses

Documented templates that use this parameter: