%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% Page Styles --- these really belong in another file.
%%%
%%%	We define left, right, and center marks and ``tags''
%%%	for two-line headers and footers.  The tags in both 
%%%	headers and footers are placed on the line closest to 
%%%	the text.
%%%
%%%
%%%  Page styles: 
%%%	  broadside	songs on un-numbered single sheets
%%%	  songbook	numbered pages set up for two-sided printing
%%%	  boxed		plain boxed headers/footers: use markXY and tagXY
%%%	  ruled		plain ruled headers/footers: use markXY and tagXY
%%%	  shadowed	plain shadow-boxed headers/footers
%%%
%%%	  \tallpage	adds an extra inch to the text height
%%%	  \widepage	adds an extra inch to the text width
%%%
%%%  Page formatting elements:
%%%		additional conditional code can be put in the marks
%%%		and tags to swap them on odd and even pages.
%%%
%%%	\markUL{x}	mark upper left		defines \ULmark
%%%	\markUC{x}	mark upper center	etc.
%%%	\markUR{x}	mark upper right
%%%	\markLL{x}	mark lower left
%%%	\markLC{x}	mark lower center
%%%	\markLR{x}	mark lower right
%%%
%%%	\tagXY{x}	tag {upper,lower}{left, center,right}
%%%			  the tags are like the marks except that in the
%%%			  boxed styles they come underneath the boxes.
%%%
%%%		The following rules can be redefined for shadow effects.
%%%	\HFTrule	header/footer top box rule
%%%	\HFBrule	header/footer bottom box rule
%%%	\HFLrule	header/footer left rule
%%%	\HFRrule	header/footer right rule

%% Marks
\def\markUL#1{\global\def\ULmark{#1}}	\def\ULmark{}
\def\markUC#1{\global\def\UCmark{#1}}	\def\UCmark{}
\def\markUR#1{\global\def\URmark{#1}}	\def\URmark{}
\def\markLL#1{\global\def\LLmark{#1}}	\def\LLmark{}
\def\markLC#1{\global\def\LCmark{#1}}	\def\LCmark{}
\def\markLR#1{\global\def\LRmark{#1}}	\def\LRmark{}
%% Tags
\def\tagUL#1{\global\def\ULtag{#1}}	\def\ULtag{}
\def\tagUC#1{\global\def\UCtag{#1}}	\def\UCtag{}
\def\tagUR#1{\global\def\URtag{#1}}	\def\URtag{}
\def\tagLL#1{\global\def\LLtag{#1}}	\def\LLtag{}
\def\tagLC#1{\global\def\LCtag{#1}}	\def\LCtag{}
\def\tagLR#1{\global\def\LRtag{#1}}	\def\LRtag{}
%% boxes
\def\HFBox#1{\vbox{%		Ruled box
	\vskip 2pt\HFTrule\hbox to\textwidth{\HFLrule\hfil#1\hfil\HFRrule}\HFBrule}}
\def\HFFilling#1#2#3{%		3-part Box filling
	\normalsize\strut\ \makebox[0pt][l]{#1}%
	\hfill#2\hfill\makebox[0pt][r]{#3}\ }
%%
%% The macro that actually defines the headers and footers
%%
\def\DefineHFBoxes{%
\def\@oddhead{\vbox{%
 \HFBox{\HFFilling\ULmark\UCmark\URmark} \vskip 1pt
 \hbox to \textwidth{\HFFilling\ULtag\UCtag\URtag} }}%
\def\@evenhead{\vbox{%
 \HFBox{\HFFilling\URmark\UCmark\ULmark} \vskip 1pt
 \hbox to\textwidth{\HFFilling\URtag\UCtag\ULtag} }}%
\def\@oddfoot{\vbox{%
 \hbox to \textwidth{\HFFilling\LLtag\LCtag\LRtag} \vskip 1pt
 \HFBox{\HFFilling\LLmark\LCmark\LRmark} }}%
\def\@evenfoot{\vbox{%
 \hbox to \textwidth{\HFFilling\LRtag\LCtag\LLtag} \vskip 1pt
 \HFBox{\HFFilling\LRmark\LCmark\LLmark} }}%
}
%%
%% Rules
%%
\def\DefineBoxHFrules{%		Define rules for simple boxes
 \def\HFTrule{\hrule}\def\HFBrule{\hrule}
 \def\HFLrule{\vrule}\def\HFRrule{\vrule}
}
\def\DefineShadowHFrules{%	Define rules for shadow boxes
 \def\HFTrule{\hrule}\def\HFBrule{\hrule height 1pt}
 \def\HFLrule{\vrule}\def\HFRrule{\vrule width 1pt}
}
\def\DefineOpenHFrules{%	Define rules for simple rules
 \def\HFTrule{}\def\HFBrule{\hrule height .75pt}
 \def\HFLrule{}\def\HFRrule{}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Song-specific page styles
%%

%%
%% Marks and tags
%%
\def\DefineSongTags{%
\tagUL{\sl\theTags}\tagUR{{\chord{\theKey}}\makebox[.5in][r]{\sl\theTiming}}
\tagLL{{\sl\theCrDate}}\tagLR{{\tt\theFile}}
}
\def\DefineBroadsideMarks{%
\DefineSongTags\markUR{\sl\theSong}%
}
\def\DefineSongbookMarks{%
\DefineSongTags%
\markUL{\sc\leftmark}\markUC{\sl\rightmark}\markUR{\sl\thepage}%
}

%%
%% Page styles
%%
\def\ps@broadside{%
\DefineShadowHFrules\DefineHFBoxes\DefineBroadsideMarks%
\let\@evenhead=\@oddhead\let\@evenfoot=\@oddfoot% even and odd pages same.
\def\chaptermark##1{\markboth{##1}}\def\sectionmark##1{\markright{##1}}%
\def\subsectionmark##1{}}

\def\ps@songbook{%
\DefineSimpleHFrules\DefineHFBoxes\DefineSongbookMarks%
\def\chaptermark##1{\markboth{##1}{}}\def\sectionmark##1{\markright{##1}}%
\def\subsectionmark##1{}}


%%%
%%% Page Margins
%%%
\headheight 2.1\baselineskip
\headsep \baselineskip
%\footheight 2.1\baselineskip
\footskip \baselineskip
\topmargin 0in
\textheight 9in
%\advance\textheight -1\headheight\advance\textheight -1\headsep
%\advance\textheight -1\footheight\advance\textheight -1\footskip

\def\tallpage{
 \topmargin -.5in
 \textheight 9in
 %\advance\textheight -1\headheight\advance\textheight -1\headsep
 %\advance\textheight -1\footheight\advance\textheight -1\footskip
}
\def\widepage{
 \oddsidemargin 0in
 \evensidemargin 0in
 \textwidth 6.5in
}

\tallpage
\widepage
