summaryrefslogtreecommitdiff
path: root/macros/jptex/latex/pxtatescale
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-07-21 03:00:45 +0000
committerNorbert Preining <norbert@preining.info>2022-07-21 03:00:45 +0000
commit5cf5182b44c08dfb2bc977ce5aa5ca6d03b36923 (patch)
treeb32d29c9fb1289ccc994ee099b27c4a45b621a0a /macros/jptex/latex/pxtatescale
parent2773132ea593028dafe764f7560fd94ecb827d3d (diff)
CTAN sync 202207210300
Diffstat (limited to 'macros/jptex/latex/pxtatescale')
-rw-r--r--macros/jptex/latex/pxtatescale/LICENSE24
-rw-r--r--macros/jptex/latex/pxtatescale/README41
-rw-r--r--macros/jptex/latex/pxtatescale/pxtatescale.sty43
3 files changed, 108 insertions, 0 deletions
diff --git a/macros/jptex/latex/pxtatescale/LICENSE b/macros/jptex/latex/pxtatescale/LICENSE
new file mode 100644
index 0000000000..d2d2a02dd5
--- /dev/null
+++ b/macros/jptex/latex/pxtatescale/LICENSE
@@ -0,0 +1,24 @@
+This software is distributed under the MIT License.
+
+The MIT License
+
+Copyright (c) 2013 Takayuki YATO (aka. "ZR")
+Copyright (c) 2017 Hironobu Yamashita (aka. "aminophen")
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/macros/jptex/latex/pxtatescale/README b/macros/jptex/latex/pxtatescale/README
new file mode 100644
index 0000000000..5f811cb249
--- /dev/null
+++ b/macros/jptex/latex/pxtatescale/README
@@ -0,0 +1,41 @@
+pxtatescale
+===========
+
+LaTeX: to make scaling work also with vertical direction of (u)pTeX
+and dvipdfmx
+
+The graphics' feature of "scaling" (`\scalebox`, `\reflextbox` and
+`\resizebox`) with dvipdfmx driver results in a wrong direction of
+stretch, when used in the vertical direction of pTeX. This behavior
+is caused by the fact that internal X and Y directions of pTeX
+`\tate` mode correspond to physical top-to-bottom and right-to-left
+directions respectively. This package provides a fix for the problem.
+
+### Installation
+
+ - `*.sty` → $TEXMF/tex/latex/pxtatescale
+
+### Usage
+
+Load this package after graphicx (or graphics) package.
+
+ \documentclass[dvipdfmx]{article}
+ \usepackage{graphicx} % or graphics
+ \usepackage{pxtatescale}
+
+Note that this package is of no use unless you work on e-(u)pTeX +
+dvipdfmx combination.
+
+Revision History
+----------------
+
+ * 2013/03/25 v0.2
+ - The first public version. (TY)
+ * 2017/01/16 v0.3
+ - Updated for new dvipdfmx.def with pdf-based scaling. (HY)
+ * 2017/01/21 v0.4
+ - Ensure graphics driver `dvipdfmx` before applying a patch. (HY)
+
+------------------
+Hironobu Yamashita
+https://github.com/aminophen
diff --git a/macros/jptex/latex/pxtatescale/pxtatescale.sty b/macros/jptex/latex/pxtatescale/pxtatescale.sty
new file mode 100644
index 0000000000..9f8745d354
--- /dev/null
+++ b/macros/jptex/latex/pxtatescale/pxtatescale.sty
@@ -0,0 +1,43 @@
+% pxtatescale.sty
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxtatescale}[2017/01/21 v0.4]
+\def\pxqtg@pkgname{pxtatescale}
+\@ifpackageloaded{graphics}{}{%else
+ \PackageError\pxqtg@pkgname{Package 'graphics' not loaded}\@ehc}
+\begingroup
+% the patch is necessary only when dvipdfmx.def is used
+\def\pxqtg@tempa{dvipdfmx.def}
+\ifx\Gin@driver\pxqtg@tempa %%% if-group
+% prepare
+\def\pxqtg@patch@status{1}%
+\def\pxqtg@try@patch#1#2#3{%
+ \edef\pxqtg@tempcsname{\string#1}%
+ \def\pxqtg@temp{#2}\ifx#1\pxqtg@temp
+ \gdef#1{#3}%
+ \def\pxqtg@patch@status{0}%
+ \fi}
+% first trial (new definition)
+\pxqtg@try@patch\Gscale@start
+ {\special{pdf:btrans}%
+ \special{pdf:literal \Gscale@x\space 0 0 \Gscale@y\space 0 0 cm}}
+ {\special{pdf:btrans}%
+ \special{pdf:literal
+ \iftdir \Gscale@y\space 0 0 \Gscale@x\space
+ \else \Gscale@x\space 0 0 \Gscale@y\space
+ \fi 0 0 cm}}
+\ifnum\pxqtg@patch@status=\z@\else
+ % second trial (old definition)
+ \pxqtg@try@patch\Gscale@start
+ {\special{pdf:btrans xscale \Gscale@x\space yscale \Gscale@y}}%
+ {\special{pdf:btrans
+ \iftdir xscale \Gscale@y\space yscale \Gscale@x
+ \else xscale \Gscale@x\space yscale \Gscale@y
+ \fi}}
+\fi
+\ifnum\pxqtg@patch@status=\z@
+ \PackageInfo\pxqtg@pkgname{Patch applied to \pxqtg@tempcsname}%
+\else
+ \PackageWarningNoLine\pxqtg@pkgname{Patch cannot be applied to \pxqtg@tempcsname}%
+\fi
+\fi %%% if-group end
+\endgroup