From 6cba2d5eeb522cbf6f1cc28c38fc2c445f41d1e6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 2 Jun 2000 17:22:43 +0000 Subject: [PATCH] Typographical enhancements. Now, the documentation is typeset using a modified book style. Please look at this version and tell me your opinion. Especially I don't feel happy about the spacing and (not) indenting of paragraphs. Also, I've removed things like "fax" and "letter" from the LaTeX mapping file. --- doc/sbase/dist/birddoc/latex2e/mapping | 377 ++----------------------- doc/tex/birddoc.sty | 113 ++++++++ doc/tex/null.sty | 0 doc/tex/qwertz.sty | 19 ++ doc/tex/url.sty | 301 ++++++++++++++++++++ 5 files changed, 449 insertions(+), 361 deletions(-) create mode 100644 doc/tex/birddoc.sty create mode 100644 doc/tex/null.sty create mode 100644 doc/tex/qwertz.sty create mode 100644 doc/tex/url.sty diff --git a/doc/sbase/dist/birddoc/latex2e/mapping b/doc/sbase/dist/birddoc/latex2e/mapping index 2875c6dd..1b3a4412 100644 --- a/doc/sbase/dist/birddoc/latex2e/mapping +++ b/doc/sbase/dist/birddoc/latex2e/mapping @@ -1,81 +1,18 @@ -% linuxdoc to latex replacement file +% birddoc to LaTeX replacement file - + - + - -
+ "\\documentclass\[a4paper\]{article}\n" - "\\usepackage{linuxdoc-sgml}\n" + + "\\documentclass\[a4paper,10pt,openany\]{book}\n" + "\\usepackage{birddoc}\n" "\\usepackage{qwertz}\n" "\\usepackage{url}\n" "\\usepackage\[latin1\]{inputenc}\n" "\\usepackage{t1enc}\n" - "\\usepackage{babel}\n" "\\usepackage{epsfig}\n" "\\usepackage{[OPTS]}\n" - "\\def\\addbibtoc{\n" - "\\addcontentsline{toc}{section}{\\numberline{\\mbox{}}\\relax\\bibname}\n" - "}%end-preamble\n" + - -
+ "\\end{document}" + - - + "\\documentclass\[a4paper\]{report}\n" - "\\usepackage{linuxdoc-sgml}\n" - "\\usepackage{qwertz}\n" - "\\usepackage{url}\n" - "\\usepackage\[latin1\]{inputenc}\n" - "\\usepackage{t1enc}\n" - "\\usepackage{babel}\n" - "\\usepackage{epsfig}\n" - "\\usepackage{[OPTS]}\n" - "\\def\\addbibtoc{\n" - "\\addcontentsline{toc}{chapter}{\\numberline{\\mbox{}}\\relax\\bibname}\n" - "}\n" - "\\pagestyle{headings}%end-preamble\n" + - - + "\\end{document}" + - - + "\\documentclass\[a4paper\]{book}\n" - "\\usepackage{linuxdoc-sgml}\n" - "\\usepackage{qwertz}\n" - "\\usepackage{url}\n" - "\\usepackage\[latin1\]{inputenc}\n" - "\\usepackage{t1enc}\n" - "\\usepackage{babel}\n" - "\\usepackage{epsfig}\n" - "\\usepackage{[OPTS]}\n" - "\\def\\addbibtoc{\n" - "\\addcontentsline{toc}{chapter}{\\numberline{\\mbox{}}\\relax\\bibname}\n" - "}\n" "\\pagestyle{headings}%end-preamble\n" + + "\\end{document}" + - - + "\\documentclass\[a4paper\]{article}\n" - "\\usepackage{linuxdoc-sgml}\n" - "\\usepackage{qwertz}\n" - "\\usepackage{url}\n" - "\\usepackage\[latin1\]{inputenc}\n" - "\\usepackage{t1enc}\n" - "\\usepackage{babel}\n" - "\\usepackage{epsfig}\n" - "\\usepackage{[OPTS]}\n" - "\\def\\title#1{\n" - "\\begin{center}\n" - "\\bf\n" - "#1\n" - "\\end{center}\n" - "\\bigskip\n" - "}\n" - "\\begin{document}%end-preamble\n" - - + "\\end{document}" + - - - + "" - - % Manual Pages are expected to be formatted using nroff (or groff), unless % they are included as sections of other qwertz documents. @@ -188,10 +125,10 @@ + "\\item\[{\\ttfamily " - "}\] \\mbox{}\n\n" + "}\] \\hfil\\break\n" + + "\\item\[ " - "\] \\mbox{}\n\n" + "\] \\hfil\\break\n" + "\\cite{[ID]" "}" @@ -263,7 +200,7 @@ "}" "{\\it " - "}" + "\\/}" "{\\rm " "}" @@ -313,14 +250,19 @@ %
+ "\\macro{qwmain}{\\qwmain}" %
+% + "\\par\n" +% "\\medbreak\\hrule\\nopagebreak\n" +% "\\begin{verbatim}" + +% +% + "\\end{verbatim}\n" +% "\\nopagebreak\\hrule\\medbreak\n" + + + "\\par\n" - "\\addvspace{\\medskipamount}\n" - "\\nopagebreak\\hrule\n" + "\\goodbreak{\\birdnarrow\n" "\\begin{verbatim}" + - + "\\end{verbatim} \n" - "\\nopagebreak\\hrule \n" - "\\addvspace{\\medskipamount}" + + + "\\end{verbatim}\n" + "}\\smallbreak\n" + + "\\begin{verbatim}" + + "\\end{verbatim}" + @@ -473,291 +415,4 @@ + "\\hline" + -% slides - - + "\\documentclass\[qwertz,dina4,xlatin1,[OPTS]\]{article}\n" - "\\input{epsf.tex}\n" - "\\def\\title#1{\n" - "\\begin{center}\n" - "\\bf\\LARGE\n" - "#1\n" - "\\end{center}\n" - "\\bigskip\n" - "}\n" - "\\begin{document}" + - + "\\end{document}" + - - - + "\\newpage" + - -% letters - - - + "\\documentstyle\[qwertz,dina4,xlatin1,[OPTS]\]{letter}\n" - "\\input{epsf.tex} \n" - "\\newfont{\\gmd}{gmdlogo} \n" - "\\font\\agb=pagk at 13truept\n" - "\\font\\helv=phvr at 7.4truept\n" - "\\parindent 0pt \n" - "\\parskip 5pt plus 1pt minus 2pt \n" - "\\addtolength{\\oddsidemargin}{-4.0mm} \n" - "\\addtolength{\\evensidemargin}{-4.0mm} \n" - "\\setlength{\\unitlength}{ 1.0mm } \n" - - % initial values for optional elements in the - % letter head - - "\\def\\semail{} \n" - "\\def\\remail{} \n" - "\\def\\sphone{} \n" - "\\def\\rphone{} \n" - "\\def\\sref{} \n" - "\\def\\rref{} \n" - "\\def\\rdate{} \n" - "\\def\\subj{} \n" - - % switch for distinguishing between context of - % sender and receiver's address - - "\\newif\\ifsender \n" - "\\newif\\ifsubj \n" - "\\subjfalse \n" % assume no subject - - "\\newif\\ifcc \n" % for cc field - "\\ccfalse \n" - - "\\newif\\ifsaddress\n" - "\\saddressfalse\n" - "\\newif\\ifraddress\n" - "\\raddressfalse\n" - - "\\newif\\iffax\n" - "\\faxfalse\n" - -"\\def\\letterhead{\n" -"\\begin{picture}(178,54) \n" -"\\put(0,50){\\agb GESELLSCHAFT F\\\"{U}R MATHEMATIK UND \n" -"DATENVERARBEITUNG MBH } \n" - -"\\put(147,50){\\gmd g} \n " - -"\\put(0,40){\\helv GMD, Postfach 1316, Schlo{\\ss} Birlinghoven, \n " -"D-53757 Sankt Augustin 1} \n " - -"\\put(97,40){\\parbox\[b\]{10cm} \n" -"{\\helv\\raggedright \n" -"\\baselineskip=9pt plus 2pt \n" -"Telefon (0 22 41) 14-0 \\\\ \n" -"Telefax (0 22 41) 14 26 18, -28 89}}\n" - -"\\put(0,210){\\makebox(0,0)\[bl\]{\\today}} \n " - -% letter specific information - -% from - -% name and e-mail - -"\\put(0,44){\\sname\\ \\semail} \n" - -% phone - -"\\put(128,44){-\\sphone} \n" - -% To, name and address - -"\\put(0,30){\\parbox\[t\]{9.5cm} \n" -"{\\rname \\\\\n" -"\\ifraddress\\raddress\\fi}}\n" - -% subject - -"\\ifsubj{\\put(0,0){\\subj}}\\fi\n" - -% sref - -% "\\put(70,15){\\sref} \n" - -% rref - -% "\\put(0,15){\\rref} \n" - -% rdate - -% "\\put(32,15){\\rdate} \n" - -"\\end{picture} \n" -"}\n" % end of letterhead definition - - + "\\end{document}" + - - + "\\documentstyle\[[OPTS],qwertz,dina4,xlatin1\]{article}\n" - "\\def\\faxlength{[LENGTH]}\n" - - % initial values for optional elements in the - % letter head - - "\\def\\semail{} \n" - "\\def\\remail{} \n" - "\\def\\sphone{} \n" - "\\def\\rphone{} \n" - "\\def\\rfax{} \n" - "\\def\\sfax{} \n" - "\\def\\subj{} \n" - - % switch for distinguishing between context of - % sender and receiver's address - - "\\newif\\ifsender \n" - "\\newif\\ifsubj \n" - "\\subjfalse \n" % assume no subject - - "\\newif\\ifcc \n" % for cc field - "\\ccfalse \n" - - "\\newif\\ifsaddress\n" - "\\saddressfalse\n" - "\\newif\\ifraddress\n" - "\\raddressfalse\n" - - "\\newif\\iffax\n" - "\\faxtrue\n" - -"\\def\\letterhead{\n" -"\\newfont{\\gmd}{gmdlogo}\n" -"\\setlength{\\parindent}{0pt}\n" - -"\\parbox\[b\]{\\textwidth}{Gesellschaft f\\\"{u}r\n" -"Mathematik und Datenverarbeitung mbH \\\\\n" -"Schlo{\\ss} Birlinghoven \\\\\n" -"D-53757 St.~Augustin \\\\\n" -"Telefax: +49--2241--142618, " -"+49--2241--142889}\\makebox\[0pt\]\[r\]{\\gmd e}\n" - -"\\begin{center}\n" -"~ \\\\\n" -"\\LARGE TELEFAX\n" -"\\\\ ~\n" -"\\end{center}\n" - -"\\framebox\[\\textwidth\]{\\parbox{0.9\\textwidth}\%\n" -"{\n" -"Von/From: \\sname\n" -"\\\\\n" -"Datum/Date: \\today\n" -"}}\n" - -"\\framebox\[\\textwidth\]{\\parbox{0.9\\textwidth}\%\n" -"{\n" -"An/To: \\rname\n" -"\\\\\n" -"Telefax: \\rfax\n" -"\\\\\n" -"Firma/Company: \\raddress\n" -"}}\n" - -"\\framebox\[\\textwidth\]{\\parbox{0.9\\textwidth}\%\n" -"{\n" -"Anzahl der gesendeten Seiten (inkl. dieses Deckblatts)/ \\\\\n" -"Number of pages (including this cover sheet): \\faxlength\n" -"}}\n" - -"\\framebox\[\\textwidth\]{\\parbox{0.9\\textwidth}\%\n" -"{\\setlength{\\parskip}{0.5\\baselineskip}\n" -"Bemerkungen/Comments: \\\\\n" -"\\subj\n" -"\\vspace{60pt}}}\n" -"}\n" % end of letterhead definition for fax messages - - + "\\end{document}" + - - + "\\begin{document}\n" - "\\pagestyle{empty}\n" - "\\letterhead\n" - -"\\iffax\\newpage\n" -"\\else{\\ifsubj\\vspace{0.5cm}\\fi}\n" -"\\fi\n\\par" + - - + "\n\n\\vspace{0.6cm}\n\\par" + - - - + "\\sendertrue\n" - "\\def\\sname{" - "}" + - - - + "\\senderfalse\n" - "\\def\\rname{" - "}" + - -% first end definition of name - -
"\\def\\address{" -
"}\n" - "\\ifsender{\\global\\saddresstrue\n" - "\\global\\def\\saddress{\\address}}\n" - "\\else{\\global\\raddresstrue\n" - "\\global\\def\\raddress{\\address}}\n" - "\\fi" + - - + "\\def\\email{" - "}\n" - "\\ifsender\\edef\\semail{(\\email)} \n" - " \\else\\edef\\remail{\\email} \n" - "\\fi" + - - + "\\def\\phone{" - "}\n" - "\\ifsender\\edef\\sphone{\\phone} \n" - " \\else\\edef\\rphone{\\phone} \n" - "\\fi" + - - - + "\\def\\fax{" - "}\n" - "\\ifsender\\edef\\sfax{\\fax} \n" - "\\else{\\global\\edef\\rfax{\\fax}\n" - "\\newwrite\\faxnum\n" - "\\immediate\\openout\\faxnum=.fax=num\n" - "\\immediate\\write\\faxnum{\\rfax}\n" - "\\immediate\\closeout\\faxnum}\n" - "\\fi" + - - + "\\subjtrue\n" - "\\def\\subj{" - "}" + - - - + "\\newcommand{\\sref}{" - "}" + - - + "\\newcommand{\\rref}{" - "}" + - - + "\\def\\rdate}{" - "}" + - - + "\\vspace{1cm} \n\\par\n" - "\\parbox\[t\]{\\textwidth} " - "{" - + "}\\vspace{2cm}\n\\par\n" - "\\sname \n" - "\\ifcc{\\vspace{0.5cm}\n\\par\n" - "cc:\\ \\ \\parbox\[t\]{14cm}{\n" - "\\cc}\\fi\n" + - - + "\\cctrue\n" - "\\def\\cc{" - "}" + - - + "\\vspace{0.5cm}\n\\par\n" - "encl:\\ \\ \\parbox\[t\]{14cm}{" - "}\n\n" + - - + "\\vspace{0.5cm}\n\\par" + - - - % end of latex replacement file - diff --git a/doc/tex/birddoc.sty b/doc/tex/birddoc.sty new file mode 100644 index 00000000..3cb74035 --- /dev/null +++ b/doc/tex/birddoc.sty @@ -0,0 +1,113 @@ +%% This is a LaTeX style file for typesetting BIRD documentation. +%% Hacked up by Martin Mares +%% +%% This is a modified version of linuxdoc-qwertz.sty, for use with SGML-generated LaTeX +%% by Matt Welsh (mdw@sunsite.unc.edu) +%% +%% Based on linuxdoc.sty by Michael K. Johnson, and latex.tex by +%% Leslie Lamport. + +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{birddoc} + +%%% GLOBAL LAYOUT THINGS + +\marginparwidth 0.0 in +\parindent 0 in +\topmargin -0.5 in +\setlength{\textheight}{\paperheight} +\addtolength{\textheight}{-2 in} +\advance\headsep 2 ex +\advance\textheight -2 ex +\renewcommand{\baselinestretch}{1.14} +\addtolength{\parskip}{0.5 ex} +\setcounter{tocdepth}{1} + +\oddsidemargin 0.0 in +\evensidemargin 0 in +\textwidth 7 in +\def\ps@headings{\let\@mkboth\markboth + \def\@oddfoot{}\def\@evenfoot{}% No feet. + \def\@evenhead{\protect\rule[-4pt]{\textwidth}{.5pt}\kern-\textwidth + \rm \thepage\hfil \bf \leftmark} % Left heading. + \def\@oddhead{\protect\rule[-4pt]{\textwidth}{.5pt}\kern-\textwidth + {\bf \rightmark}\hfil \rm\thepage} % Right heading. + \def\chaptermark##1{\markboth {{\ifnum \c@secnumdepth >\m@ne + \@chapapp\ \thechapter. \ \fi ##1}}{}}% + \def\sectionmark##1{\markright {{\ifnum \c@secnumdepth >\z@ + \thesection. \ \fi ##1}}}} + +\def\@makechapterhead#1{% + {\parindent \z@ \raggedright \normalfont + \huge \bfseries \@chapapp\space\thechapter: #1\par\nobreak + \vskip 20\p@ + }} +\def\@makeschapterhead#1{% + {\parindent \z@ \raggedright \normalfont + \huge \bfseries #1\par\nobreak + \vskip 20\p@ + }} + +%% Titlepage stuff + +\gdef\@title{} +\gdef\title#1{\gdef\@title{#1}} +\gdef\@date{} +\gdef\date#1{\gdef\@date{#1}} +\gdef\@author{} +\gdef\author#1{\gdef\@author{#1}} +\gdef\@abstract{} +\gdef\abstract#1{\gdef\@abstract{#1}} + +\def\maketitle{\thispagestyle{empty}\let\footnotesize\small% +\let\footnoterule\relax +%\setcounter{page}{0}% +%\null +%\vskip 3 in +\noindent +{\huge\sf \@title}\\ +\rule{\textwidth}{1mm}\\ +\mbox{}\@author\ \hfill \@date\ \\ +\vskip 1 ex +\noindent{\sf \@abstract} +\setcounter{footnote}{0}% +\gdef\@author{}\gdef\@title{}\gdef\@years{}\gdef\@abstract{} +\let\maketitle\relax} + +\def\birdnarrow{\advance\@totalleftmargin by 0.5in} + +%% Needs to be here for the previous ps@headings defs to work. +\pagestyle{headings} + +%%% USEFUL MACROS + +\newcommand{\linux}{Linux} % Always use this when + % refering to the \linux\ + % operating system, like that. +\newcommand{\key}[1]{{\fbox{\small\tt #1}}} % Use this to mark keys, like + % \key{del} for the delete key. +\newcommand{\ret}{\fbox{\sf return}} % Special case for the return key. +\newcommand{\st}{\small\tt} % Small typewriter -- comes in handy. +%\newcommand{\lb}{{\tt\char '173}} % Left Brace '{' +%\newcommand{\rb}{{\tt\char '175}} % Right Brace '}' +\newcommand{\lbr}{$\langle$} % Left Bracket '<' +\newcommand{\rbr}{$\rangle$} % Right Bracket '>' +\newcommand{\bs}{{\tt\char '134}} % BackSlash '\' +\newcommand{\tm}{${}^{\mbox{\tiny\sf TM}}$} +\newcommand{\TM}{\tm} % TM trademark symbol in + % either case +\newcommand{\cparam}[1]{{\rm \lbr{\sl #1}\rbr}} + % Metavariables. + +%% Define NAMEURL macro to handle the optional name argument +%% This calls on the \url macro from the url.sty package so the +%% URL will be hyphenated correctly. +\def\nameurl#1#2{{\em #2} {\tt <\url{#1}>}} +\def\onlynameurl#1{{\em #1}} + +%% the tscreen environment automatically goes into typewriter type, +%% but is otherwise like the screen environment + +\newenvironment{tscreen}% + {\begin{quote}\bgroup\small\tt}% + {\egroup\end{quote}} diff --git a/doc/tex/null.sty b/doc/tex/null.sty new file mode 100644 index 00000000..e69de29b diff --git a/doc/tex/qwertz.sty b/doc/tex/qwertz.sty new file mode 100644 index 00000000..aeade62b --- /dev/null +++ b/doc/tex/qwertz.sty @@ -0,0 +1,19 @@ + +% qwertz TeX macros + +\catcode`\"=12 +\sloppy +\newtheorem{definition}{Definition} +\newtheorem{proposition}{Proposition} +\newtheorem{lemma}{Lemma} +\newtheorem{corollary}{Corollary} +\newtheorem{theorem}{Theorem} +\newcommand{\mch}[1]{{\ifmmode#1 \else\(#1\)\fi}} +\newcommand{\lt}{{\ifmmode{<}\else{\verb+<+}\fi}} +\newcommand{\gt}{{\ifmmode{>}\else{\verb+>+}\fi}} +\newcommand{\verbar}{{\ifmmode{|}\else{\tt|}\fi}} +\newcommand{\idx}[1]{#1\index{#1}} +\newcommand{\cdx}[1]{#1\index{#1@{\tt #1}}} +\newcommand{\nidx}[1]{\index{#1}} +\newcommand{\ncdx}[1]{\index{#1@{\tt #1}}} + diff --git a/doc/tex/url.sty b/doc/tex/url.sty new file mode 100644 index 00000000..59f10afb --- /dev/null +++ b/doc/tex/url.sty @@ -0,0 +1,301 @@ +% url.sty ver 1.2 19-Oct-1996 Donald Arseneau asnd@triumf.ca +% +% A form of \verb that allows linebreaks at certain characters or +% combinations of characters, accepts reconfiguration, and can usually +% be used in the argument to another command. It is intended for email +% addresses, hypertext links, directories/paths, etc., which normally +% have no spaces. The font may be selected using the \urlstyle command, +% and new url-like commands can be defined using \urldef. +% +% Usage: Conditions: +% \url{ } If the argument contains any "%", "#", or "^^", or ends with +% "\", it can't be used in the argument to another command. +% The argument must not contain unbalanced braces. +% \url| | ...where "|" is any character not used in the argument and not +% "{". The same restrictions as above except that the argument +% may contain unbalanced braces. +% \xyz for "\xyz" a defined-url; this can be used anywhere, no matter +% what characters it contains. +% +% See further instructions after "\endinput" +% +\def\Url@ttdo{% style assignments for tt fonts or T1 encoding +\def\UrlBreaks{\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\%\do\;\do\>\do\]% + \do\)\do\,\do\?\do\'\do\+\do\=}% +\def\UrlBigBreaks{\do\:\do@url@hyp}% +\def\UrlNoBreaks{\do\(\do\[\do\{\do\<}% (unnecessary) +\def\UrlSpecials{\do\ {\ }}% +\def\UrlOrds{\do\*\do\-\do\~}% any ordinary characters that aren't usually +} +\def\Url@do{% style assignments for OT1 fonts except tt +\def\UrlBreaks{\do\.\do\@\do\/\do\!\do\%\do\;\do\]\do\)\do\,\do\?\do\+\do\=}% +\def\UrlBigBreaks{\do\:\do@url@hyp}% +\def\UrlNoBreaks{\do\(\do\[\do\{}% prevents breaks after *next* character +\def\UrlSpecials{\do\<{\langle}\do\>{\mathbin{\rangle}}\do\_{\_% + \penalty\@m}\do\|{\mid}\do\{{\lbrace}\do\}{\mathbin{\rbrace}}\do + \\{\mathbin{\backslash}}\do\~{\mathord{{}^{\textstyle\sim}}}\do\ {\ }}% +\def\UrlOrds{\do\'\do\"\do\-}% +} +\def\url@ttstyle{% +\@ifundefined{selectfont}{\def\UrlFont{\tt}}{\def\UrlFont{\ttfamily}}\Url@ttdo +} +\def\url@rmstyle{% +\@ifundefined{selectfont}{\def\UrlFont{\rm}}{\def\UrlFont{\rmfamily}}\Url@do +} +\def\url@sfstyle{% +\@ifundefined{selectfont}{\def\UrlFont{\sf}}{\def\UrlFont{\sffamily}}\Url@do +} +\def\url@samestyle{\ifdim\fontdimen\thr@@\font=\z@ \url@ttstyle \else + \url@rmstyle \fi \def\UrlFont{}} + +\@ifundefined{strip@prefix}{\def\strip@prefix#1>{}}{} +\@ifundefined{verbatim@nolig@list}{\def\verbatim@nolig@list{\do\`}}{} + +\def\Url{\relax\ifmmode\@nomatherr$\fi + \UrlFont $\fam\z@ \textfont\z@\font + \let\do\@makeother \dospecials % verbatim catcodes + \catcode`{\@ne \catcode`}\tw@ % except braces + \medmuskip0mu \thickmuskip\medmuskip \thinmuskip\medmuskip + \@tempcnta\fam\multiply\@tempcnta\@cclvi + \let\do\set@mathcode \UrlOrds % ordinary characters that were special + \advance\@tempcnta 8192 \UrlBreaks % bin + \advance\@tempcnta 4096 \UrlBigBreaks % rel + \advance\@tempcnta 4096 \UrlNoBreaks % open + \let\do\set@mathact \UrlSpecials % active + \let\do\set@mathnolig \verbatim@nolig@list % prevent ligatures + \@ifnextchar\bgroup\Url@z\Url@y} + +\def\Url@y#1{\catcode`{11 \catcode`}11 + \def\@tempa##1#1{\Url@z{##1}}\@tempa} +\def\Url@z#1{\def\@tempa{#1}\expandafter\expandafter\expandafter\Url@Hook + \expandafter\strip@prefix\meaning\@tempa\UrlRight\m@th$\endgroup} +\def\Url@Hook{\UrlLeft} +\let\UrlRight\@empty +\let\UrlLeft\@empty + +\def\set@mathcode#1{\count@`#1\advance\count@\@tempcnta\mathcode`#1\count@} +\def\set@mathact#1#2{\mathcode`#132768 \lccode`\~`#1\lowercase{\def~{#2}}} +\def\set@mathnolig#1{\ifnum\mathcode`#1<32768 + \lccode`\~`#1\lowercase{\edef~{\mathchar\number\mathcode`#1_{\/}}}% + \mathcode`#132768 \fi} + +\def\urldef#1#2{\begingroup \setbox\z@\hbox\bgroup + \def\Url@z{\Url@def{#1}{#2}}#2} +\expandafter\ifx\csname DeclareRobustCommand\endcsname\relax + \def\Url@def#1#2#3{\m@th$\endgroup\egroup\endgroup + \def#1{#2{#3}}} +\else + \def\Url@def#1#2#3{\m@th$\endgroup\egroup\endgroup + \DeclareRobustCommand{#1}{#2{#3}}} +\fi + +\def\urlstyle#1{\csname url@#1style\endcsname} + +% Sample (and default) configuration: +% +\newcommand\url{\begingroup \Url} +% +\newcommand\path{\begingroup \urlstyle{tt}\Url} +% +% too many styles define \email like \address, so I will not define it. +% \newcommand\email{\begingroup \urlstyle{rm}\Url} + +% Process LaTeX \package options +% +\urlstyle{tt} +\let\Url@sppen\@M +\def\do@url@hyp{}% by default, no breaks after hyphens + +\@ifundefined{ProvidesPackage}{}{ + \ProvidesPackage{url}[1996/10/19 \space ver 1.2 \space + Verb mode for urls, email addresses, and file names] + \DeclareOption{hyphens}{\def\do@url@hyp{\do\-}}% allow breaks after hyphens + \DeclareOption{obeyspaces}{\let\Url@Hook\relax}% a flag for later + \DeclareOption{spaces}{\let\Url@sppen\relpenalty} + \DeclareOption{T1}{\let\Url@do\Url@ttdo} + \ProcessOptions +\ifx\Url@Hook\relax % [obeyspaces] was declared + \def\Url@Hook#1\UrlRight\m@th{\edef\@tempa{\noexpand\UrlLeft + \Url@retain#1\Url@nosp\, }\@tempa\UrlRight\m@th} + \def\Url@retain#1 {#1\penalty\Url@sppen\ \Url@retain} + \def\Url@nosp\,#1\Url@retain{} +\fi +} + +\endinput +% +% url.sty ver 1.2 19-Oct-1996 Donald Arseneau asnd@reg.triumf.ca +% +% This package defines "\url", a form of "\verb" that allows linebreaks, +% and can often be used in the argument to another command. It can be +% configured to print in different formats, and is particularly useful for +% hypertext links, email addresses, directories/paths, etc. The font may +% be selected using the "\urlstyle" command and pre-defined text can be +% stored with the "\urldef" command. New url-like commands can be defined, +% and a "\path" command is provided this way. +% +% Usage: Conditions: +% \url{ } If the argument contains any "%", "#", or "^^", or ends with +% "\", it can't be used in the argument to another command. +% The argument must not contain unbalanced braces. +% \url| | ...where "|" is any character not used in the argument and not +% "{". The same restrictions as above except that the argument +% may contain unbalanced braces. +% \xyz for "\xyz" a defined-url; this can be used anywhere, no matter +% what characters it contains. +% +% The "\url" command is fragile, and its argument is likely to be very +% fragile, but a defined-url is robust. +% +% Package Option: obeyspaces +% Ordinarily, all spaces are ignored in the url-text. The "[obeyspaces]" +% option allows spaces, but may introduce spurious spaces when a url +% containing "\" characters is given in the argument to another command. +% So if you need to obey spaces you can say "\usepackage[obeyspaces]{url}", +% and if you need both spaces and backslashes, use a `defined-url' for +% anything with "\". +% +% Package Option: hyphens +% Ordinarily, breaks are not allowed after "-" characters because this +% leads to confusion. (Is the "-" part of the address or just a hyphen?) +% The package option "[hyphens]" allows breaks after explicit hyphen +% characters. The "\url" command will *never ever* hyphenate words. +% +% Package Option: spaces +% Likewise, breaks are not usually allowed after spaces under the +% "[obeyspaces]" option, but giving the options "[obeyspaces,spaces]" +% will allow breaks at those spaces. +% +% Package Option: T1 +% This signifies that you will be using T1-encoded fonts which contain +% some characters missing from most older (OT1) encoded TeX fonts. This +% changes the default definition for "\urlstyle{rm}". +% +% Defining a defined-url: +% Take for example the email address "myself%node@gateway.net" which could +% not be given (using "\url" or "\verb") in a caption or parbox due to the +% percent sign. This address can be predefined with +% \urldef{\myself}\url{myself%node@gateway.net} or +% \urldef{\myself}\url|myself%node@gateway.net| +% and then you may use "\myself" instead of "\url{myself%node@gateway.net}" +% in an argument, and even in a moving argument like a caption because a +% defined-url is robust. +% +% Style: +% You can switch the style of printing using "\urlstyle{tt}", where "tt" +% can be any defined style. The pre-defined styles are "tt", "rm", "sf", +% and "same" which all allow the same linebreaks but different fonts -- +% the first three select a specific font and the "same" style uses the +% current text font. You can define your own styles with different fonts +% and/or line-breaking by following the explanations below. The "\url" +% command follows whatever the currently-set style dictates. +% +% Alternate commands: +% It may be desireable to have different things treated differently, each +% in a predefined style; e.g., if you want directory paths to always be +% in tt and email addresses to be rm, then you would define new url-like +% commands as follows: +% +% \newcommand\email{\begingroup \urlstyle{rm}\Url} +% \newcommand\directory{\begingroup \urlstyle{tt}\Url} +% +% You must follow this format closely, and NOTE that the final command is +% "\Url", not "\url". In fact, the "\directory" example is exactly the +% "\path" definition which is pre-defined in the package. If you look +% above, you will see that "\url" is defined with +% \newcommand\url{\begingroup \Url} +% I.e., using whatever url-style has been selected. +% +% You can make a defined-url for these other styles, using the usual +% "\urldef" command as in this example: +% +% \urldef{\myself}{\email}{myself%node.domain@gateway.net} +% +% which makes "\myself" act like "\email{myself%node.domain@gateway.net}", +% if the "\email" command is defined as above. The "\myself" command +% would then be robust. +% +% Defining styles: +% Before describing how to customize the printing style, it is best to +% mention something about the unusual implementation of "\url". Although +% the material is textual in nature, and the font specification required +% is a text-font command, the text is actually typeset in *math* mode. +% This allows the context-sensitive linebreaking, but also accounts for +% the default behavior of ignoring spaces. Now on to defining styles. +% +% To change the font or the list of characters that allow linebreaks, you +% could redefine the commands "\UrlFont", "\UrlBreaks", "\UrlSpecials" etc. +% directly in the document, but it is better to define a new `url-style' +% (following the example of "\url@ttstyle" and "\url@rmstyle") which defines +% all of "\UrlBigbreaks", "\UrlNoBreaks", "\UrlBreaks", "\UrlSpecials", and +% "\UrlFont". +% +% Changing font: +% The "\UrlFont" command selects the font. The definition of "\UrlFont" +% done by the pre-defined styles varies to cope with a variety of LaTeX +% font selection schemes, but it could be as simple as "\def\UrlFont{\tt}". +% Depending on the font selected, some characters may need to be defined +% in the "\UrlSpecials" list because many fonts don't contain all the +% standard input characters. +% +% Changing linebreaks: +% The list of characters that allow line-breaks is given by "\UrlBreaks" +% and "\UrlBigBreaks", which have the format "\do\c" for character "c". +% The differences are that `BigBreaks' have a lower penalty and have +% different breakpoints when in sequence (as in "http://"): `BigBreaks' +% are treated as mathrels while `Breaks' are mathbins (see The TeXbook, +% p.170). In particular, a series of `BigBreak' characters will break at +% the end and only at the end; a series of `Break' characters will break +% after the first and after every following *pair*; there will be no +% break after a `Break' character if a `BigBreak' follows. In the case +% of "http://" it doesn't matter whether ":" is a `Break' or `BigBreak' -- +% the breaks are the same in either case; but for DECnet nodes with "::" +% it is important to prevent breaks *between* the colons, and that is why +% colons are `BigBreaks'. +% +% It is possible for characters to prevent breaks after the next following +% character (I use this for parentheses). Specify these in "\UrlNoBreaks". +% +% You can do arbitrarily complex things with characters by making them +% active in math mode (mathcode hex-8000) and specifying the definition(s) +% in "\UrlSpecials". This is used in the rm and sf styles for OT1 font +% encoding to handle several characters that are not present in those +% computer-modern style fonts. See the definition of "\Url@do", which +% is used by both "\url@rmstyle" and "\url@sfstyle"; it handles missing +% characters via "\UrlSpecials". The nominal format for setting each +% special character "c" is: "\do\c{}", but you can include +% other definitions too. +% +% +% If all this sounds confusing ... well, it is! But I hope you won't need +% to redefine breakpoints -- the default assignments seem to work well for +% a wide variety of applications. If you do need to make changes, you can +% test for breakpoints using regular math mode and the characters "+=(a". +% +% Yet more flexibility: +% You can also customize the verbatim text by defining "\UrlRight" and/or +% "\UrlLeft", e.g., for ISO formatting of urls surrounded by "< >", define +% +% \renewcommand\url{\begingroup \def\UrlLeft{}% +% \urlstyle{tt}\Url} +% +% The meanings of "\UrlLeft" and "\UrlRight" are *not* reproduced verbatim. +% This lets you use formatting commands there, but you must be careful not +% to use TeX's special characters ("\^_%~#$&{}" etc.) improperly. +% You can also define "\UrlLeft" to reprocess the verbatim text, but the +% format of the definition is special: +% +% \def\UrlLeft#1\UrlRight{ ... do things with #1 ... } +% +% Yes, that is "#1" followed by "\UrlRight" then the definition. For +% example, to put a hyperTeX hypertext link in the DVI file: +% +% \def\UrlLeft#1\UrlRight{\special{html:}#1\special{html:}} +% +% Revision History: +% ver 1.1 6-Feb-1996: +% Fix hyphens that wouldn't break and ligatures that weren't suppressed. +% ver 1.2 19-Oct-1996: +% Package option for T1 encoding; Hooks: "\UrlLeft" and "\UrlRight". +% +% The End