summaryrefslogtreecommitdiff
path: root/language/japanese/platex-tools/pxftnright.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /language/japanese/platex-tools/pxftnright.sty
Initial commit
Diffstat (limited to 'language/japanese/platex-tools/pxftnright.sty')
-rw-r--r--language/japanese/platex-tools/pxftnright.sty140
1 files changed, 140 insertions, 0 deletions
diff --git a/language/japanese/platex-tools/pxftnright.sty b/language/japanese/platex-tools/pxftnright.sty
new file mode 100644
index 0000000000..2b5d4382b4
--- /dev/null
+++ b/language/japanese/platex-tools/pxftnright.sty
@@ -0,0 +1,140 @@
+%
+% pxftnright.sty
+% written by Hironobu Yamashita (@aminophen)
+%
+% This package is part of the platex-tools bundle.
+% https://github.com/aminophen/platex-tools
+%
+% This package `pxftnright' is based on:
+% * ftnright.sty in latex-tools (2014/10/28 v1.1f)
+%
+% Problems with ftnright to use with pLaTeX:
+% * \@startcolumn is redefined
+% (incompatible with vertical typesetting)
+% * \@makecol is redefined
+% (bottom float after footnote)
+% * \@makefntext is redefined
+% (incompatible with some pLaTeX classes)
+% * \footnotesep is not suitable for vertical typesetting
+% when used with pLaTeX 2016/11/29 or earlier
+% (rather a problem of \strutbox in pLaTeX2e kernel)
+% so, this package provides patches.
+%
+
+\NeedsTeXFormat{pLaTeX2e}
+\ProvidesPackage{pxftnright}
+ [2017/02/28 v1.1 footnote layout package for pLaTeX]
+
+%% save \@makefntext definition from pLaTeX class
+\@ifpackageloaded{ftnright}{%
+ \PackageError{pxftnright}{%
+ Package ftnright is already loaded!\MessageBreak
+ Load pxftnright earlier}\@ehc
+}{}
+\let\pxftn@makefntext\@makefntext
+
+%% load ftnright package
+\RequirePackage{ftnright}
+
+%% patches for ftnright to work fine with pLaTeX
+%% This code is based on pLaTeX2e 2017/04/08 community ed.
+
+\def\@startcolumn{%
+ \ifx\@deferlist\@empty
+ \global\@fcolmadefalse
+ \global\@colroom\@colht
+ \else
+ \ifvoid\footins\else
+ \ftn@amount\ht\footins
+ \advance\ftn@amount\dp\footins
+ \advance\ftn@amount\skip\footins
+ \fi
+ \global\advance\@colht-\ftn@amount
+ \global\@colroom\@colht
+ \@xstartcol
+ \global\advance\@colht\ftn@amount
+ \global\advance\@colroom\ftn@amount
+ \fi
+ \if@fcolmade
+ \setbox\@cclv\box\@outputbox
+ \@makecol
+ \else
+%%%%% change for pLaTeX (import from \@reinserts in plcore)
+ \ifvoid\footins\else\insert\footins{%
+ \iftbox\footins\tate\else\yoko\fi
+ \unvbox\footins}\fi
+%%%%%
+ \fi}
+
+\def\@makecol{%
+%%%%% change for pLaTeX
+ \setbox\@outputbox\box\@cclv
+%%%%%
+ \if@firstcolumn
+ \if@twocolumn \else
+ \ifvoid\footins \else
+ \@latexerr{ftnright package
+ used in one-column mode}%
+ {The ftnright package was designed to
+ work with LaTeX's standard^^Jtwocolumn
+ option. It does *not* work with the
+ multicol package.^^JSo please specify
+ `twocolumn' in the
+ \noexpand\documentclass command.}%
+ \shipout\box\footins \fi\fi
+ \ifnum\insertpenalties>\z@
+ \@latexerr{ftnright package
+ scrambled footnotes}%
+ {There is too much footnote material in
+ the first column and ftnright^^Jis
+ unable to cope with this.^^JYou need
+ to reduce the amount to get a properly
+ formatted page.}%
+ \fi
+ \fi
+%%%%% change for pLaTeX (bottom float first)
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global \let \@midlist \@empty
+ \@combinefloats
+ \let\pltx@textbottom\@textbottom %%% pLaTeX
+ \if@firstcolumn\else
+ \ifvoid\footins\else
+ \setbox\@outputbox \vbox {%
+ \boxmaxdepth \@maxdepth
+ \unvbox \@outputbox
+ \@textbottom %%% pLaTeX
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup
+ }%
+ \let\@textbottom\relax %%% pLaTeX
+ \fi
+ \fi
+%%%%%
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox\vbox to\@colht
+ {\boxmaxdepth\maxdepth
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \iftdir\vbox{\hskip\z@}\fi %%% pLaTeX
+ \vskip -\dimen@
+ \@textbottom}%
+ \fi
+ \let\@textbottom\pltx@textbottom %%% pLaTeX
+ \global\maxdepth\@maxdepth
+}
+
+%% adjust \footnotesep for vertical typesetting
+\AtBeginDocument
+ {\global\footnotesep\ht\iftdir\tstrutbox\else\strutbox\fi}
+
+%% restore \@makefntext
+\let\@makefntext\pxftn@makefntext
+
+\endinput