Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support for text wrapped around pictures

  • Loading branch information...
commit 6e340f90af53e133cbf208bcd1c322f0b139aa79 1 parent a4b171a
@alexvorobiev authored
View
6 dbkindle.sty
@@ -156,7 +156,7 @@
\checkandfixthelayout
\definecolor{light-gray}{gray}{0.95}
-\renewcommand*{\trimmarkscolor}{\color{light-gray}}
+\newcommand*{\trimmarkscolor}{\color{light-gray}}
% font
\usepackage{dbkindle_font}
@@ -211,8 +211,10 @@
\setlength{\epigraphwidth}{\stockwidth * 3 / 4}
\epigraphfontsize{\footnotesize}
+\usepackage{footnpag} % reset footnote counter when new page starts
+
\usepackage{dbkindle_unicode}
\usepackage{dbkindle_title}
\usepackage{dbkindle_verbatim}
-
+\usepackage{dbkindle_graphics}
View
33 dbkindle_graphics.sty
@@ -0,0 +1,33 @@
+\usepackage{wrapfig}
+
+\setlength{\intextsep}{0.25\baselineskip}
+
+\newlength{\saveimagewidth}
+\newsavebox{\saveimagebox}
+\newcounter{figurecounter}
+
+% Enclose the image in either wrapfigure of figure environment depending on its (rescaled) width
+% The first parameter is treshold - multiple of textwith, the second parameter is image file name
+\newcommand{\wrapifneeded}[2]{%
+ \savebox{\saveimagebox}{\includegraphics[width=\imgwidth,height=\imgheight,keepaspectratio=true]{#2}}
+ \settowidth{\saveimagewidth}{\usebox{\saveimagebox}}
+
+ \ifdim\saveimagewidth<#1\textwidth
+ \ifthenelse{\isodd{\value{figurecounter}}}{
+
+ \begin{wrapfigure}{R}{\saveimagewidth}
+ \usebox{\saveimagebox}
+ \end{wrapfigure}
+ }{
+ \begin{wrapfigure}{L}{\saveimagewidth}
+ \usebox{\saveimagebox}
+ \end{wrapfigure}
+ }
+ \else
+ \begin{figure}[h] %
+ \centering %
+ \usebox{\saveimagebox}
+ \end{figure}
+ \fi
+ \stepcounter{figurecounter}
+}
View
3  dbkindle_title.sty
@@ -1,5 +1,4 @@
% see documentation for memoir class
-
\makechapterstyle{centered}{%
\chapterstyle{default}
\setlength{\beforechapskip}{5\onelineskip}
@@ -18,7 +17,7 @@
\par\nobreak\vskip 0.5\onelineskip
% \Pisymbol{MinionPro-Extra}{110}
\Pisymbol{MinionPro-Extra}{120}
- % \textxswup
+ % \textxswup
}
\setlength{\afterchapskip}{2.5\onelineskip}}
View
27 dbkindle_title_hierog.sty
@@ -0,0 +1,27 @@
+% see documentation for memoir class
+\usepackage{hieroglf}
+\makechapterstyle{centered}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{5\onelineskip}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\large}
+ \settoheight{\midchapskip}{\chapnumfont 1}
+ \renewcommand*{\printchapternum}{\centering \chapnumfont
+ \thechapter\
+ }
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip}
+ \renewcommand*{\printchapternonum}{\centering
+ \vphantom{\chapnumfont 1}\afterchapternum}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large}
+ \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1
+ \par\nobreak\vskip 0.5\onelineskip
+ % \Pisymbol{MinionPro-Extra}{110}
+ %\Pisymbol{MinionPro-Extra}{120}
+ \pmglyph{A:n-y-a}
+ % \textxswup
+ }
+ \setlength{\afterchapskip}{2.5\onelineskip}}
+
+\chapterstyle{centered}
+%\renewcommand*{\chaptitlefont}{\fontfamily{antt}\fontshape{bf}\selectfont}
View
5 param.xsl
@@ -8,6 +8,7 @@
<xsl:import href="xsl/lettrine.xsl"/>
<xsl:import href="xsl/poem.xsl"/>
<xsl:import href="xsl/epigraph.xsl"/>
+ <xsl:import href="xsl/image.xsl"/>
<!-- Options used for documentclass -->
@@ -74,7 +75,9 @@
<!-- Empty <literallayout> is produced by FB2's <emptyline/>-->
<xsl:template match="literallayout[.='']">
- <xsl:text>\par \vspace{\baselineskip}</xsl:text>
+ <xsl:if test="not(preceding-sibling::node()[1][name()='mediaobject']) and not(following-sibling::node()[1][name()='mediaobject'])">
+ <xsl:text>\par \vspace{\baselineskip}</xsl:text>
+ </xsl:if>
</xsl:template>
<!-- Fancy breaks -->
View
22 xsl/image.xsl
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding="iso-8859-1"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:exsl="http://exslt.org/common"
+ extension-element-prefixes="exsl"
+ version='1.0'>
+
+ <!-- Images narrower than this portion of line width will be surrounded by text -->
+ <xsl:param name="wrapimage.treshold">0.4</xsl:param>
+
+ <xsl:template match="mediaobject">
+ <xsl:call-template name="processimage">
+ <xsl:with-param name="image" select="./imageobject/imagedata/@fileref"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="processimage">
+ <xsl:param name="image" select="."/>
+ <xsl:text>\wrapifneeded{</xsl:text><xsl:value-of select="$wrapimage.treshold"/>
+ <xsl:text>}{</xsl:text><xsl:value-of select="$image"/><xsl:text>} %&#10;</xsl:text>
+ </xsl:template>
+
+</xsl:stylesheet>
Please sign in to comment.
Something went wrong with that request. Please try again.