Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for text wrapped around pictures
- Loading branch information
1 parent
a4b171a
commit 6e340f9
Showing
6 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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>} % </xsl:text> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |