From 20255e2c3347ec299f3e847178a21ecc760bb604 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 29 Aug 2014 22:35:25 +0000 Subject: reflectgraphics (29aug14) git-svn-id: svn://tug.org/texlive/trunk@35064 c570f23f-e606-0410-a88d-b1316a301751 --- .../latex/reflectgraphics/reflectgraphics.dtx | 55 +++++++++++++--------- .../latex/reflectgraphics/reflectgraphics.ins | 4 +- 2 files changed, 36 insertions(+), 23 deletions(-) (limited to 'Master/texmf-dist/source/latex/reflectgraphics') diff --git a/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.dtx b/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.dtx index 8a695b3f7ab..16fafc9cd77 100644 --- a/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.dtx +++ b/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2013 by Oliver Reiche +% Copyright (C) 2014 by Oliver Reiche % --------------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -26,7 +26,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{reflectgraphics} %<*package> - [2013/11/17 v0.2 Fancy reflections for LaTeX graphics] + [2014/08/29 v0.2b Fancy reflections for LaTeX graphics] % % %<*driver> @@ -37,7 +37,7 @@ \overfullrule=0pt }% \usepackage{xdoc2} -\usepackage{reflectgraphics}[2013/11/17] +\usepackage{reflectgraphics}[2014/08/29] \usepackage{microtype} \usepackage[defaultlines=2,all]{nowidow} \usepackage{titlesec} @@ -66,7 +66,7 @@ % % \fi % -% \CheckSum{266} +% \CheckSum{309} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -87,6 +87,7 @@ % % \changes{v0.1}{2013/10/28}{Initial version} % \changes{v0.2}{2013/10/31}{Support for options 'scale' and 'angle'} +% \changes{v0.2b}{2013/11/25}{Fixed 'angle' for values <0 and >90} % % \DoNotIndex{\newcommand,\newenvironment} % @@ -270,10 +271,10 @@ % omitted:\\ % \begin{minipage}[t]{\textwidth} % \begin{verbatim} -% \reflectgraphics[trim=180 100 125 160]{lenna.jpg} +% \reflectgraphics[trim=115 60 80 100]{lenna.jpg} % \end{verbatim} % \begin{center} -% \reflectgraphics[width=1.55cm, height=2cm, trim=180 100 125 160]{lenna.jpg} +% \reflectgraphics[width=1.55cm, height=2cm, trim=115 60 80 100]{lenna.jpg} % \end{center} % \end{minipage}\bigskip % @@ -636,26 +637,38 @@ \fi\fi% % \end{macrocode} % Determine dimensions of the graphics bounding box if rotation is enabled. -% Again, |\includegraphics| in \option{draft} mode is used for calculating the -% boundary size. Computing the boundary size could also be done manually -% using \package{pgfmath}, but it turned out to be slower. +% Again, |\includegraphics| in \option{draft} mode could be used to calculate +% the boundary size, but calling |\heightof| results in strange values for +% $\textrm{\option{angle}}<0$ and $\textrm{\option{angle}}>90$. Therefore, +% computing the boundary size is done manually using \package{pgfmath}, which +% turns out to be a little bit slower. % \begin{macrocode} \ifdim\rg@angle pt=0pt% \setlength{\rg@grp@width}{\rg@width}% \setlength{\rg@grp@height}{\rg@height}% \else% - \settowidth{\rg@grp@width}{% - \includegraphics[% - draft,% - width=\rg@width,% - height=\rg@height,% - angle=\rg@angle]{#2}}% - \settoheight{\rg@grp@height}{% - \includegraphics[% - draft,% - width=\rg@width,% - height=\rg@height,% - angle=\rg@angle]{#2}}% +% \end{macrocode} +% This is totally strange: A simple division gets completely messed up if +% dividing a length by a larger length. So I need to take care to divide +% lengths only by smaller ones. +% \begin{macrocode} + \ifdim\rg@height>\rg@width% + \pgfmathsetmacro{\rg@alpha}{atan(\rg@height/\rg@width)}% + \else% + \pgfmathsetmacro{\rg@alpha}{atan(1/(\rg@width/\rg@height)}% + \fi% + \pgfmathsetmacro{\rg@corner}{abs(cos(\rg@alpha))}% + \pgfmathsetmacro{\rg@cornera}{abs(cos(\rg@alpha+\rg@angle))}% + \pgfmathsetmacro{\rg@cornerb}{abs(cos(180-\rg@alpha+\rg@angle))}% + \pgfmathsetmacro{\rg@scale@x}{% + max(\rg@cornera/\rg@corner,\rg@cornerb/\rg@corner)}% + \pgfmathsetmacro{\rg@corner}{abs(sin(\rg@alpha))}% + \pgfmathsetmacro{\rg@cornera}{abs(sin(\rg@alpha+\rg@angle))}% + \pgfmathsetmacro{\rg@cornerb}{abs(sin(180-\rg@alpha+\rg@angle))}% + \pgfmathsetmacro{\rg@scale@y}{% + max(\rg@cornera/\rg@corner,\rg@cornerb/\rg@corner)}% + \setlength{\rg@grp@width}{\rg@scale@x\rg@width}% + \setlength{\rg@grp@height}{\rg@scale@y\rg@height}% \fi% % \end{macrocode} % Compute height of reflection. diff --git a/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.ins b/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.ins index acda6ec3cc2..771a113b629 100644 --- a/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.ins +++ b/Master/texmf-dist/source/latex/reflectgraphics/reflectgraphics.ins @@ -1,4 +1,4 @@ -%% Copyright (C) 2013 by Oliver Reiche +%% Copyright (C) 2014 by Oliver Reiche %% -------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -25,7 +25,7 @@ This is a generated file. -Copyright (C) 2013 by Oliver Reiche +Copyright (C) 2014 by Oliver Reiche -------------------------------------------------------------------------- This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3 -- cgit v1.2.3