X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=macros.tex;h=e4011aec6bc786cd38e1cc176a364915748814a1;hb=6659c33a805c0e22c969a45480c068d5d7ddf471;hp=21ef1783428fc538276b264a5284193bf9511592;hpb=98707af73507fdef0bb95fd411b486ad00e4a530;p=saga.git diff --git a/macros.tex b/macros.tex index 21ef178..e4011ae 100644 --- a/macros.tex +++ b/macros.tex @@ -16,6 +16,19 @@ \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 @@ -54,7 +67,7 @@ \def\E{{\bb E}} \def\crpt{\mathbin{\Uparrow}} \def\C{{\cal C}} -\def\Eul{{\cal E}} +\def\sgc{\mathbin{.}} \def\brk{\hfil\break} @@ -195,6 +208,7 @@ \def\endlist{\interlistskip\endgroup} \def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize +\def\icirc{\raise0.2ex\hbox{$\circ$}} % Signs frequently used for \itemize \def\idot{\raise0.2ex\hbox{$\cdot$}} \def\istar{\raise0.2ex\hbox{$\ast$}} @@ -323,31 +337,72 @@ \newcount\chapcount \newcount\seccount \newcount\thmcount +\newcount\tmpcount \chapcount=0 \seccount=0 \thmcount=0 \def\currentid{??} +\def\currentchap{??} + +\def\appendices{\chapcount=99} + +\def\oddpage{% +\iffinal + \ifodd\pageno + \else + \hglue 1in \vfill\supereject + \fi +\fi +} + +\def\rawchapter#1{\vfill\supereject +\oddpage +\leftline{\chapfont #1} +\bigskip +} + +\def\unchapter#1{ +\rawchapter{#1} +\writetoc{unchap}{#1} +} -\def\chapter#1{\vfill\supereject -\advance\chapcount by 1 +\def\chapter#1{\advance\chapcount by 1 \seccount=0 \thmcount=0 \footcnt=0 -\edef\currentid{\the\chapcount} -\leftline{\chapfont\currentid. #1} -\bigskip +% 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\vensure#1{\dimen0=#1 +\vskip 0pt plus \dimen0 +\penalty-1000 +\vskip 0pt plus -\dimen0 } \def\section#1{\bigskip +\vensure{0.5in} \advance\seccount by 1 \thmcount=0 -\edef\currentid{\the\chapcount.\the\seccount} +\edef\currentid{\currentchap.\the\seccount} \leftline{\secfont\currentid. #1} +\nobreak \medskip +\nobreak +\writetoc{sec}{#1} } \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}} @@ -365,7 +420,8 @@ \def\example{\proclaim{Example}} \def\label#1{{\sl (#1)\/}\enspace} -\def\labelx#1{\label{#1}\hfil\break\kern 0pt} % Eat spaces +\def\labelx#1{\label{#1}\hfil\break\eatspaces} +\def\eatspaces{\kern0pt} \def\thmn{\thm\labelx} \def\lemman{\lemma\labelx} @@ -377,11 +433,40 @@ \def\problemn{\problem\labelx} \def\remn{\rem\labelx} -\def\paran#1{\para {\sl #1:\/}\enspace} +\def\paran#1{\para {\sl #1.\/}\enspace\eatspaces} \def\proof{\noindent {\sl Proof.}\enspace} \def\proofsketch{\noindent {\sl Proof sketch.}\enspace} +%%% Table of contents %%% + +\newwrite\toc +\immediate\openout\toc=\jobname.toc +\newif\iftoc +\tocfalse + +\def\writetoc#1#2{ + \toctrue + \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\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 %%% \newwrite\ids @@ -448,6 +533,22 @@ \hyphenation{Ra-ma-chan-dran} +%%% Output routine %%% + +\output{\sagaoutput} + +\def\sagaoutput{\ifodd\pageno \hoffset=\hwobble \else \hoffset=0pt \fi +\plainoutput} + +\def\makefootline{\baselineskip30pt\lineskiplimit 0pt\line{\the\footline}} + +\footline={\ifodd\pageno + {\hfil\twelvemi\the\pageno}% +\else + {\twelvemi\the\pageno\hfil}% +\fi +} + %%% The End %%% \catcode`@=12