%%% snip %%% hyparen.sty %%% snip %%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{hyparen}[1998/11/27 v2.0 % Fix for writing unmatched parentheses (HO)] \@ifundefined{Hy@PDFDef}{% \PackageError{hyparen}{Package 'hyperref' not loaded}{% Load 'hyperref' first (version >= 6.42).}% }{} \let\hp@org@Hy@PDFDef\Hy@PDFDef \def\Hy@PDFDef#1#2{% \hp@org@Hy@PDFDef#1{#2}% \ifx#1\@empty \else \hp@FixUnmachtedBraces#1% \fi } \begingroup \catcode`\|=0 \catcode`\\=12 % #1: command with string to be defined |global|def|hp@FixUnmachtedBraces#1{% % the redefinings of the escapechar glyph are needed, % in order to distinguish between "\\\(" and "\\(". % % * short form: (, ) to \(, \) %|hp@DefExchangedChars{\\}{\134}#1% %|hp@DefExchangedChars({\(}#1% %|hp@DefExchangedChars){\)}#1% %|hp@DefExchangedChars{\134}{\\}#1% % % * long form: only unmachted (, ) to \(, \) % \(, \), (, ) to \050, \051 |hp@DefExchangedChars{\\}{\134}#1% |hp@DefExchangedChars{\(}{\050}#1% |hp@DefExchangedChars{\)}{\051}#1% |hp@DefExchangedChars({\050}#1% |hp@DefExchangedChars){\051}#1% % matching \050...\051 to (...) |hp@DefReplacePairs{\050}{\051}#1% % octals to the escaped short ones |hp@DefExchangedChars{\050}{\(}#1% |hp@DefExchangedChars{\051}{\)}#1% |hp@DefExchangedChars{\134}{\\}#1% } |endgroup % replace #1 by #2 % #3: Command with string to be defined \def\hp@DefExchangedChars#1#2#3{% \def\hp@temp##1#1##2\END{% ##1% \ifx\\##2\\% \else \hp@ReturnAfterFi{% #2% \hp@temp##2\END }% \fi } \protected@edef#3{\expandafter\hp@temp#3#1\END} } % #1: \050 % #2: \051 % #3: Command with string to be defined \def\hp@DefReplacePairs#1#2#3{% \def\hp@temp##1#1##2#2##3\END{% ##1% \ifx\\##2##3\\% \else \hp@ReturnAfterFi{% \ifx\\##3\\% \hp@ReturnAfterElseFi{% #1% \hp@temp##2#2\END }% \else \hp@ReturnAfterFi{% (% \hp@temp##2)##3\END }% \fi }% \fi } \protected@edef#3{\expandafter\hp@temp#3#1#2\END} } \def\hp@ReturnAfterFi#1\fi{\fi#1} \def\hp@ReturnAfterElseFi#1\else#2\fi{\fi#1} \endinput %%% snip %%% hyparen.sty %%% snip %%%