]> mj.ucw.cz Git - saga.git/commitdiff
The first pieces.
authorMartin Mares <mj@ucw.cz>
Mon, 14 Jan 2008 18:11:00 +0000 (19:11 +0100)
committerMartin Mares <mj@ucw.cz>
Mon, 14 Jan 2008 18:11:00 +0000 (19:11 +0100)
Makefile [new file with mode: 0644]
cover.tex [new file with mode: 0644]
macros.tex [new file with mode: 0644]
saga.tex [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..14143de
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+all: saga.ps
+
+CHAPTERS=cover
+
+saga.dvi: saga.tex $(addsuffix .tex,$(CHAPTERS)) macros.tex
+       csplain $<
+
+%.dvi: %.tex macros.tex
+       csplain $<
+
+%.ps: %.dvi
+       dvips -D600 -o $@ -t a4 $<
+
+%.pdf: %.dvi
+       dvipdfm -o $@ -p a4 -r 600 -z 9 $<
+
+mostlyclean:
+       rm -f *.dvi *.log *~ core *.o *.aux *.bbl *.blg
+
+clean:: mostlyclean
+       rm -f *.ps *.pdf
+
+.SECONDARY:
diff --git a/cover.tex b/cover.tex
new file mode 100644 (file)
index 0000000..d7f41e5
--- /dev/null
+++ b/cover.tex
@@ -0,0 +1,44 @@
+\ifx\endpart\undefined
+\input macros.tex
+\fi
+
+{\narrower\font\sc=cmcsc10
+\noindent {\sc Abstract.} Preparation of alchemical potions is an ancient craft
+and its deep secrets are carefully guarded by the masters of alchemist guilds.
+It usually takes several years for a novice alchemist to learn to prepare at
+least the most basic potions properly. In this scroll we will present a novel
+way of extracting the magical substance of various ingredients based on
+a mighty catalyst, metasulphur~[3]. This substantially simplifies the traditional recipes
+and also avoids some of their frequent side-effects. The only drawback is the
+rarity of metasulphur.
+
+}
+
+\bigskip
+
+{\bf\noindent Introduction\smallskip}
+
+We will demonstrate our approach on several examples of potions which are
+usually considered very volatile and dangerous to prepare~[1].
+
+There are two basic kinds of ingredients in our recipes (except for the metasulphur,
+which fits neither category, as expected): herbs and parts of bodies of living
+creatures. According to the well known rule of herbal immanence, the magical
+essence of herbs can be released only in boiling water, while the other
+ingredients can be used at any temperature.
+
+We follow the tradition by calling all herbal ingredients by their Latin names.
+While this can be hard to handle for laymen and novice alchemists, we consider
+it of utmost necessity in order to avoid confusion which often leads to fatal
+consequences.
+
+In the following, we assume that the recipe is prepared on the northern
+hemisphere. Otherwise, you need to replace all clockwise stirs by
+counter-clockwise ones and vice versa, and also optionally use opposum instead of
+hares.
+
+$$
+\sum_i=1^\infty {1\over i^2} = {\pi^2\over 6}.
+$$
+
+\endpart
diff --git a/macros.tex b/macros.tex
new file mode 100644 (file)
index 0000000..de53a87
--- /dev/null
@@ -0,0 +1,304 @@
+% TeX macros for typesetting my PhD thesis
+% (c) 2008 Martin Mares <mj@ucw.cz>
+
+\input epsf.tex
+
+\catcode`@=11
+
+%%% Basic parameters %%%
+
+% A4 with 1in margins, leaving 20pt for page numbering at the bottom
+\hsize=159mm
+\vsize=246mm
+\advance\vsize by -20pt
+\parindent=0.8cm
+\parskip=3pt plus 1pt minus 1pt
+
+%%% Miscellanea %%%
+
+\def\em#1{{\it #1\/}}
+\def\O{{\cal O}}
+\def\<#1>{\leavevmode\hbox{\it #1\/}}
+\let\>=\noindent
+\def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\heartsuit$\par}}
+\let\endpart=\bye
+
+% Footnotes
+\newcount\footcnt
+\footcnt=0
+\def\foot#1{\global\advance\footcnt by 1{\parindent=0.25in\parskip=0pt\footnote{$^{\left<\the\footcnt\right>}$}{#1}}}
+
+%%% Fonts %%%
+
+\font\twelverm=cmr12
+\font\twelveit=cmti12
+\font\twelvesl=cmsl12
+\font\twelvebf=cmbx12
+\font\twelveb=csb12
+\font\twelvesc=cscsc12
+
+\def\mathf@nt#1#2#3#4{%
+\toks0=\expandafter{\csname#1#2\endcsname}%
+\expandafter\ifx\the\toks0\relax%
+%\immediate\write-1{bb \the\toks0=#4#2#3}%
+\global\expandafter\font\the\toks0=#4#2#3%
+\fi%
+\edef\m@@f{\the\toks0}}
+
+\def\fntmathsize{12}
+\def\fntmathtok{twelve}
+\def\fntmathssize{8}
+\def\fntmathstok{eight}
+\def\fntmathsssize{6}
+\def\fntmathsstok{six}
+
+\mathf@nt{\fntmathtok}{r}{\fntmathsize}{cs}\textfont0=\m@@f
+\mathf@nt{\fntmathstok}{r}{\fntmathssize}{cs}\scriptfont0=\m@@f
+\mathf@nt{\fntmathsstok}{r}{\fntmathsssize}{cs}\scriptscriptfont0=\m@@f
+\mathf@nt{\fntmathtok}{mi}{\fntmathsize}{cm}\skewchar\m@@f='177\textfont1=\m@@f
+\mathf@nt{\fntmathstok}{mi}{\fntmathssize}{cm}\skewchar\m@@f='177\scriptfont1=\m@@f
+\mathf@nt{\fntmathsstok}{mi}{\fntmathsssize}{cm}\skewchar\m@@f='177\scriptscriptfont1=\m@@f
+\mathf@nt{\fntmathtok}{sy}{\fntmathsize}{cm}\skewchar\m@@f='60\textfont2=\m@@f
+\mathf@nt{\fntmathstok}{sy}{\fntmathssize}{cm}\skewchar\m@@f='60\scriptfont2=\m@@f
+\mathf@nt{\fntmathsstok}{sy}{\fntmathsssize}{cm}\skewchar\m@@f='60\scriptscriptfont2=\m@@f
+\mathf@nt{\fntmathtok}{ex}{\fntmathsize}{cm}\textfont3=\m@@f\scriptfont3=\m@@f\scriptscriptfont3=\m@@f
+\mathf@nt{\fntmathtok}{ti}{\fntmathsize}{cs}\textfont\itfam=\m@@f
+\mathf@nt{\fntmathtok}{sl}{\fntmathsize}{cs}\textfont\slfam=\m@@f
+\mathf@nt{\fntmathtok}{bx}{\fntmathsize}{cs}\textfont\bffam=\m@@f
+\mathf@nt{\fntmathtok}{tt}{\fntmathsize}{cs}\hyphenchar\m@@f=-1\textfont\ttfam=\m@@f
+
+% Blackboard bold font
+\newfam\bbfam
+\font\bbtwelve=bbm12
+\font\bbeight=bbm8
+\font\bbsix=bbm6
+\textfont\bbfam=\bbtwelve
+\scriptfont\bbfam=\bbeight
+\scriptscriptfont\bbfam=\bbsix
+\def\bb{\bbtwelve\fam\bbfam}
+
+% Font switches
+\def\rm{\fam\z@\twelverm}
+\def\it{\fam\itfam\twelveit}
+\def\bo{\fam\bffam\twelveb}
+\def\bf{\fam\bffam\twelvebf}
+\def\tt{\fam\ttfam\twelvett\hyphenchar\currentfont=-1\relax}
+\def\sc{\twelvesc}
+\def\sl{\fam\slfam\twelvesl}
+
+% Switch to 12pt baselines
+\rm
+\baselineskip=14.4pt
+\lineskip=1.2pt
+\setbox\strutbox=\hbox{\vrule height 10.2pt depth 4.2pt width 0pt}
+
+% Other fonts
+\font\chapfont=csssdc17 scaled \magstep1
+\font\secfont=csb14
+
+%%% FIXME
+\footline={\hss\twelverm\folio\hss}
+
+%%% Vycty s odrazkami i cislovane %%%
+
+\newif\ifitem\itemtrue
+\newbox\itembox
+\newcount\itemcount
+
+\def\interlistskip{\vskip 3pt plus 2pt minus 1pt}
+
+\def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
+\advance\leftskip by 2.5em\fi\rightskip=\leftskip}
+
+\def\inititemize{\interlistskip\begingroup
+\parskip=1pt plus 0.3pt minus 0.1pt
+\itemspacingrules}
+
+\def\itemize#1{\inititemize\setbox\itembox\llap{#1\hskip 0.4em}%
+\let\:=\singleitem}
+
+\def\singleitem{\par\leavevmode\copy\itembox}
+
+\def\endlist{\interlistskip\endgroup}
+
+\def\ibull{\raise0.2ex\hbox{$\bullet$}} % Signs frequently used for \itemize
+\def\idot{\raise0.2ex\hbox{$\cdot$}}
+\def\istar{\raise0.2ex\hbox{$\ast$}}
+
+\def\numlist#1{\inititemize\itemcount=0\let\:=\numbereditem
+\let\itemnumbering=#1}
+
+\def\numbereditem{\par\leavevmode\advance\itemcount by 1
+\llap{\itemnumbering\hskip 0.4em}}
+
+\def\nnorm{\the\itemcount}
+\def\ndotted{\nnorm.}
+\def\nparen{\nnorm)}
+\def\nroman{\romannumeral\itemcount}
+\def\nromanp{\nroman)}
+\def\nalpha{\count@=96\advance\count@ by\itemcount\char\count@)}
+\def\nAlpha{\count@=64\advance\count@ by\itemcount\char\count@)}
+\def\ngreek{$\ifcase\itemcount\or\alpha\or\beta\or\gamma\or\delta\or\epsilon\or
+\zeta\or\eta\or\theta\or\iota\or\kappa\or\lambda\or\mu\or\nu\or\xi\or\pi\or\rho
+\or\sigma\or\tau\or\upsilon\or\phi\or\chi\or\psi\or\omega\fi$)}
+
+% New \frenchspacing, which doesn't leave unwanted spaces in text.
+\def\frenchsp@cing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m%
+\sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m}
+
+%%% Verbatim mod na jednotliva slova %%%
+
+\def\make@ther#1{\catcode`#1=12\relax}
+\def\setverb@tim{\tt\frenchsp@cing\catcode`\`=13\catcode`\'=13\n@ligs%
+\let\do=\make@ther\dospecials\obeyspaces}
+
+{\catcode`'=13
+\catcode``=13
+\gdef\n@ligs{\def`{\relax\lq}\def'{\relax\rq}}}
+
+{\obeyspaces
+\global\chardef\sp@ce=32
+\gdef\showspaces{\let =\sp@ce}
+\global\let =\ }
+
+\catcode124=\active % Make | active
+\def\ttst@rt{\begingroup\setverb@tim\let|=\endgroup}
+\let|=\ttst@rt
+
+%%% Verbatim mod na delsi text uzavreny v { } %%%
+
+\newskip\verbglue\newskip\verblineglue
+\verbglue=3pt plus 1pt minus 0.3pt
+\verblineglue=0pt plus 1.5pt
+\def\verblocaldefs{}
+
+\newdimen\tabwidth
+\newcount\tabsize
+\tabsize=8
+\newdimen\t@b
+
+\newcount\vercnt
+\def\v@rbend{\par\endgroup\vskip\verbglue}
+\def\v@rbl{\ifnum\vercnt>0\{\fi\global\advance\vercnt by 1\relax}
+\def\v@rbr{\ifnum\vercnt>1\}\else\v@rbend\fi\global\advance\vercnt by -1\relax}
+\def\v@rbparams{\setverb@tim\parskip=\verblineglue\parindent=0pt\raggedbottom%
+\rightskip\z@ plus1fil\pretolerance=10000\tolerance=10000\vercnt=0%
+\catcode124=12\setupt@bs\vskip\verbglue\defb@x\obeylines}
+
+\def\startb@x{\setbox0=\hbox\bgroup}
+\def\defb@x{\def\par{\leavevmode\egroup\box0\endgraf}%
+\everypar{\startb@x}}
+
+{\catcode`\^^I=\active
+\gdef\setupt@bs{\catcode`\^^I=\active
+\setbox0=\hbox{\tt\ }\tabwidth=\wd0\multiply\tabwidth by \tabsize
+\def^^I{\leavevmode\egroup\t@b=\wd0\divide\t@b by \tabwidth%
+\multiply\t@b by \tabwidth%
+\advance\t@b by \tabwidth\advance\t@b by -\wd0\box0\hbox to \t@b{}\startb@x}
+}}
+
+{
+\catcode`[=1\catcode`]=2\catcode123=\active\catcode125=\active
+\gdef\verbatim[\begingroup\v@rbparams\catcode123=\active\catcode125=\active%
+\let{=\v@rbl\let}=\v@rbr\chardef\{=123\chardef\}=125\verblocaldefs
+]]
+
+\def\verbinput#1{\begingroup\v@rbparams\input #1\endgroup}
+
+%%% Sazba algoritmu %%%
+
+%      \algo{jmeno algoritmu}
+%      \algin popis vstupu
+%      \:krok
+%      \:krok
+%      \::vnoreny krok
+%      \algout popis vystupu
+%      \endalgo
+
+\def\algo#1{
+\interlistskip
+\begingroup
+\let\:=\algoitem
+\parskip=1pt plus 1pt minus 0.3pt
+\rightskip=2em
+\itemcount=0
+{\bo Algoritmus\/} {\sc #1}
+}
+\def\endalgo{\interlistskip\endgroup}
+\def\algopar{\par
+\parindent=2em
+\hangindent=4em
+\hangafter=1
+\leavevmode
+}
+\def\algoitem{
+\ifnum\itemcount=0\smallskip\fi
+\algopar\advance\itemcount by 1
+\hbox to 2em{\hss \the\itemcount. }%
+\futurelet\next\algoitemh}
+\def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
+\def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
+\def\algin{\par{\it Vstup:\/} }
+\def\algout{\par{\it VĂ˝stup:\/} }
+
+%%% Konstrukce pouzivane v algoritmech %%%
+
+% Priraditko
+\def\={\leftarrow}
+
+% Komentar
+\def\cmt#1{~~{\sl (#1)}}
+
+%%% Kapitoly %%%
+
+\newcount\chapcount
+\newcount\seccount
+\chapcount=0
+\seccount=0
+
+\def\chapter#1{\vfill\eject
+\advance\chapcount by 1
+\seccount=0
+\leftline{\chapfont\the\chapcount. #1}
+\bigskip
+}
+
+\def\section#1{\bigskip
+\advance\seccount by 1
+\leftline{\secfont\the\chapcount.\the\seccount. #1}
+\medskip
+}
+
+%%% Odkazy na kapitoly a jine objekty %%%
+
+% Poridime si soubor, do ktereho budeme zapisovat identifikatory
+\newwrite\ids
+\def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
+
+\immediate\openin\ids=ids.aux
+\ifeof\ids
+\else
+\input ids.aux
+\fi
+\immediate\closein\ids
+\immediate\openout\ids=ids.aux
+
+\def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
+{\bo ??}%
+\immediate\write16{*** Warning: Reference #1 undefined ***}%
+\else
+\csname id#1\endcsname
+\fi
+}
+
+% Pojmenovavani objektu
+\def\chapid#1{\marginalie{#1}\writeid{ch#1}{\the\chapcount}}
+\def\secid#1{\marginalie{#1}\writeid{sec#1}{\the\chapcount.\the\seccount}}
+
+% Odkazovani na objekty
+\def\chapref#1{\ref{ch#1}}
+\def\secref#1{\ref{sec#1}}
+
+%%% The End %%%
+
+\catcode`@=12
diff --git a/saga.tex b/saga.tex
new file mode 100644 (file)
index 0000000..ecfbba2
--- /dev/null
+++ b/saga.tex
@@ -0,0 +1,6 @@
+\input macros.tex
+\let\endpart=\relax
+
+\input cover.tex
+
+\bye