summaryrefslogtreecommitdiff
path: root/support/txt/txt.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/txt/txt.sty
Initial commit
Diffstat (limited to 'support/txt/txt.sty')
-rw-r--r--support/txt/txt.sty165
1 files changed, 165 insertions, 0 deletions
diff --git a/support/txt/txt.sty b/support/txt/txt.sty
new file mode 100644
index 0000000000..a640808cec
--- /dev/null
+++ b/support/txt/txt.sty
@@ -0,0 +1,165 @@
+% dvidoc style file. Fixes things up so your file uses only fixed width
+% non-math characters, at least if you don't use math mode
+%
+% The first section defines all the font change commands to use the
+% doc pseudo-font. It is taken from John Pavel's dvidoc.sty, March 1987
+%
+\makeatletter
+% version from John Pavel's dvidoc.sty, March 1987
+\def\rm{\protect\pdoc}
+\def\it{\protect\pdoc}
+\def\bf{\protect\pdoc}
+\def\sl{\protect\pdoc}
+\def\sf{\protect\pdoc}
+\def\sc{\protect\pdoc}
+\def\tt{\protect\pdoc}
+\newfam\docfam
+\def\pdoc{\@getfont\pdoc\docfam\@xpt{doc}}
+% This gets all normal text, headings, etc.
+% Unfortunately it doesn't catch places where more explicit stuff
+% is done. The following is brute force but effective. Note that
+% we leave the symbol fonts alone, since otherwise we'll get TeX
+% errors complaining that it couldn't find symbol fonts
+% Possibly we should do this for all of the font types. This caught
+% everything in sample.tex.
+\font\fivmi = doc
+\font\fivrm = doc
+\font\fivsy = cmsy10
+\font\sixmi = doc
+\font\sixrm = doc
+\font\sixsy = cmsy10
+\font\sevmi = doc
+\font\sevrm = doc
+\font\sevsy = cmsy10
+\font\egtmi = doc
+\font\egtrm = doc
+\font\egtsy = cmsy10
+\font\ninmi = doc
+\font\ninrm = doc
+\font\ninsy = cmsy10
+\font\tenmi = doc
+\font\tenrm = doc
+\font\elvmi = doc
+\font\elvrm = doc
+\font\elvsy = cmsy10
+\font\twlmi = doc
+\font\twlsy = cmsy10
+\font\frtnmi = doc
+\font\frtnrm = doc
+\font\frtnsy = cmsy10
+\font\svtnmi = doc
+\font\svtnrm = doc
+\font\svtnsy = cmsy10
+\font\twtymi = doc
+\font\twtyrm = doc
+\font\twtysy = cmsy10
+\rm
+%
+% These dimensional definitions are also taken from Langdon, though with
+% some changes, e.g. not ragged right/bottom and parind 3 instead of 5.
+% horizontal dimensions had best be multiples of \em
+\hsize 78 em % 78 characters per line so fit any screen
+% \rightskip=0pt plus 4em % ragged right
+% \spaceskip=1em % forces ONE space between words
+% \frenchspacing suppresses extra blanks after punctuation -don't
+% \parindent=3em
+\def\enspace{\kern 1em} \def\enskip{\hskip 1em\relax}
+%
+% vertical skips may best be multiples of \baselineskip
+\baselineskip=12pt % 6 lines per inch
+% \vsize % default give 58 lines -OK
+\voffset=\baselineskip % so don't lose \headline
+% \parskip=0pt
+\smallskipamount=0pt
+\medskipamount= \baselineskip
+\bigskipamount=2\baselineskip
+% \raggedbottom
+%
+% By default itemize is done with bullets, which we don't have. use hyphen
+% now fix up various latexish stuff
+%
+% \def\labelitemi{ -}
+% \def\labelitemii{ -}
+% \def\labelitemiii{ -}
+% \def\labelitemiv{ -}
+%
+% Fix up table of contents. Default latex uses fractional spacing between
+% the section number and title. This comes out as no space in the doc file
+% so we add a space to numberline, and expand tempdima by one em to allow
+% for it. Also, go out of math mode for the dot in the leader. Dots in
+% math mode turn out to be colons!
+%
+\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
+ \vskip \z@ plus .2pt
+ {\hangindent #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \addtolength\@tempdima{1em}
+ #4\nobreak\leaders\hbox to 2em{\hss.\hss}\hfill \nobreak \hbox to\@pnumwidth{\hfil\rm #5}\par}\fi}
+\def\numberline#1{\advance\hangindent\@tempdima \hbox to\@tempdima{#1\hfil}\ }
+%
+% Can't really do superscripts, so do footnotes with []
+%
+\def\@makefnmark{\hbox{(\@thefnmark)}}
+\long\def\@makefntext#1{\parindent 1em\noindent
+ \hbox to 3em{\hss\@thefnmark.}\ #1}
+\skip\footins 24pt plus 4pt minus 2pt
+\def\footnoterule{\kern-12\p@
+\hbox to .4\columnwidth{\leaders\hbox{-}\hfill}}
+%
+% \arrayrulewidth 1em \doublerulesep 1em
+%
+% Some fairly obvious hacks. No odd/even pages in doc files. Can't do the
+% fancy TeX symbols.
+%
+\oddsidemargin 0pt \evensidemargin 0pt
+\def\TeX{TeX}
+\def\LaTeX{LaTeX}
+\def\SliTeX{SliTeX}
+\def\BibTeX{BibTeX}
+%
+% special versions of stuff from xxx10.sty, since only one font size
+%
+\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
+\abovedisplayskip 12pt
+\belowdisplayskip \abovedisplayskip
+\abovedisplayshortskip \z@
+\belowdisplayshortskip \z@
+\let\@listi\@listI} % Setting of \@listi added 9 Jun 87
+\let\small\@normalsize
+\let\footnotesize\@normalsize
+\normalsize
+\footnotesep 12pt
+\labelsep 10pt
+\def\@listI{\leftmargin\leftmargini \parsep 12pt%
+\topsep 12pt%
+\itemsep 0pt}
+\let\@listi\@listI
+\let\@listii\@listI
+\let\@listiii\@listI
+\let\@listiv\@listI
+\let\@listv\@listI
+\let\@listvi\@listI
+\@listI
+%
+% We had sort of random numbers of blank lines around section numbers.
+% Turns out they used various fractional spacing. Rather than depend
+% upon the definition of startsection, just wrap something around it
+% that normalizes the arguments to 12pt. Negative args have special
+% meanings.
+\let\@oldstartsec\@startsection
+\def\@startsection#1#2#3#4#5#6{
+ \@tempskipa #4\relax
+ \@tempskipb #5\relax
+ \ifdim \@tempskipa <\z@ \@tempskipa -12pt \else \@tempskipa 12pt \fi
+ \ifdim \@tempskipb >\z@ \@tempskipb 12pt \fi
+\@oldstartsec{#1}{#2}{#3}{\@tempskipa}{\@tempskipb}{#6}
+}
+%
+% Remaining unsolved problem: hrule and vrule are no-ops. This is
+% visible mostly in the tabular stuff, where none of the lines show up,
+% though it's still basically usable.
+%
+\makeatother