%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjp-geometry}[2015/01/01 Patch to geometry for LuaTeX-ja with vertical writing mode]
+\ProvidesPackage{lltjp-geometry}[2017/05/05 Patch to geometry for LuaTeX-ja with vertical writing mode]
\RequirePackage{ifluatex}
\ifdefined\if@ltj@@geometry@tate\expandafter\endinput\fi
\fi
\RequirePackage{filehook}
+\RequirePackage{etoolbox}
\newif\ifGm@ltj@layoutswitch
\let\orig@PackageWarningNoLine=\PackageWarningNoLine
-\ifdefined\ifGm@swap@papersize\else\newif\ifGm@swap@papersize\fi
+% define ifGm@swap@papersize if it is undefined
+\expandafter\newif\csname ifGm@swap@papersize\endcsname
\AtBeginOfPackageFile{geometry}{%
\edef\Gm@ltj@topskip{\the\topskip}
\define@key{Gm}{noheadfoot}[true]{\Gm@doifelse{noheadfoot}{#1}%
{\Gm@setlength\headheight\z@\Gm@defbylen{ltj@headsep}\z@
\Gm@defbylen{ltj@footskip}\z@}{}}%
+\define@key{Gm}{layoutwidth}{\Gm@layouttrue\Gm@setlength\Gm@layoutheight{#1}}%
+\define@key{Gm}{layoutheight}{\Gm@layouttrue\Gm@setlength\Gm@layoutwidth{#1}}%
+\define@key{Gm}{layoutsize}{\Gm@branch{#1}{layoutwidth}{layoutheight}}%
+\define@key{Gm}{layout}{\Gm@layouttrue\@nameuse{Gm@#1}{Gm@layout}%
+ \Gm@setlength\@tempdima{\Gm@layoutheight}%
+ \Gm@setlength\Gm@layoutheight{\Gm@layoutwidth}%
+ \Gm@setlength\Gm@layoutwidth{\@tempdima}%
+}%
% \@mparswitch は傍注の出力位置を左右ページで変えるスイッチだが,
% geometry.sty はこれを左右ページのレイアウトを変えるか否かの判定にも使っている.
\ifGm@showcrop
\vb@xt@\z@{\vskip-1\Gm@truedimen in\vskip\Gm@layoutvoffset%
\hb@xt@\z@{\hskip-1\Gm@truedimen in\hskip\Gm@layouthoffset%
- \vb@xt@\Gm@layoutheight{%
+ \vb@xt@\Gm@layoutwidth{%
\let\protect\relax
- \hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,1,-3,3)\hfil\Gm@cropmark(1,1,3,3)}%
+ \hb@xt@\Gm@layoutheight{\Gm@cropmark(-1,1,-3,3)\hfil\Gm@cropmark(1,1,3,3)}%
\vfil
- \hb@xt@\Gm@layoutwidth{\Gm@cropmark(-1,-1,-3,-3)\hfil\Gm@cropmark(1,-1,3,-3)}}%
+ \hb@xt@\Gm@layoutheight{\Gm@cropmark(-1,-1,-3,-3)\hfil\Gm@cropmark(1,-1,3,-3)}}%
\hss}%
\vss}%
\fi%
\fi
\setlength\topskip\Gm@ltj@topskip
\ifx\Gm@lines\@undefined\else
- \setlength\maxdepth{1\Cht}%
+ \@tempdima=\f@size\p@ \@tempdima=.5\@tempdima
+ \ifluatex
+ \advance\@tempdima\ltjgetparameter{talbaselineshift}%
+ \else
+ \advance\@tempdima\tbaselineshift
+ \fi
+ \ifdim\maxdepth<\@tempdima
+ \PackageWarningNoLine{lltjp-geometry}%
+ {\noexpand\maxdepth was changed from \the\maxdepth\space
+ to \the\@tempdima}
+ \maxdepth\@tempdima
+ \fi
\setbox\z@=\hbox{\tate% next \ifdim must be executed in tate dir.
\ifdim\topskip<\ht\tstrutbox
\@tempdima\topskip
\global\topskip\ht\tstrutbox
\PackageWarningNoLine{lltjp-geometry}%
- {do not worry about `\noexpand\topskip was changed ...'\MessageBreak
- warning above}
- \PackageWarningNoLine{lltjp-geometry}%
{\noexpand\topskip was changed from \the\@tempdima\space
to \the\topskip}
\fi}%
\addtolength\@tempdimb{\topskip}%
\textheight\@tempdimb
\fi
- \advance\oddsidemargin\Gm@layoutvoffset%
- \advance\evensidemargin\Gm@layoutvoffset%
- \advance\topmargin\Gm@layouthoffset%
+ \advance\oddsidemargin\Gm@layouthoffset%
+ \advance\evensidemargin\Gm@layouthoffset%
+ \advance\topmargin\Gm@layoutvoffset%
\addtolength\Gm@layoutheight{\Gm@bindingoffset}%
}% end of \Gm@@process
% log