%/u/sy/beebe/tex/pathname.tex, Sat Oct 15 14:07:20 1988 %Edit by Nelson H.F. Beebe (beebe at plot79.utah.edu) % % Computer filenames, host names, and mail addresses tend to be long % strings that cause line breaking problems for TeX. This file % defines a macro that automatically inserts discretionary hyphens in % its argument at potential breakpoints, and sets the text in the % typewriter font. It is invoked simply by enclosing the string in % vertical bars (chosen because they do not appear in mail addresses, % and are rare in filenames): % % |Friesland\%rz.informatik.uni-hamburg.dbp.de\%germany.csnet@relay.cs.net| % |MIGHTY-MOUSE-GW.SCRC.SYMBOLICS.COM| (longest name in Arpanet host table) % % Note that the characters $%_#^\{}| in the string still have to be % protected against other interpretation by prefixed backslashes. % % Discretionary hyphens are inserted BEFORE the characters @!%/. % % This code was inspired by the reversing macro in Donald E. Knuth and % Pierre MacKay, ``Mixing right-to-left texts with left-to-right texts'', % TUGboat 8(1)14-25 (1987) and the LaTeX \verb macro. % \catcode`\|=\active% \def|#1|{\catcode`\@=11\catcode`\%=12 {\tt \pathname#1\empty\emanhtap}% \catcode`\@=12\catcode`\%=14}% %\def|#1|{{\tt \pathname#1\empty\emanhtap}}% % \def\pathname#1#2\emanhtap{% \ifx#1\empty% \else% \ifx#1.% \-#1% \else% \ifx#1/% \-#1% \else% \ifx#1@% \-#1% \else% \ifx#1!% \-#1% \else% \ifx#1\%% \-#1% \else% #1% \fi% \fi% \fi% \fi% \fi% \pathname#2\emanhtap% \fi}%