Last active
July 5, 2019 05:36
-
-
Save hidaruma/fe44e759f93ac276435814d2b99410a9 to your computer and use it in GitHub Desktop.
Sphinx LaTeX modify stylefile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% sphinx-jsbook-mod.sty | |
% | |
% by hidaruma <hidaruma@outlook.jp> | |
% | |
% Please load after sphinx.sty. Cause this sty using some macros in sphinx.sty | |
\NeedsTeXFormat{LaTeX2e}[1995/12/01] | |
\ProvidesPackage{sphinx-jsbook-mod}[2019/07/05 v0.0.1 LaTeX package (Sphinx markup)] | |
% In 2019, jsbook has defined \plainifnotempty. | |
% This command is used in \chapter command, | |
% and it overwrites chapter page from sphinx manual pagestyle. | |
% Following codes overwrite \plainifnotempty. | |
\@ifpackageloaded{fancyhdr}{% | |
\ltx@ifundefined{c@chapter}{% | |
}{% | |
\fancypagestyle{chapterfoot}{% | |
\fancyhf{}% | |
\fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}% | |
\fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}% | |
\fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}% | |
\renewcommand\headrulewidth{0pt}% | |
} | |
} | |
}% | |
\ifdefined\plainifnotempty % | |
\@ifpackageloaded{fancyhdr}{% | |
\renewcommand{\plainifnotempty}{% | |
\ltx@ifundefined{c@chapter}{% | |
}{% | |
\ifx \@oddhead \@empty% | |
\ifx \@oddfoot \@empty% | |
\else% | |
\thispagestyle{chapterfoot}% | |
\fi% | |
\else% | |
\thispagestyle{chapterfoot}% | |
\fi}% | |
}% | |
}% | |
\fi% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
スタイルファイル名はjsbookでしか検証していないため暫定。多分日本語(jsclasses)環境でしか起きないしPR出すかは判断がつかない。
Sphinxでjsbookをロードしたクラスファイルを使ったとき、章題ページのページ番号位置が微妙だったので他のページによせる処理をします。
コピーして、conf.pyの
latex_additional_files
でビルド時コピーできる場所に置いて設定し、としましょう。