diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx | 420 |
1 files changed, 346 insertions, 74 deletions
diff --git a/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx b/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx index b0d102478bd..df1dfd2abf3 100644 --- a/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx +++ b/Master/texmf-dist/source/latex/oberdiek/pdflscape.dtx @@ -17,7 +17,11 @@ % % This work consists of the main source file pdflscape.dtx % and the derived files -% pdflscape.sty, pdflscape.pdf, pdflscape.ins, pdflscape.drv. +% pdflscape.sty, pdflscape.pdf, pdflscape.ins, pdflscape.drv, +% pdflscape-test1.tex, pdflscape-test2.tex, +% pdflscape-test3.tex, pdflscape-test4.tex, +% pdflscape-test5.tex, pdflscape-test6.tex, +% pdflscape-test6.txt, ExtractRotate.java. % % Distribution: % CTAN:macros/latex/contrib/oberdiek/pdflscape.dtx @@ -52,6 +56,14 @@ % Installation: % TDS:tex/latex/oberdiek/pdflscape.sty % TDS:doc/latex/oberdiek/pdflscape.pdf +% TDS:doc/latex/oberdiek/test/pdflscape-test1.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test2.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test3.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test4.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test5.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test6.tex +% TDS:doc/latex/oberdiek/test/pdflscape-test6.txt +% TDS:doc/latex/oberdiek/test/ExtractRotate.java % TDS:source/latex/oberdiek/pdflscape.dtx % %<*ignore> @@ -67,7 +79,7 @@ \input docstrip.tex \Msg{************************************************************************} \Msg{* Installation} -\Msg{* Package: pdflscape 2007/04/17 v0.8 Landscape pages in PDF (HO)} +\Msg{* Package: pdflscape 2007/10/21 v0.9 Landscape pages in PDF (HO)} \Msg{************************************************************************} \keepsilent @@ -94,7 +106,11 @@ This Current Maintainer of this work is Heiko Oberdiek. This work consists of the main source file pdflscape.dtx and the derived files - pdflscape.sty, pdflscape.pdf, pdflscape.ins, pdflscape.drv. + pdflscape.sty, pdflscape.pdf, pdflscape.ins, pdflscape.drv, + pdflscape-test1.tex, pdflscape-test2.tex, + pdflscape-test3.tex, pdflscape-test4.tex, + pdflscape-test5.tex, pdflscape-test6.tex, + pdflscape-test6.txt, ExtractRotate.java. \endpreamble @@ -103,6 +119,17 @@ and the derived files \file{pdflscape.drv}{\from{pdflscape.dtx}{driver}}% \usedir{tex/latex/oberdiek}% \file{pdflscape.sty}{\from{pdflscape.dtx}{package}}% + \usedir{doc/latex/oberdiek/test}% + \file{pdflscape-test1.tex}{\from{pdflscape.dtx}{test0,test1}}% + \file{pdflscape-test2.tex}{\from{pdflscape.dtx}{test0,test2}}% + \file{pdflscape-test3.tex}{\from{pdflscape.dtx}{test0,test3}}% + \file{pdflscape-test4.tex}{\from{pdflscape.dtx}{test0,test4}}% + \file{pdflscape-test5.tex}{\from{pdflscape.dtx}{test5}}% + \file{pdflscape-test6.tex}{\from{pdflscape.dtx}{test6}}% + \nopreamble + \nopostamble + \file{pdflscape-test6.txt}{\from{pdflscape.dtx}{result6}}% + \file{ExtractRotate.java}{\from{pdflscape.dtx}{ExtractRotate}}% } \obeyspaces @@ -128,16 +155,17 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e} \ProvidesFile{pdflscape.drv}% - [2007/04/17 v0.8 Landscape pages in PDF (HO)]% + [2007/10/21 v0.9 Landscape pages in PDF (HO)]% \documentclass{ltxdoc} -\usepackage{holtxdoc} +\usepackage{holtxdoc}[2007/10/21] +\usepackage{graphics} \begin{document} \DocInput{pdflscape.dtx}% \end{document} %</driver> % \fi % -% \CheckSum{344} +% \CheckSum{473} % % \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 @@ -158,7 +186,7 @@ and the derived files % \GetFileInfo{pdflscape.drv} % % \title{The \xpackage{pdflscape} package} -% \date{2007/04/17 v0.8} +% \date{2007/10/21 v0.9} % \author{Heiko Oberdiek\\\xemail{oberdiek@uni-freiburg.de}} % % \maketitle @@ -224,35 +252,44 @@ and the derived files % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pdflscape}% - [2007/04/17 v0.8 Landscape pages in PDF (HO)] + [2007/10/21 v0.9 Landscape pages in PDF (HO)] % \end{macrocode} % % \subsection{Driver options} % % \begin{macrocode} +\let\PLS@option\@empty \let\PLS@driver\@empty -\DeclareOption{pdftex}{% - \PassOptionsToPackage\CurrentOption{lscape}% - \def\PLS@driver{pdftex}% -} -\DeclareOption{dvips}{% - \PassOptionsToPackage\CurrentOption{lscape}% - \def\PLS@driver{dvips}% -} -\DeclareOption{dvipsone}{% - \PassOptionsToPackage\CurrentOption{lscape}% - \def\PLS@driver{dvips}% -} -\DeclareOption{pctexps}{% - \PassOptionsToPackage\CurrentOption{lscape}% - \def\PLS@driver{dvips}% +\def\PLS@temp#1#2{% + \DeclareOption{#1}{% + \let\PLS@option\CurrentOption + \def\PLS@driver{#2}% + }% } -\DeclareOption{dvipdfm}{% - \PassOptionsToPackage\CurrentOption{dvipdfm}% - \def\PLS@driver{dvipdfm}% +\PLS@temp{pdftex}{pdftex} +\PLS@temp{dvips}{dvips} +\PLS@temp{dvipsone}{dvips} +\PLS@temp{pctexps}{dvips} +\PLS@temp{dvipdfm}{dvipdfm} +\PLS@temp{dvipdfmx}{dvipdfm} +\PLS@temp{xetex}{dvipdfm} +\let\PLS@temp\@empty +\DeclareOption*{% + \ifx\PLS@temp\@empty + \let\PLS@temp\CurrentOption + \else + \edef\PLS@temp{\PLS@temp,\CurrentOption}% + \fi } -\DeclareOption*{\PassOptionsToPackage\CurrentOption{lscape}} -\ProcessOptions +\ProcessOptions* +\ifx\PLS@option\@empty +\else + \expandafter\PassOptionsToPackage\expandafter{\PLS@option}{lscape}% +\fi +\ifx\PLS@temp\@empty +\else + \expandafter\PassOptionsToPackage\expandafter{\PLS@temp}{lscape}% +\fi \RequirePackage{lscape} % \end{macrocode} % @@ -261,25 +298,17 @@ and the derived files % \subsubsection{Driver \xoption{pdftex}} % % \begin{macrocode} +\RequirePackage{ifpdf}[2006/02/20] \def\PLS@temp{pdftex} -\ifnum 1=0\ifx\pdfoutput\@undefined - \else - \ifx\pdfoutput\relax - \else - \ifnum\pdfoutput>0 % - 1% - \fi - \fi - \fi - \space +\ifpdf \ifx\PLS@driver\@empty \let\PLS@driver\PLS@temp - \PackageInfo{pdflscape}{Auto-detected driver: `\PLS@temp'}% + \PackageInfo{pdflscape}{Auto-detected driver: \PLS@temp}% \fi \ifx\PLS@driver\PLS@temp \else \PackageError{pdflscape}{% - The driver option `\PLS@driver' is not compatible\MessageBreak + The driver option `\PLS@option' is not compatible\MessageBreak with pdfTeX in PDF mode, using driver `pdftex' instead% }\@ehc \let\PLS@driver\PLS@temp @@ -287,58 +316,77 @@ and the derived files \fi % \end{macrocode} % -% \subsubsection{Driver \xoption{dvips}} +% \subsubsection{Driver \xoption{xetex}} % % \begin{macrocode} -\def\PLS@temp{dvips} -\ifnum 1=0\ifx\Gin@PS@raw\@undefined - \else - \ifx\Gin@PS@raw\relax - \else - \ifx\Gin@PS@raw\@empty - \else - 1% - \fi - \fi - \fi - \space +\RequirePackage{ifxetex}% +\def\PLS@temp{dvipdfm} +\ifxetex \ifx\PLS@driver\@empty \let\PLS@driver\PLS@temp - \PackageInfo{pdflscape}{Auto-detected driver: `\PLS@temp'}% + \PackageInfo{pdflscape}{% + Auto-detected driver: \PLS@temp\space(xetex)% + }% \fi \ifx\PLS@driver\PLS@temp \else \PackageError{pdflscape}{% - The driver option `\PLS@driver' is not compatible\MessageBreak - with detected PostScript driver,\MessageBreak - Will try using driver `dvips'% + The driver option `\PLS@option' is not compatible\MessageBreak + with XeTeX, using driver for XeTeX (dvipdfm) instead% }\@ehc \let\PLS@driver\PLS@temp \fi \fi % \end{macrocode} % -% \subsubsection{Driver \xoption{dvipdfm}} +% \subsubsection{Detect driver based on \cs{Gin@driver}} % % \begin{macrocode} -\def\PLS@temp{dvipdfm.def} -\ifx\PLS@temp\Gin@driver - \def\PLS@temp{dvipdfm}% +\def\PLS@temp#1#2{% \ifx\PLS@driver\@empty - \let\PLS@driver\PLS@temp - \PackageInfo{pdflscape}{Auto-detected driver: `\PLS@temp'}% + \begingroup + \def\PLS@temp{#1.def}% + \expandafter\endgroup + \ifx\PLS@temp\Gin@driver + \def\PLS@driver{#2}% + \PackageInfo{pdflscape}{% + Auto-detected driver: \PLS@driver\space(#1)% + }% + \fi \fi - \ifx\PLS@driver\PLS@temp - \else - \PackageError{pdflscape}{% - Graphics driver `dvipdfm.def' is loaded, but this\MessageBreak - is incompatible with driver `\PLS@driver'.\MessageBreak - Will try using driver `dvipdfm'% - }\@ehc +} +\PLS@temp{dvipdfm}{dvipdfm} +\PLS@temp{dvipdfmx}{dvipdfm} +\PLS@temp{dvips}{dvips} +\PLS@temp{dvipsone}{dvips} +\PLS@temp{pctexps}{dvips} +% \end{macrocode} +% +% \subsubsection{Driver \xoption{dvips}} +% +% \begin{macrocode} +\ifx\PLS@driver\@empty + \def\PLS@temp{dvips}% + \ifnum 1=0\ifx\Gin@PS@raw\@undefined + \else + \ifx\Gin@PS@raw\relax + \else + \ifx\Gin@PS@raw\@empty + \else + 1% + \fi + \fi + \fi + \space \let\PLS@driver\PLS@temp + \PackageInfo{pdflscape}{% + Auto-detected driver: \PLS@temp\space(PostScript)% + }% \fi \fi - +% \end{macrocode} +% +% \begin{macrocode} \ifx\PLS@driver\@empty \PackageError{pdflscape}{% Neither pdfTeX, PostScript, nor dvipdfm driver found% @@ -506,10 +554,10 @@ and the derived files \count@=#1\relax \fi % \end{macrocode} -% Normalise to interval -360 $<$ |\count@| $<$ 360. +% Normalize to interval -360 $<$ |\count@| $<$ 360. % \begin{macrocode} - \@whilenum\count@>359\do{\addtocounter\count@ -360 }% - \@whilenum\count@<-359\do{\addtocounter\count@ 360 }% + \@whilenum\count@>359\do{\advance\count@ -360 }% + \@whilenum\count@<-359\do{\advance\count@ 360 }% % \end{macrocode} % Check values: 0, +/-90, +/-180, +/-270 % \begin{macrocode} @@ -534,6 +582,216 @@ and the derived files %</package> % \end{macrocode} % +% \section{Test} +% +% \subsection{Driver detection tests} +% \begin{macrocode} +%<*test0> +\NeedsTeXFormat{LaTeX2e} +\documentclass{minimal} +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +%</test0> +% \end{macrocode} +% +% \begin{macrocode} +%<*test1> +\usepackage{ifpdf} +\ifpdf + \def\ExpectDriver{pdftex}% +\fi +\usepackage{ifxetex}% +\ifxetex + \def\ExpectDriver{dvipdfm}% +\fi +\usepackage{pdflscape}[2007/10/21] +%</test1> +% \end{macrocode} +% +% \begin{macrocode} +%<*test2> +\def\ExpectDriver{pdftex} +\usepackage[pdftex]{pdflscape}[2007/10/21] +%</test2> +% \end{macrocode} +% +% \begin{macrocode} +%<*test3> +\def\ExpectDriver{dvipdfm} +\usepackage[dvipdfmx]{pdflscape}[2007/10/21] +%</test3> +% \end{macrocode} +% +% \begin{macrocode} +%<*test4> +\def\ExpectDriver{dvips} +\usepackage[dvipsone]{graphics} +\usepackage{pdflscape}[2007/10/21] +%</test4> +% \end{macrocode} +% +% \begin{macrocode} +%<*test0> +\begin{document} +\begin{qstest}{driver}{driver} + \makeatletter + \Expect*{\PLS@driver}*{\ExpectDriver}% +\end{qstest} +\end{document} +%</test0> +% \end{macrocode} +% +% \subsection{Test for \cs{PLS@CheckAngle}} +% +% \begin{macrocode} +%<*test5> +\NeedsTeXFormat{LaTeX2e} +\documentclass{minimal} +\usepackage{qstest} +\IncludeTests{*} +\LogTests{log}{*}{*} +\usepackage{pdflscape}[2007/10/21] +\begin{document} +\begin{qstest}{checkangle}{checkangle} + \makeatletter + \def\Result{% + \def\ResultString{\the\count@}% + }% + \def\PackageError#1#2#3{% + \def\Result{% + \def\ResultString{error}% + }% + }% + \def\Test#1#2{% + \begingroup + \PLS@CheckAngle{#1}% + \Result + \Expect*{\ResultString}{#2}% + \endgroup + }% + \Test{0}{0}% + \Test{90}{90}% + \Test{180}{180}% + \Test{270}{270}% + \Test{360}{0}% + \Test{450}{90}% + \Test{540}{180}% + \Test{630}{270}% + \Test{720}{0}% + \Test{3600}{0}% + \Test{3690}{90}% + \Test{-90}{270}% + \Test{-180}{180}% + \Test{-270}{-90}% + \Test{-360}{0}% + \Test{-450}{270}% + \Test{540}{180}% + \Test{-630}{90}% + \Test{-720}{0}% + \Test{-3600}{0}% + \Test{-3690}{270}% + \Test{1}{error}% + \Test{-1}{error}% + \Test{123}{error}% +\end{qstest} +\end{document} +%</test5> +% \end{macrocode} +% +% \subsection{Test for rotate} +% +% \begin{macrocode} +%<*test6> +\NeedsTeXFormat{LaTeX2e} +\documentclass{article} +\usepackage{pdflscape}[2007/10/21] +\begin{document} +\section{Portrait page} +\begin{landscape} +\section{Landscape page} +Foo bar foo bar foo bar foo bar foo bar +foo bar foo bar foo bar foo bar foo bar. +\end{landscape} +\section{Portrait Section} +Foo bar +\begin{landscape} +\section{Again Landscape Section} +\newpage +\section{Second Page of Landscape Section} +\end{landscape} +\section{Second Last Portrait Page} +\newpage +\section{Last Portrait Page} +\end{document} +%</test6> +% \end{macrocode} +% +% \begin{macrocode} +%<*result6> +/Page 1 /Rotate 0 +/Page 2 /Rotate 90 +/Page 3 /Rotate 0 +/Page 4 /Rotate 90 +/Page 5 /Rotate 90 +/Page 6 /Rotate 0 +/Page 7 /Rotate 0 +%</result6> +% \end{macrocode} +% +% \begin{macrocode} +%<*ExtractRotate> +/** + * ExtractRotate.java + * + * Copyright (C) 2007 by Heiko Oberdiek <oberdiek@uni-freiburg.de> + * + * Requires: PDFBox (http://www.pdfbox.org/) + * + * Syntax: java ExtractRotate <pdffile> <textfile> + * + * The <pdffile> is analyzed and for each page its rotation + * setting is printed in the <textfile>. Example: + * /Page 1 /Rotate 0 + * /Page 2 /Rotate 90 + */ +import java.io.FileInputStream; +import java.io.FileWriter; +import org.pdfbox.pdfparser.PDFParser; +import org.pdfbox.pdmodel.PDDocument; +import org.pdfbox.pdmodel.PDDocumentCatalog; +import org.pdfbox.pdmodel.PDPage; + +public class ExtractRotate { + + public static void main(String[] args) { + try { + String infile = args[0]; + String outfile = args[1]; + FileWriter out = new FileWriter(outfile); + PDFParser parser = + new PDFParser(new FileInputStream(infile)); + parser.parse(); + PDDocument document = parser.getPDDocument(); + PDDocumentCatalog catalog = document.getDocumentCatalog(); + int i = 0; + for (Object page: catalog.getAllPages()) { + i++; + out.write("/Page " + i + " " + "/Rotate " + + ((PDPage)page).findRotation() + "\n"); + } + document.close(); + out.close(); + } + catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } +} +%</ExtractRotate> +% \end{macrocode} +% % \section{Installation} % % \subsection{Download} @@ -595,6 +853,14 @@ and the derived files % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} % pdflscape.sty & tex/latex/oberdiek/pdflscape.sty\\ % pdflscape.pdf & doc/latex/oberdiek/pdflscape.pdf\\ +% test/pdflscape-test1.tex & doc/latex/oberdiek/test/pdflscape-test1.tex\\ +% test/pdflscape-test2.tex & doc/latex/oberdiek/test/pdflscape-test2.tex\\ +% test/pdflscape-test3.tex & doc/latex/oberdiek/test/pdflscape-test3.tex\\ +% test/pdflscape-test4.tex & doc/latex/oberdiek/test/pdflscape-test4.tex\\ +% test/pdflscape-test5.tex & doc/latex/oberdiek/test/pdflscape-test5.tex\\ +% test/pdflscape-test6.tex & doc/latex/oberdiek/test/pdflscape-test6.tex\\ +% test/pdflscape-test6.txt & doc/latex/oberdiek/test/pdflscape-test6.txt\\ +% test/ExtractRotate.java & doc/latex/oberdiek/test/ExtractRotate.java\\ % pdflscape.dtx & source/latex/oberdiek/pdflscape.dtx\\ % \end{tabular}^^A % }^^A @@ -759,6 +1025,12 @@ and the derived files % \item % Package \xpackage{atbegshi} replaces \xpackage{everyshi}. % \end{Version} +% \begin{Version}{2007/10/21 v0.9} +% \item +% Driver detection for \XeTeX\ added. +% \item +% Fix for rotation angles $\le$~-360 or $\ge$~360. +% \end{Version} % \end{History} % % \PrintIndex |