%% Save file as: HEX.STY Source: FILESERV@SHSU.BITNET %% From: domen@euler.crin.fr (Eric Domenjoud) %% Date: 7 Oct 91 14:07:20 GMT %% Organization: CRIN, Nancy, France %% \documentstyle[....,hex,....]{......} %% %% \hex{ctr} gives then the value of ctr in hexadecimal. If you want lowercase %% letters, just change A,B,C,D,E,F to lowercase in the definition below. %------------------------------------------------------- \newcount\@decnum \newcount\@digit \def\@hex#1{{\@decnum=#1 \ifnum\@decnum>15 \@digit=\@decnum \divide\@decnum 16 \@hex\@decnum \multiply\@decnum -16 \advance\@decnum\@digit \fi \ifnum\@decnum=10 A\else \ifnum\@decnum=11 B\else \ifnum\@decnum=12 C\else \ifnum\@decnum=13 D\else \ifnum\@decnum=14 E\else \ifnum\@decnum=15 F\else \number\@decnum\fi\fi\fi\fi\fi\fi}} \def\hex#1{\@hex{\nameuse{c@#1}}}