]> mj.ucw.cz Git - saga.git/blobdiff - macros.tex
Odd-even wobbling.
[saga.git] / macros.tex
index 5877abacfe422071815ee42efd7d0583e583438c..38b2f65445b87293af4529fb9d81637ff56320ad 100644 (file)
 \parindent=0.8cm
 \parskip=3pt plus 1pt minus 1pt
 
+% Parameters for final typesetting (bigger inner margins etc.)
+\newif\iffinal
+\finaltrue
+\newdimen\hwobble
+\advance\hsize by -10mm
+
+\iffinal
+\hwobble=10mm
+\else
+\hwobble=0mm
+\fi
+
+% Glue
 \smallskipamount=4pt plus 1.2pt minus 1.2pt
 \medskipamount=7pt plus 2.5pt minus 2pt
 \bigskipamount=15pt plus 5pt minus 4pt
 \newcount\chapcount
 \newcount\seccount
 \newcount\thmcount
-\chapcount=-1
+\newcount\tmpcount
+\chapcount=0
 \seccount=0
 \thmcount=0
 \def\currentid{??}
+\def\currentchap{??}
+
+\def\appendices{\chapcount=99}
 
 \def\rawchapter#1{\vfill\supereject
+\iffinal
+  \ifodd\pageno
+  \else
+    \hglue 1in \vfill\supereject
+  \fi
+\fi
 \leftline{\chapfont #1}
 \bigskip
 }
 
+\def\unchapter#1{
+\rawchapter{#1}
+\writetoc{unchap}{#1}
+}
+
 \def\chapter#1{\advance\chapcount by 1
 \seccount=0
 \thmcount=0
 \footcnt=0
-\edef\currentid{\the\chapcount}
+% Chapter name
+  \ifnum\chapcount>99
+    \tmpcount=\chapcount
+    \advance\tmpcount by -100
+    \edef\currentchap{\ifcase\tmpcount A\or B\or C\or D\or E\or ZZZ\fi}
+  \else
+    \edef\currentchap{\the\chapcount}
+  \fi
+\edef\currentid{\currentchap}
 \rawchapter{\currentid. #1}
 \writetoc{chap}{#1}
 }
 \def\section#1{\bigskip
 \advance\seccount by 1
 \thmcount=0
-\edef\currentid{\the\chapcount.\the\seccount}
+\edef\currentid{\currentchap.\the\seccount}
 \leftline{\secfont\currentid. #1}
 \nobreak
 \medskip
 }
 
 \def\para{\advance\thmcount by 1
-\edef\currentid{\the\chapcount.\the\seccount.\the\thmcount}
+\edef\currentid{\currentchap.\the\seccount.\the\thmcount}
 \noindent {\bo \currentid.\enspace}}
 
 \def\proclaim#1{\para {\bo #1.\enspace}}
 \def\problemn{\problem\labelx}
 \def\remn{\rem\labelx}
 
-\def\paran#1{\para {\sl #1.\/}\enspace}
+\def\paran#1{\para {\sl #1.\/}\enspace\kern 0pt}
 
 \def\proof{\noindent {\sl Proof.}\enspace}
 \def\proofsketch{\noindent {\sl Proof sketch.}\enspace}
 
 \def\writetoc#1#2{
   \toctrue
-  \toks0={\the\count0}
+  \toks0={\the\pageno}
   \edef\tocaux{\write\toc{\noexpand\expandafter\noexpand\string\noexpand\csname toc#1\noexpand\endcsname{\currentid}{#2}{\the\toks0}}}
   \tocaux
   \tocfalse
 }
 
+\newwrite\tok
 \def\includetoc{
-\immediate\closeout\toc
-\input \jobname.toc
+\immediate\openin\tok=\jobname.tok
+\ifeof\tok
+\else
+\input \jobname.tok
+\fi
+\immediate\closein\tok
 }
 
 \def\tocchap#1#2#3{\smallskip\line{\bo #1.~~#2 \dotfill ~#3}}
 \def\tocsec#1#2#3{\line{#1.~~#2 \dotfill ~#3}}
+\def\tocunchap#1#2#3{\smallskip\line{\bo #2 \dotfill ~#3}}
 
 %%% References %%%
 
 
 \hyphenation{Ra-ma-chan-dran}
 
+%%% Output routine %%%
+
+\output{\sagaoutput}
+
+\def\sagaoutput{\ifodd\pageno \hoffset=\hwobble \else \hoffset=0pt \fi
+\plainoutput}
+
+%\def\makeheadline{\vbox to\z@{\vskip-22.5\p@
+%  \line{\vbox to8.5\p@{}\the\headline}\vss}\nointerlineskip}
+%\def\makefootline{\baselineskip24\p@\lineskiplimit\z@\line{\the\footline}}
+
 %%% The End %%%
 
 \catcode`@=12