OSDN Git Service

Add lltjp-geometry.sty: Patch to geometry for LuaTeX-ja with vertical writing mode.
authorKazuki Maeda <kmaeda@kmaeda.net>
Sat, 22 Nov 2014 12:27:01 +0000 (21:27 +0900)
committerKazuki Maeda <kmaeda@kmaeda.net>
Sat, 22 Nov 2014 12:27:01 +0000 (21:27 +0900)
src/ltj-latex.sty
src/ltjclasses.dtx
src/ltjtarticle.cls
src/ltjtbook.cls
src/ltjtreport.cls
src/patches/lltjp-geometry.sty [new file with mode: 0644]

index 922a9c9..6aa8bfd 100644 (file)
@@ -63,6 +63,7 @@
 \ltj@pkgpatch{xunicode}
 \ltj@pkgpatch{fontspec}
 \ltj@pkgpatch{stfloats}
 \ltj@pkgpatch{xunicode}
 \ltj@pkgpatch{fontspec}
 \ltj@pkgpatch{stfloats}
+\RequirePackage{lltjp-geometry}
 
 
 %%------------------ all done
 
 
 %%------------------ all done
index 7827837..0715a48 100644 (file)
@@ -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-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
 % \fi
 %
 % \iffalse
 %<*article|report|book>
 \RequirePackage{luatexja}
 %    \end{macrocode}
 %<*article|report|book>
 \RequirePackage{luatexja}
 %    \end{macrocode}
-% 縦組みの場合は|geometry|対応のために|filehook|も読み込んでおきます。
-%    \begin{macrocode}
-%<tate>\RequirePackage{filehook}
-%    \end{macrocode}
 %
 % \section{オプションスイッチ}
 % ここでは、後ほど使用するいくつかのコマンドやスイッチを定義しています。
 %
 % \section{オプションスイッチ}
 % ここでは、後ほど使用するいくつかのコマンドやスイッチを定義しています。
   \setlength\paperheight {257mm}
   \setlength\paperwidth  {182mm}}
 %    \end{macrocode}
   \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}}}
-%</tate>
 %
 % \subsection{サイズオプション}
 % 基準となるフォントの大きさを指定するオプションです。
 %
 % \subsection{サイズオプション}
 % 基準となるフォントの大きさを指定するオプションです。
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
    \list{\csname label\@enumctr\endcsname}{%
    \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@
          \ifnum \@listdepth=\@ne \topsep.5\normalbaselineskip
            \else\topsep\z@\fi
          \parskip\z@ \itemsep\z@ \parsep\z@
 %    \begin{macrocode}
 \newcommand{\labelitemi}{\textbullet}
 \newcommand{\labelitemii}{%
 %    \begin{macrocode}
 \newcommand{\labelitemi}{\textbullet}
 \newcommand{\labelitemii}{%
-  \ifnum\ltjgetparameter{direction}=3 
+  \ifnum\ltjgetparameter{direction}=3
      {\textcircled{~}}
   \else
      {\normalfont\bfseries\textendash}
      {\textcircled{~}}
   \else
      {\normalfont\bfseries\textendash}
    \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
    \expandafter
    \list{\csname \@itemitem\endcsname}{%
    \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@
          \ifnum \@listdepth=\@ne \topsep.5\normalbaselineskip
            \else\topsep\z@\fi
          \parskip\z@ \itemsep\z@ \parsep\z@
 %    \begin{macrocode}
 \newenvironment{description}
   {\list{}{\labelwidth\z@ \itemindent-\leftmargin
 %    \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@
      \leftmargin\leftskip \advance\leftmargin3\Cwd
      \rightmargin\rightskip
      \labelsep=1\zw \itemsep\z@
index 0b2b13e..306c4ac 100644 (file)
@@ -42,7 +42,6 @@
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
-\RequirePackage{filehook}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue
   \setlength\paperheight {257mm}
   \setlength\paperwidth  {182mm}}
 \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
 \if@compatibility
   \renewcommand{\@ptsize}{0}
 \else
index b9c94c2..7c489d0 100644 (file)
@@ -42,7 +42,6 @@
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
-\RequirePackage{filehook}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue
   \setlength\paperheight {257mm}
   \setlength\paperwidth  {182mm}}
 \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
 \if@compatibility
   \renewcommand{\@ptsize}{0}
 \else
index 57be83f..ac27deb 100644 (file)
@@ -42,7 +42,6 @@
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
   [2014/11/15 v1.6-ltj-7
  Standard LuaLaTeX-ja class]
 \RequirePackage{luatexja}
-\RequirePackage{filehook}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \newcounter{@paper}
 \newif\if@landscape \@landscapefalse
 \newcommand{\@ptsize}{}
 \DeclareOption{b5p}{\setcounter{@paper}{4}\@stysizetrue
   \setlength\paperheight {257mm}
   \setlength\paperwidth  {182mm}}
 \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
 \if@compatibility
   \renewcommand{\@ptsize}{0}
 \else
diff --git a/src/patches/lltjp-geometry.sty b/src/patches/lltjp-geometry.sty
new file mode 100644 (file)
index 0000000..cbd03f2
--- /dev/null
@@ -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