From: Kazuki Maeda Date: Sat, 22 Nov 2014 12:27:01 +0000 (+0900) Subject: Add lltjp-geometry.sty: Patch to geometry for LuaTeX-ja with vertical writing mode. X-Git-Tag: 20150420.0~78 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;ds=sidebyside;h=01421fd75f2315990922b24158d5830d245da053;p=luatex-ja%2Fluatexja.git Add lltjp-geometry.sty: Patch to geometry for LuaTeX-ja with vertical writing mode. --- diff --git a/src/ltj-latex.sty b/src/ltj-latex.sty index 922a9c9..6aa8bfd 100644 --- a/src/ltj-latex.sty +++ b/src/ltj-latex.sty @@ -63,6 +63,7 @@ \ltj@pkgpatch{xunicode} \ltj@pkgpatch{fontspec} \ltj@pkgpatch{stfloats} +\RequirePackage{lltjp-geometry} %%------------------ all done diff --git a/src/ltjclasses.dtx b/src/ltjclasses.dtx index 7827837..0715a48 100644 --- a/src/ltjclasses.dtx +++ b/src/ltjclasses.dtx @@ -82,6 +82,7 @@ % \changes{v1.6-ltj-5}{2014/07/02}{\cs{ifydir}, \cs{iftdir}を使わないように修正.} % \changes{v1.6-ltj-6}{2014/07/28}{縦組クラスでlltjext.styを読み込むように修正.} % \changes{v1.6-ltj-7}{2014/11/15}{縦組クラスとeveryshi.styとの相性が悪い問題を修正.} +% \changes{v1.6-ltj-8}{2014/11/22}{縦組時のgeometry.styへの対応を別ファイル(lltjp-geometry.sty)に分離.それに伴いv1.6-ltj-3での変更を削除.} % \fi % % \iffalse @@ -177,10 +178,6 @@ %<*article|report|book> \RequirePackage{luatexja} % \end{macrocode} -% 縦組みの場合は|geometry|対応のために|filehook|も読み込んでおきます。 -% \begin{macrocode} -%\RequirePackage{filehook} -% \end{macrocode} % % \section{オプションスイッチ} % ここでは、後ほど使用するいくつかのコマンドやスイッチを定義しています。 @@ -324,19 +321,6 @@ \setlength\paperheight {257mm} \setlength\paperwidth {182mm}} % \end{macrocode} -% 縦組クラスについて、|geometry|パッケージが読み込まれると|\textwidth|と|\textheight|が -% ひっくり返ってしまう問題に対処します。 -% \begin{macrocode} -%<*tate> -\AtEndOfPackageFile{geometry}{% - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}% - \expandafter\def\expandafter\Gm@process\expandafter{\Gm@process - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}}} -% % % \subsection{サイズオプション} % 基準となるフォントの大きさを指定するオプションです。 @@ -3083,7 +3067,7 @@ \advance\@enumdepth\@ne \edef\@enumctr{enum\romannumeral\the\@enumdepth}% \list{\csname label\@enumctr\endcsname}{% - \ifnum\ltjgetparameter{direction}=3 + \ifnum\ltjgetparameter{direction}=3 \ifnum \@listdepth=\@ne \topsep.5\normalbaselineskip \else\topsep\z@\fi \parskip\z@ \itemsep\z@ \parsep\z@ @@ -3111,7 +3095,7 @@ % \begin{macrocode} \newcommand{\labelitemi}{\textbullet} \newcommand{\labelitemii}{% - \ifnum\ltjgetparameter{direction}=3 + \ifnum\ltjgetparameter{direction}=3 {\textcircled{~}} \else {\normalfont\bfseries\textendash} @@ -3136,7 +3120,7 @@ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}% \expandafter \list{\csname \@itemitem\endcsname}{% - \ifnum\ltjgetparameter{direction}=3 + \ifnum\ltjgetparameter{direction}=3 \ifnum \@listdepth=\@ne \topsep.5\normalbaselineskip \else\topsep\z@\fi \parskip\z@ \itemsep\z@ \parsep\z@ @@ -3161,7 +3145,7 @@ % \begin{macrocode} \newenvironment{description} {\list{}{\labelwidth\z@ \itemindent-\leftmargin - \ifnum\ltjgetparameter{direction}=3 + \ifnum\ltjgetparameter{direction}=3 \leftmargin\leftskip \advance\leftmargin3\Cwd \rightmargin\rightskip \labelsep=1\zw \itemsep\z@ diff --git a/src/ltjtarticle.cls b/src/ltjtarticle.cls index 0b2b13e..306c4ac 100644 --- a/src/ltjtarticle.cls +++ b/src/ltjtarticle.cls @@ -42,7 +42,6 @@ [2014/11/15 v1.6-ltj-7 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} -\RequirePackage{filehook} \newcounter{@paper} \newif\if@landscape \@landscapefalse \newcommand{\@ptsize}{} @@ -90,14 +89,6 @@ \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue \setlength\paperheight {257mm} \setlength\paperwidth {182mm}} -\AtEndOfPackageFile{geometry}{% - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}% - \expandafter\def\expandafter\Gm@process\expandafter{\Gm@process - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}}} \if@compatibility \renewcommand{\@ptsize}{0} \else diff --git a/src/ltjtbook.cls b/src/ltjtbook.cls index b9c94c2..7c489d0 100644 --- a/src/ltjtbook.cls +++ b/src/ltjtbook.cls @@ -42,7 +42,6 @@ [2014/11/15 v1.6-ltj-7 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} -\RequirePackage{filehook} \newcounter{@paper} \newif\if@landscape \@landscapefalse \newcommand{\@ptsize}{} @@ -92,14 +91,6 @@ \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue \setlength\paperheight {257mm} \setlength\paperwidth {182mm}} -\AtEndOfPackageFile{geometry}{% - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}% - \expandafter\def\expandafter\Gm@process\expandafter{\Gm@process - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}}} \if@compatibility \renewcommand{\@ptsize}{0} \else diff --git a/src/ltjtreport.cls b/src/ltjtreport.cls index 57be83f..ac27deb 100644 --- a/src/ltjtreport.cls +++ b/src/ltjtreport.cls @@ -42,7 +42,6 @@ [2014/11/15 v1.6-ltj-7 Standard LuaLaTeX-ja class] \RequirePackage{luatexja} -\RequirePackage{filehook} \newcounter{@paper} \newif\if@landscape \@landscapefalse \newcommand{\@ptsize}{} @@ -91,14 +90,6 @@ \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue \setlength\paperheight {257mm} \setlength\paperwidth {182mm}} -\AtEndOfPackageFile{geometry}{% - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}% - \expandafter\def\expandafter\Gm@process\expandafter{\Gm@process - \setlength{\@tempdima}{\textheight}% - \setlength{\textheight}{\textwidth}% - \setlength{\textwidth}{\@tempdima}}} \if@compatibility \renewcommand{\@ptsize}{0} \else diff --git a/src/patches/lltjp-geometry.sty b/src/patches/lltjp-geometry.sty new file mode 100644 index 0000000..cbd03f2 --- /dev/null +++ b/src/patches/lltjp-geometry.sty @@ -0,0 +1,171 @@ +% +% lltjp-geometry.sty +% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{lltjp-geometry}[2014/11/22 Patch to geometry for LuaTeX-ja with vertical writing mode] +\RequirePackage{luatexja} +\RequirePackage{filehook} + +\AtEndOfPackageFile{geometry}{% +\ifnum\ltjgetparameter{direction}=3% +\define@key{Gm}{hdivide}{\Gm@parse@divide{#1}{tmargin}{width}{bmargin}}% +\define@key{Gm}{vdivide}{\Gm@parse@divide{#1}{rmargin}{height}{lmargin}}% +\define@key{Gm}{divide}{\Gm@parse@divide{#1}{lmargin}{width}{rmargin}% + \Gm@parse@divide{#1}{rmargin}{height}{lmargin}}% +\define@key{Gm}{hmargin}{\Gm@branch{#1}{tmargin}{bmargin}}% +\define@key{Gm}{vmargin}{\Gm@branch{#1}{rmargin}{lmargin}}% +\define@key{Gm}{margin}{\Gm@branch{#1}{tmargin}{rmargin}% + \Gm@branch{#1}{bmargin}{lmargin}}% +\def\Gm@detall#1#2#3#4{% + \@tempcnta\z@ + \if#1h + \let\Gm@mratio\Gm@hmarginratio + \edef\Gm@Dmratio{\if@twoside\Gm@Dhratiotwo\else\Gm@Dhratio\fi}% + \else + \let\Gm@mratio\Gm@vmarginratio + \edef\Gm@Dmratio{\Gm@Dvratio}% + \fi + \if#1h + \ifx\Gm@tmargin\@undefined\else\advance\@tempcnta4\relax\fi + \ifGm@hbody\advance\@tempcnta2\relax\fi + \ifx\Gm@bmargin\@undefined\else\advance\@tempcnta1\relax\fi + \Gm@cnth\@tempcnta + \else + \ifx\Gm@lmargin\@undefined\else\advance\@tempcnta4\relax\fi + \ifGm@vbody\advance\@tempcnta2\relax\fi + \ifx\Gm@rmargin\@undefined\else\advance\@tempcnta1\relax\fi + \Gm@cntv\@tempcnta + \fi + \ifcase\@tempcnta + \if#1h + \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}% + \else + \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}% + \fi + \Gm@detiiandiii{#2}{#3}{#4}% + \or + \ifx\Gm@mratio\@undefined + \if#1h + \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}% + \else + \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}% + \fi + \setlength\@tempdimc{\@nameuse{Gm@#4}}% + \Gm@detiiandiii{#2}{#3}{#4}% + \expandafter\let\csname Gm@#2\endcsname\@undefined + \Gm@defbylen{#4}{\@tempdimc}% + \else + \Gm@setbyratio[f]{#1}{#4}{#3}% + \fi + \Gm@detiv{#2}{#3}{#4}{#2}% + \or\Gm@detiiandiii{#2}{#3}{#4}% + \or\Gm@detiv{#2}{#2}{#4}{#3}% + \or + \ifx\Gm@mratio\@undefined + \if#1h + \Gm@defbylen{width}{\Gm@Dhscale\Gm@layoutwidth}% + \else + \Gm@defbylen{height}{\Gm@Dvscale\Gm@layoutheight}% + \fi + \setlength\@tempdimc{\@nameuse{Gm@#3}}% + \Gm@detiiandiii{#2}{#4}{#3}% + \expandafter\let\csname Gm@#2\endcsname\@undefined + \Gm@defbylen{#3}{\@tempdimc}% + \else + \Gm@setbyratio[b]{#1}{#3}{#4}% + \fi + \Gm@detiv{#2}{#3}{#4}{#2}% + \or\Gm@detiv{#2}{#3}{#4}{#2}% + \or\Gm@detiv{#2}{#2}{#3}{#4}% + \or\Gm@warning{Over-specification in `#1'-direction.% + ^^J\@spaces `#2' (\@nameuse{Gm@#2}) is ignored}% + \Gm@detiv{#2}{#3}{#4}{#2}% + \else\fi}% +\def\Gm@adjustpaper{% + \ifdim\paperwidth>\p@\else + \PackageError{geometry}{% + \string\paperwidth\space(\the\paperwidth) too short}{% + Set a paper type (e.g., `a4paper').}% + \fi + \ifdim\paperheight>\p@\else + \PackageError{geometry}{% + \string\paperheight\space(\the\paperheight) too short}{% + Set a paper type (e.g., `a4paper').}% + \fi + \ifGm@swap@papersize + \setlength\@tempdima{\paperwidth}% + \setlength\paperwidth{\paperheight}% + \setlength\paperheight{\@tempdima}% + \fi + \ifGm@layout\else + \setlength\Gm@layoutwidth{\paperheight}% + \setlength\Gm@layoutheight{\paperwidth}% + \fi}% +\def\Gm@@process{% + \Gm@expandlengths + \Gm@adjustpaper + \addtolength\Gm@layoutwidth{-\Gm@bindingoffset}% + \Gm@adjustmp + \Gm@adjustbody + \Gm@detall{h}{width}{tmargin}{bmargin}% + \Gm@detall{v}{height}{lmargin}{rmargin}% + \setlength\textwidth{\Gm@width}% + \setlength\textheight{\Gm@height}% + \setlength\topmargin{\Gm@tmargin}% + \setlength\oddsidemargin{\Gm@lmargin}% + \addtolength\oddsidemargin{-1\Gm@truedimen in}% + \ifGm@includemp + \advance\textheight-\Gm@wd@mp + \advance\oddsidemargin\Gm@odd@mp + \fi + \if@mparswitch + \setlength\evensidemargin{\Gm@rmargin}% + \addtolength\evensidemargin{-1\Gm@truedimen in}% + \ifGm@includemp + \advance\evensidemargin\Gm@even@mp + \fi + \else + \evensidemargin\oddsidemargin + \fi + \advance\oddsidemargin\Gm@bindingoffset + \addtolength\topmargin{-1\Gm@truedimen in}% + \ifGm@includehead + \addtolength\textwidth{-\headheight}% + \addtolength\textwidth{-\headsep}% + \else + \addtolength\topmargin{-\headheight}% + \addtolength\topmargin{-\headsep}% + \fi + \ifGm@includefoot + \addtolength\textwidth{-\footskip}% + \fi + \ifGm@heightrounded + \setlength\@tempdima{\textheight}% + \addtolength\@tempdima{-\topskip}% + \@tempcnta\@tempdima + \@tempcntb\baselineskip + \divide\@tempcnta\@tempcntb + \setlength\@tempdimb{\baselineskip}% + \multiply\@tempdimb\@tempcnta + \advance\@tempdima-\@tempdimb + \multiply\@tempdima\tw@ + \ifdim\@tempdima>\baselineskip + \addtolength\@tempdimb{\baselineskip}% + \fi + \addtolength\@tempdimb{\topskip}% + \textheight\@tempdimb + \fi + \advance\oddsidemargin\Gm@layoutvoffset% + \advance\evensidemargin\Gm@layoutvoffset% + \advance\topmargin\Gm@layouthoffset% + \addtolength\Gm@layoutheight{\Gm@bindingoffset}% +}% end of \Gm@@process +\Gm@initall +\Gm@processconfig +\ProcessOptionsKV[c]{Gm}% +\Gm@setdefaultpaper +\ProcessOptionsKV[p]{Gm}% +\Gm@process +\fi} +\endinput