foo.tex:
\documentclass{...}
...
\usepackage{thumbindex}
\pagestyle{thumbindex}
...
\begin{document}
...
\mainmatter
\chapter{...}
...
\end{document}
thumbindex.sty:
%% Simple page style with thumb indices
%% usage:
%% \usepackage{thumbindex}
%% \pagestyle{thumbindex}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{thumbindex}
\def\ps@thumbindex{ %
\let\@oddfoot\@empty
\let\@evenfoot\@empty
\def\@evenhead{ %
\if@mparswitch \hss \fi
\underline{\hbox to \fullwidth{\autoxspacing
\textbf{\thepage}\hfil\leftmark}}%
\if@mparswitch\else \hss \fi}%
\def\@oddhead{ %
\underline{ %
\hbox to \fullwidth{ %
\autoxspacing
{\if@twoside\rightmark\else\leftmark\fi}\hfil\textbf{\thepage}%
}%
}\hss
% draw thumb index
\if@mainmatter
\@drawthumbindex{\c@chapter}{10truemm}{0.25}{0}
\fi
% end draw thumb index
}%
\let\@mkboth\markboth
\def\chaptermark##1{\markboth{ %
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@chapapp\thechapter\@chappos\hskip1zw
\fi
\fi
##1}{}}%
\def\sectionmark##1{\markright{ %
\ifnum \c@secnumdepth >\z@ \thesection \hskip1zw\fi
##1}}}%
% draw thumb index
% usage: \@drawthumbindex{COUNTER}{VADVANCE}{HOFFSET}{VOFFSET}
% e.g. \@drawthumbindex{\c@chapter}{10truemm}{0.25}{0}
\newcommand{\@drawthumbindex}[4]{ %
\setlength\unitlength{#2}%
\begin{picture}(0,#4)%
\put(#3,-#1){ %
\makebox(0,0)[tl]{ %
\rule{10truemm}{1truemm}%
}%
}%
\put(#3,-#1){ %
\makebox(0,-.3)[tl]{ %
\hb@xt@ 8truemm{\hfil\the#1\hfil}%
}%
}%
\end{picture}%
}
(Remove space in “{ %” to restore correct code. There seems no way to escape Liquid markups yet: http://github.com/tobi/liquid/issues#issue/6.)
Other Articles
- 13 Oct 2017: 『テスト駆動開発』
- 19 Oct 2016: 『新装版 達人プログラマー 職人から名匠への道』
- 19 Aug 2016: 『プログラミングElixir』
- 20 Oct 2015: Migrating from git-media to git-lfs
- 04 Oct 2015: Git Large File Storageクライアントのインストール
- 12 Aug 2015: isbn.rb
- 22 Apr 2015: 「なるのか、なすのか?」(To Be Or To Do?)