summaryrefslogtreecommitdiff
path: root/language/japanese/platex-tools/pxatbegshi.tex
blob: 0b1b326835ed3a2d23ffa7b264fc9c5e9c5eb1be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
%# -*- coding: utf-8 -*-
\ifx\epTeXinputencoding\undefined\else % defined in e-pTeX (> TL2016)
  \epTeXinputencoding utf8    % ensure utf-8 encoding for platex
\fi

\documentclass[a4paper]{jsarticle}
\usepackage{doc}
\usepackage{pxatbegshi}
\GetFileInfo{pxatbegshi.sty}
\title{Package \textsf{pxatbegshi} \fileversion}
\author{Hironobu Yamashita}
\date{\filedate}
\begin{document}

\maketitle

Package \textsf{atbegshi} (written by Heiko Oberdiek) provides
a command \verb+\AtBeginShipout{...}+, however it cannot be used
with Japanese classes for vertical writing (tarticle.cls, etc).
\begin{verbatim}
  ! Incompatible direction list can't be unboxed.
  \AtBeginShipoutAddToBox ...box \AtBeginShipoutBox 
                                                    \kern 0pt}\AtBegShi@restor...
\end{verbatim}
The package \textsf{pxatbegshi} provides a patch for \textsf{atbegshi}
to work with both horizontal and vertical writing.

With \pLaTeXe~2020-10-01 or later, this package does
nothing because the \pLaTeXe\ itself handles the situation.
Therefore, you will not need this package at all.

This package is part of \textsf{platex-tools} bundle:
\begin{verbatim}
  https://github.com/aminophen/platex-tools
\end{verbatim}

\bigskip

Heiko Oberdiek氏による\textsf{atbegshi}パッケージは
\verb+\AtBeginShipout{...}+というコマンドを提供しますが、これを
p\LaTeX の縦組クラス(tarticle.clsなど)で使うとエラーが出てしまいます
\footnote{単に縦組クラスで\textsf{atbegshi}パッケージを読み込んだだけ
では、エラーは出ないようです。}。
この\textsf{pxatbegshi}パッケージは、縦組クラスでも
\textsf{atbegshi}パッケージの機能を使えるようにするためのものです。
もちろん、横組クラスで\textsf{pxatbegshi}パッケージを使用しても
ほぼ問題は起きません。ただし、制約事項として
\begin{quote}
「\verb+\AtBeginShipout+の中身が外部垂直モードで実行されること」を
想定した使用は\emph{サポートしない}
\end{quote}
と明言します(例:\verb+aminophen/platex-tools#15+)。

\LaTeXe~2020-10-01以降では、\textsf{atbegshi}と同等の機能がカーネルに
実装されていて、その対処は\pLaTeXe{}カーネルでなされます。
この場合、\textsf{pxatbegshi}パッケージは何もしません。

\newpage
\section{使いかた}

使いかたは、\textsf{atbegshi}パッケージの代わりに、あるいは
\textsf{atbegshi}パッケージに追加して、\textsf{pxatbegshi}パッケージを
読みこむだけです。使用例:
\begin{verbatim}
  \documentclass[a4paper]{tarticle}
  \usepackage[dvipdfmx]{graphicx}
  \usepackage{pxatbegshi}
  \AtBeginShipout{%
    \AtBeginShipoutUpperLeft{%
      \parbox[t][\paperheight][b]{\paperwidth}{%
        \includegraphics[width=210truemm]{background.eps}}}}
  \begin{document}
  背景に透かしを入れます。
  \end{document}
\end{verbatim}

\section{謝辞}

本パッケージの実装は、北川さん(Hironori Kitagawa)による
「\verb+\AtBegShi@Output+の処理を強引に横組でやらせるコード」
をベースにしています\footnote{2018/09/21 v0.4では
Takayuki Yato (ZR) さんによる\textsf{bxpapersize}パッケージを参考に
していましたが、\textsf{multicol}パッケージで問題が起きるようなので
v0.3以前と同様に北川さんのコードベースに戻しました。}。

\section*{References}

\begin{itemize}
\item utbookでatbegshiパッケージを使いたい\\
  \texttt{https://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=2134}
\item \relax[tex-jp-build] [ptex] ページ・数式の組方向
      (※北川さんのコードの初出)\\
  \texttt{https://github.com/texjporg/tex-jp-build/issues/21}
\item CTAN: Package \textsf{bxpapersize}\\
  \texttt{https://ctan.org/pkg/bxpapersize}
\end{itemize}

\end{document}