From 70b38d955e744b7f118d279d4bc20434707872e3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 16 Jan 2010 00:26:42 +0000 Subject: new latex package thumby 0.1 (15jan10) git-svn-id: svn://tug.org/texlive/trunk@16736 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/thumby/thumby.sty | 320 ++++++++++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/thumby/thumby.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/thumby/thumby.sty b/Master/texmf-dist/tex/latex/thumby/thumby.sty new file mode 100644 index 00000000000..418bc9eccb7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/thumby/thumby.sty @@ -0,0 +1,320 @@ +%% Thumby - LaTeX package for creating thumb indexes. +% +% Version: 0.1 +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Requirements: +% +% - memoir document class +% +% - Packages: +% +% - PerlTeX +% - tikz +% - bophook +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Instructions: +% +% Put something like the following in your document (we'll call it "foo.tex"): +% +% \documentclass[twoside]{memoir} +% +% \usepackage{thumby} +% +% \thumbySides{two} +% \thumbyTotalChapters{10} +% \thumbyPageHeight{792} +% \thumbyThumbWidth{42.5} +% \thumbyForeground{white} +% \thumbyBackground{black} +% \thumbyNumberFormat{\Huge\textbf{$chapter_number}} +% +% \thumbySetup +% +% Then, run twice: +% +% perltex --latex=pdflatex foo.tex +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Please change the above to reflect your document and preferences. +% In particular, you should change the \thumbyTotalChapters from 10 to the number +% of chapters in your document, and the \thumbyPageHeight from 792 to the height +% of your document (in points), and \thumbySides to reflect whether your document +% uses one- or two-sided pages. +% +% Note: Units for page height, width, etc, are in points. +% +% Note: Only normal, numbered chapters will have a thumb index. +% For example, the of contents and \frontmatter chapters will not have a thumb index. +% +% Note: When \thumbyNumberFormat contains the literal $chapter_number +% Thumby will substitute the actual chapter number for this literal. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Thumby - LaTeX package for creating thumb indexes. +% +% Copyright (C) 2010 Sergey Goldgaber +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of version 3 of the GNU General Public License +% as published by the Free Software Foundation. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see . +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{thumby}[2010/01/14 v0.1 Thumby] + +\typeout{} +\typeout{***********************************************} +\typeout{*********** Loading Thumby Package ************} +\typeout{***********************************************} +\typeout{} + +% We use the tikz library to draw and position the thumb indexes. +\RequirePackage{tikz} + +% We use the perltex package to run perl within LaTeX. +% This is used to do the calculations of the dimensions +% of the thumb boxes and their locations, which are fed +% to tikz. +\RequirePackage{perltex} + +%% We use the bophook package to place a thumb box on each page. +\RequirePackage{bophook} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Configuration commands. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\perlnewcommand{\thumbyNumberFormat}[1]{ + $thumby_number_format = $_[0] ; + # Slashes have to be doubled, as otherwise perl will interpret them as indicating + # that a special character follows. + $thumby_number_format =~ s{/}{//} ; + return "\\typeout{Thumby number format: $thumby_number_format}" ; +} + +% Place a thumb index on each page. +\perlnewcommand{\thumbySides}[1]{ + $thumby_sides = $_[0] ; + + if ( $thumby_sides eq "one" ) { + $output = <