summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/ptex/ptex-manual/ptex-manual.sty
blob: 6d57f3c840a34fd2cda15ac432cdc91218643b88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%%% common macros for ptex-manual documents
\def\headfont{\normalfont\mathversion{bold}\sffamily}
\def\node#1{\textit{#1}}
\def\.#1{\texorpdfstring{%
     \leavevmode\hbox{\texttt{\textbackslash#1}}\ifmmode\else\textcompwordmark\fi}{\textbackslash #1}}

\@ifpackageloaded{enumitem}{%
\let\orig@cs=\.
\def\ind@cs#1{\orig@cs{#1}\indcs{#1}}
\def\indcs#1{\index{{\texttt{\textbackslash #1}}}}
\newlist{cslist}{description}1
\setlist[cslist]{%
  itemsep=\medskipamount,listparindent=1zw,
  font=\normalfont\mdseries, leftmargin=2zw,
  before=\advance\@listdepth\@ne,
  after=\advance\@listdepth\m@ne
}
\def\csitem[#1]{\item[\llap{$\blacktriangleright$~}\let\.=\ind@cs#1]
      \leavevmode\par\nopagebreak}
}{}

\let\origemph=\emph
\def\emph#1{{\bfseries\sffamily\gtfamily\selectfont\mathversion{bold}#1}}
\def\paragraph#1{\par\medskip\par\noindent\emph{■#1}\par\nobreak}

\def\Pkg#1{\textsf{#1}}
\let\@lessthan <
\begingroup
\catcode`\<=13
\gdef<{\ifmmode\@lessthan\else\expandafter\@@meta\fi}
\gdef\@@meta#1>{\ensuremath{\langle\hbox{\normalfont\textit{#1}}\rangle}}
\gdef\hex#1{\ifmmode\mbox\fi{\texttt{"#1}}}%"
\endgroup
\AtBeginDocument{\catcode`\<=13\relax}

\xspcode`\\=3
\xspcode`\*=3
\xspcode`\-=3
\xspcode23=3 % \textcompwordmark

\normalsize
\bigskipamount=\baselineskip
\medskipamount=.5\baselineskip
\smallskipamount=.25\baselineskip

\usepackage{etoolbox}
\patchcmd\@verbatim\@totalleftmargin{\dimexpr\@totalleftmargin+2zw\relax}{}{}
\patchcmd\quote{\list{}}{\par\addvspace\medskipamount\list{}}{}{}
\patchcmd\endquote{\endlist}{\endlist\addvspace\medskipamount}{}{}
\patchcmd\@verbatim{\trivlist}{\trivlist\addvspace\medskipamount\noautoxspacing}{}{}
\patchcmd\endverbatim{\endtrivlist}{\endtrivlist\addvspace\medskipamount}{}{}
\expandafter\let\csname endverbatim*\endcsname =\endverbatim
\patchcmd\verb{\ifmmode\hbox\else\leavevmode\vadjust{}\fi\bgroup}
  {\ifmmode\else\leavevmode\vadjust{}\fi\hbox
  \bgroup\textcompwordmark\noautoxspacing\noautospacing}{}{}
\patchcmd\verb@egroup{\egroup}{\egroup\textcompwordmark}{}{}

\ifx\jsc@clsname\@undefined\else % jsclasses-specific
\renewenvironment{theindex}{%
    \def\presectionname{}\def\postsectionname{}%
    \section*{\indexname}
    \@mkboth{\indexname}{\indexname}%
    \plainifnotempty % \thispagestyle{plain}
    \parindent\z@
    \parskip\z@ \@plus .3\p@\relax
    \let\item\@idxitem
    \raggedright
    \begin{multicols}{2}
  }{
    \end{multicols}
    \clearpage
  }
\fi

% multilist env.
\newenvironment{multilist}[2]%
 {$$\setbox\z@=\hbox\bgroup  % catch some funny things -> \mathord
  \let\a=\empty
  \let\b=\empty
  \count@=\z@
  \toks@={#2}%
  \def\item##1\cr
   {\ifnum \count@=\z@
      \count@=#1%
      \expandafter\def\expandafter\b\expandafter{\b\y{}}%
    \fi
    \advance\count@ by\m@ne
    \expandafter\def\expandafter\a\expandafter{\a\x{##1}}}%
  \ignorespaces}%
 {\loop
  \ifnum \count@>\z@
    \expandafter\def\expandafter\a\expandafter{\a\expandafter\z\b\relax}%
    \advance\count@ by\m@ne
  \repeat
  \def\x##1{\expandafter\y\b\relax{##1}}%
  \def\y\y##1##2\relax##3%
   {\ifx @##1@%
      \def\b{##2\y{##3}}%
    \else
      \def\b{##2\y{##1&##3}}%
    \fi}%
  \def\z\y##1##2\relax{\def\b{##2\y{##1}}}%
  \a
  \def\x
   {\expandafter\egroup\expandafter\halign\expandafter\bgroup
    \expandafter&\the\toks@\cr}%
  \def\y##1{\expandafter\def\expandafter\x\expandafter{\x##1\cr}}%
  \b
  \x\egroup $$}

% dangerous env.
\font\man=manfnt at 10pt
\def\dbend{\raise0pt\hbox{\man\char'177}}
\newenvironment{dangerous}{%
  \ifnum\@listdepth>\z@
    \GenericError{}{Do not use `dangerous' environment inside any list}{}{}
  \fi
  \par\addvspace\medskipamount
  \@tempdima=\dimexpr\textwidth-2zw\relax\small
  \bigskipamount=\baselineskip
  \medskipamount=.5\baselineskip
  \smallskipamount=.25\baselineskip
  \clubpenalty=10000 \widowpenalty=9999
  \divide\@tempdima by\dimexpr1zw\relax\@tempcnta=\@tempdima
  \leftskip=\dimexpr\textwidth-\@tempcnta zw\relax
  \@totalleftmargin\dimexpr\leftskip+0zw
  \linewidth=\dimexpr\@tempcnta zw-0zw
  \parindent1zw\noindent\kern-\leftskip\hbox to\leftskip{\dbend\hss}%
  \everypar{\everypar{}}\ignorespaces
}{\par\addvspace\medskipamount}

% macros for index (simplified from doc.sty)
\newif\ifscan@allowed
\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus1fill}%
\def\pfill{\unskip~\dotfill\nobreak}

%%% EOF