User Tools

Site Tools


paper:latex:pagestyle

This is an old revision of the document!


ページスタイル

博士論文の見栄えを整えるために行ったこと
(このやり方だと図の配置などが変わった際にやり直す必要が出てくるので最後に行ったほうがよい)

要求は以下の通り

  • Chapter は常に右の(奇数)ページから始まる
  • タイトル,および空白ページにはページ番号をいれない
  • 本文が書いてあるページにおいては偶数ページに section を,奇数ページに chapter を示したい
  • 本文以外のページ(目次,表目次など)においてはページ番号のみ表示したい
\documentclass[a4, 11pt]{book} % オプションに openany を入れると chapter が始まるページの偶奇を気にしなくなる
 
\usepackage{fancyhdr}
 
% Chapter が勝手に改ページしないようにする (修論をそのまま使ったのでこのあたり無駄があるかもしれない)
\makeatletter
\renewcommand{\chapter}{%
  \if@openright\cleardoublepage\else\clearpage\fi
  \global\@topnum\z@
  \secdef\@chapter\@schapter}
\makeatother
 
% 略称目次,詳細は省略
\usepackage{nomencl}
\newcommand\Nomenclature[2]{\nomenclature{\textbf{#1}}{#2}}
\renewcommand{\nomname}{List of Abbreviations}
\makenomenclature
 
\begin{document}
 
\begin{titlepage}
% タイトル,著者名など適当に書けば良い
% titlepage 環境で作った表紙にページ番号はつかない
\end{titlepage}
 
% 2 ページ目を白紙にする
\thispagestyle{empty} % ページスタイルなし, ページ番号は表示されない
\mbox{}\newpage % 次のページへ
 
\pagestyle{plain} % ページスタイルあり,ページ番号を下の真ん中に表示
\pagenumbering{roman} % front matter はローマ数字
 
\input{./abstract.tex}
 
\tableofcontents
 
\mainmatter
 
\clearpage % 多分なくても大丈夫
 
% 本文のスタイルを定義
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{Chapter\ \thechapter\ ~#1}{}} % 左側に表示
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}{}} % 右側に表示
\fancyhf{}
\fancyhead[LE]{\rightmark}
\fancyhead[RO]{\leftmark}
\fancyfoot[CE, CO]{\thepage} % C: 中央, R: 右, L: 左, E: 偶数ページ, O: 奇数ページ
 
\input{./1_introduction.tex}
 
\input{./2_summary.tex}
 
\pagestyle{plain}
 
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\newpage % 目次ごとにこの三行を入れる
\thispagestyle{empty}
\pagestyle{plain}
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}
\newpage
\thispagestyle{empty}
\pagestyle{plain}
\input{./list_abbre.tex}
\newpage
\thispagestyle{empty}
\pagestyle{plain}
\bibliography{mybib}
\addcontentsline{toc}{chapter}{Bibliography}
 
 
\end{document}
abstract.tex
\begin{center}
Abstract
\end{center}
 
% アブストラクト本文
 
\clearpage % 次のページを作成
\thispagestyle{empty} % そのページを白紙に
1_introduction.tex
\chapter{Introduction\label{chap:intro}}
 
% 本文
 
\clearpage % 次のページを作成 (\newpage だとうまくいかない,なぜなら \newpage は図表を出力しない)
\thispagestyle{empty} % そのページを白紙に
paper/latex/pagestyle.1671433017.txt.gz · Last modified: 2022/12/19 06:56 by odagawa