Changeset 56363 in vbox
- Timestamp:
- Jun 11, 2015 2:43:56 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/docbook2latex.xsl
r56198 r56363 112 112 \usepackage{nameref} 113 113 \usepackage{graphicx} 114 \usepackage{hyperref} 114 115 \usepackage{fancybox} 115 116 \usepackage{fancyvrb} … … 277 278 </xsl:template> 278 279 280 <!-- 281 Inserts \hypertarget{@id} that can be referenced via the /A "nameddest=@id" 282 command line or #nameddest=@id URL parameter. 283 284 TODO: The placement of the target could be improved on. The raisebox 285 stuff is a crude hack to make it a little more acceptable. --> 286 <xsl:template name="title-wrapper"> 287 <xsl:param name="texcmd" select="concat('\',name(..))"/> 288 <xsl:param name="refid" select="../@id"/> 289 290 <xsl:call-template name="xsltprocNewlineOutputHack"/> 291 <xsl:choose> 292 <xsl:when test="$refid"> 293 <xsl:text>
</xsl:text> 294 <xsl:value-of select="$texcmd"/> 295 <xsl:text>[</xsl:text> <!-- for toc --> 296 <xsl:apply-templates /> 297 <xsl:text>]</xsl:text> 298 <xsl:text>{</xsl:text> <!-- for doc --> 299 <xsl:text>\raisebox{\ht\strutbox}{\hypertarget{</xsl:text> 300 <xsl:value-of select="$refid"/> 301 <xsl:text>}{}}</xsl:text> 302 <xsl:apply-templates /> 303 <xsl:text>}</xsl:text> 304 </xsl:when> 305 <xsl:otherwise> 306 <xsl:text>
</xsl:text><xsl:value-of select="$texcmd"/><xsl:text>{</xsl:text> 307 <xsl:apply-templates /> 308 <xsl:text>}</xsl:text> 309 </xsl:otherwise> 310 </xsl:choose> 311 </xsl:template> 312 279 313 <xsl:template match="title"> 314 <xsl:variable name="refid" select="../@id" /> 280 315 <xsl:choose> 281 316 <xsl:when test="name(..)='bookinfo'"> … … 285 320 </xsl:when> 286 321 <xsl:when test="name(..)='chapter'"> 287 <xsl:call-template name="xsltprocNewlineOutputHack"/> 288 <xsl:text>
\chapter{</xsl:text> 289 <xsl:apply-templates /> 290 <xsl:text>}</xsl:text> 322 <xsl:call-template name="title-wrapper"/> 291 323 </xsl:when> 292 324 <xsl:when test="name(..)='sect1'"> 293 <xsl:call-template name="xsltprocNewlineOutputHack"/> 294 <xsl:text>
\section{</xsl:text> 295 <xsl:apply-templates /> 296 <xsl:text>}</xsl:text> 325 <xsl:call-template name="title-wrapper"> 326 <xsl:with-param name="texcmd">\section</xsl:with-param> 327 </xsl:call-template> 297 328 </xsl:when> 298 329 <xsl:when test="name(..)='sect2'"> 299 <xsl:call-template name="xsltprocNewlineOutputHack"/> 300 <xsl:text>
\subsection{</xsl:text> 301 <xsl:apply-templates /> 302 <xsl:text>}</xsl:text> 330 <xsl:call-template name="title-wrapper"> 331 <xsl:with-param name="texcmd">\subsection</xsl:with-param> 332 </xsl:call-template> 303 333 </xsl:when> 304 334 <xsl:when test="name(..)='sect3'"> 305 <xsl:call-template name="xsltprocNewlineOutputHack"/> 306 <xsl:text>
\subsubsection{</xsl:text> 307 <xsl:apply-templates /> 308 <xsl:text>}</xsl:text> 335 <xsl:call-template name="title-wrapper"> 336 <xsl:with-param name="texcmd">\subsubsection</xsl:with-param> 337 </xsl:call-template> 309 338 </xsl:when> 310 339 <xsl:when test="name(..)='sect4'"> 311 <xsl:call-template name="xsltprocNewlineOutputHack"/> 312 <xsl:text>
\paragraph{</xsl:text> 313 <xsl:apply-templates /> 314 <xsl:text>}</xsl:text> 340 <xsl:call-template name="title-wrapper"> 341 <xsl:with-param name="texcmd">\paragraph</xsl:with-param> 342 </xsl:call-template> 315 343 </xsl:when> 316 344 <xsl:when test="name(..)='sect5'"> 317 <xsl:call-template name="xsltprocNewlineOutputHack"/> 318 <xsl:text>
\subparagraph{</xsl:text> 319 <xsl:apply-templates /> 320 <xsl:text>}</xsl:text> 345 <xsl:call-template name="title-wrapper"> 346 <xsl:with-param name="texcmd">\subparagraph</xsl:with-param> 347 </xsl:call-template> 321 348 </xsl:when> 322 349 <xsl:when test="name(..)='refsect1'"> 323 <xsl:call-template name=" xsltprocNewlineOutputHack"/>324 <xsl:text>
\paragraph{</xsl:text>325 < xsl:apply-templates />326 <xsl:text> }
\begin{addmargin}{1em}
</xsl:text> <!-- addmargin is ended by refsect1 template way further down. -->350 <xsl:call-template name="title-wrapper"> 351 <xsl:with-param name="texcmd">\paragraph</xsl:with-param> 352 </xsl:call-template> 353 <xsl:text>
\begin{addmargin}{1em}
</xsl:text> <!-- addmargin is ended by refsect1 template way further down. --> 327 354 </xsl:when> 328 355 <xsl:when test="name(..)='refsect2'"> 329 <xsl:call-template name="xsltprocNewlineOutputHack"/> 330 <xsl:text>
\subparagraph{</xsl:text> 331 <xsl:apply-templates /> 332 <xsl:text>}</xsl:text> 356 <xsl:call-template name="title-wrapper"> 357 <xsl:with-param name="texcmd">\subparagraph</xsl:with-param> 358 </xsl:call-template> 333 359 </xsl:when> 334 360 <xsl:when test="name(..)='appendix'"> 335 <xsl:call-template name="xsltprocNewlineOutputHack"/> 336 <xsl:text>
\chapter{</xsl:text> 337 <xsl:apply-templates /> 338 <xsl:text>}</xsl:text> 361 <xsl:call-template name="title-wrapper"> 362 <xsl:with-param name="texcmd">\chapter</xsl:with-param> 363 </xsl:call-template> 339 364 </xsl:when> 340 365 <xsl:when test="name(..)='glossdiv'"> 341 <xsl:call-template name="xsltprocNewlineOutputHack"/> 342 <xsl:text>
\section*{</xsl:text> 343 <xsl:apply-templates /> 344 <xsl:text>}</xsl:text> 345 </xsl:when> 346 </xsl:choose> 347 <xsl:variable name="refid" select="../@id" /> 366 <xsl:call-template name="title-wrapper"> 367 <xsl:with-param name="texcmd">\section*</xsl:with-param> 368 </xsl:call-template> 369 </xsl:when> 370 </xsl:choose> 348 371 <xsl:if test="$refid"> 349 372 <xsl:value-of select="concat('
\label{', $refid, '}')" />
Note:
See TracChangeset
for help on using the changeset viewer.