summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/orientation
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-01-12 03:01:27 +0000
committerNorbert Preining <norbert@preining.info>2021-01-12 03:01:27 +0000
commit59f820c29fe15f643154da97419acf78749bde8f (patch)
tree5a94f2584a397d60ae601482df04347c9dbc214a /macros/latex/contrib/orientation
parent5187d8af76756cc8c101de4a50c9ccfb9acd0c9a (diff)
CTAN sync 202101120301
Diffstat (limited to 'macros/latex/contrib/orientation')
-rw-r--r--macros/latex/contrib/orientation/README33
-rw-r--r--macros/latex/contrib/orientation/orientation.sty15
2 files changed, 48 insertions, 0 deletions
diff --git a/macros/latex/contrib/orientation/README b/macros/latex/contrib/orientation/README
new file mode 100644
index 0000000000..c9652c9cb4
--- /dev/null
+++ b/macros/latex/contrib/orientation/README
@@ -0,0 +1,33 @@
+orientation 1.0 (January 10, 2021)
+Set page orientation for dvips/Ghostscript
+Daniel Benjamin Miller <dbmiller@dbmiller.org>
+
+When using dvips with Ghostscript, the various PDF auto-rotation modes may
+sometimes need some tweaking. Using the auto-rotation feature of Ghostscript
+may suffice in most cases: it sets the orientation of the pages of the PDF
+according to text direction (either per-page or for the whole document).
+
+But sometimes we don't want this. For instance, Ghostscript may not obey
+the orientation set by geometry or other packages.
+
+We have eight commands available, in two categories.
+
+These commands orient the current page and all following pages:
+
+* \setportrait
+* \setlandscape
+* \setupsidedown
+* \setcounterlandscape
+
+These commands orient the current page only:
+
+* \thispageportrait
+* \thispagelandscape
+* \thispageupsidedown
+* \thispagecounterlandscape
+
+If you don't process your file with dvips and Ghostscript/ps2pdf, then don't
+expect any of these commands to do anything.
+
+Made available under the CC-Zero Dedication, 2021
+For more info: https://creativecommons.org/publicdomain/zero/1.0/
diff --git a/macros/latex/contrib/orientation/orientation.sty b/macros/latex/contrib/orientation/orientation.sty
new file mode 100644
index 0000000000..e5f47922ba
--- /dev/null
+++ b/macros/latex/contrib/orientation/orientation.sty
@@ -0,0 +1,15 @@
+\ProvidesPackage{orientation}[orientation 1.0]
+% orientation package by Daniel Benjamin Miller <dbmiller@dbmiller.org>
+% Made available under the CC-Zero Dedication, 2021
+% For more info: https://creativecommons.org/publicdomain/zero/1.0/
+\RequirePackage{everypage}
+\makeatletter
+\newcommand{\thispagelandscape}{\special{ps:[{ThisPage} <</Rotate 90>> /PUT pdfmark true}}
+\newcommand{\thispageupsidedown}{\special{ps:[{ThisPage} <</Rotate 180>> /PUT pdfmark true}}
+\newcommand{\thispagecounterlandscape}{\special{ps:[{ThisPage} <</Rotate 270>> /PUT pdfmark true}}
+\newcommand{\thispageportrait}{\special{ps:[{ThisPage} <</Rotate 0>> /PUT pdfmark true}}
+\newcommand{\setlandscape}{\AddEverypageHook{\special{ps:[{ThisPage} <</Rotate 90>> /PUT pdfmark true}}}
+\newcommand{\setcounterlandscape}{\AddEverypageHook{\special{ps:[{ThisPage} <</Rotate 270>> /PUT pdfmark true}}}
+\newcommand{\setupsidedown}{\AddEverypageHook{\special{ps:[{ThisPage} <</Rotate 180>> /PUT pdfmark true}}}
+\newcommand{\setportrait}{\AddEverypageHook{\special{ps:[{ThisPage} <</Rotate 0>> /PUT pdfmark true}}}
+\endinput \ No newline at end of file