%D \module
%D   [       file=symb-mis,
%D        version=2002.05.07,
%D          title=\CONTEXT\ Symbol Libraries,
%D       subtitle=Miscelaneous,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\unprotect

%D We predefine some common symbols and conversions that will
%D be understood by many commands.

% \mathematics no longer needed, although only math fonts might have these

\definesymbol [\v!none]   []
\definesymbol [bullet]    [\mathematics{\bullet}]
\definesymbol [dash]      [\mathematics{-}]
\definesymbol [star]      [\mathematics{\star}]
\definesymbol [triangle]  [\mathematics{\triangleright}]
\definesymbol [circle]    [\mathematics{\circ}]
\definesymbol [square]    [\mathematics{\square}]
\definesymbol [diamond]   [\mathematics{\diamond}]

\definesymbol [smallcircle] [\hbox{\raise.1ex\hbox{\mathematics{\scriptscriptstyle\bigcirc}}}]
\definesymbol [medcircle]   [\hbox{\raise.1ex\hbox{\mathematics{\scriptstyle      \bigcirc}}}]
\definesymbol [bigcircle]   [\mathematics{\bigcirc}]

\definesymbol [1] [\symbol{bullet}]
\definesymbol [2] [\symbol{dash}]
\definesymbol [3] [\symbol{star}]
\definesymbol [4] [\symbol{triangle}]
\definesymbol [5] [\symbol{circle}]
\definesymbol [6] [\symbol{medcircle}]
\definesymbol [7] [\symbol{bigcircle}]
\definesymbol [8] [\symbol{square}]

%D Special hyperlinks, namely those to pages or navigational
%D properties, are associated with symbols.

\definesymbol [\v!firstpage]       [\gotobegincharacter]
\definesymbol [\v!previouspage]    [\gobackwardcharacter]
\definesymbol [\v!nextpage]        [\goforwardcharacter]
\definesymbol [\v!lastpage]        [\gotoendcharacter]
\definesymbol [\v!firstsubpage]    [\gotobegincharacter]
\definesymbol [\v!previoussubpage] [\gobackwardcharacter]
\definesymbol [\v!nextsubpage]     [\goforwardcharacter]
\definesymbol [\v!lastsubpage]     [\gotoendcharacter]
\definesymbol [\v!PreviousJump]    [\gobackjumpcharacter]
\definesymbol [\v!NextJump]        [\goforjumpcharacter]
\definesymbol [\v!CloseDocument]   [\closecharacter]

\definesymbol [\v!first]           [\symbol{\v!firstpage}]
\definesymbol [\v!previous]        [\symbol{\v!previouspage}]
\definesymbol [\v!next]            [\symbol{\v!nextpage}]
\definesymbol [\v!last]            [\symbol{\v!lastpage}]
\definesymbol [\v!somewhere]       [\gotosomewherecharacter]
\definesymbol [\v!nowhere]         [\gonowherecharacter]

\definesymbol [\v!backward]        [\symbol{\v!previouspage}]
\definesymbol [\v!forward]         [\symbol{\v!nextpage}]

%D The next two symbols (\symbol[P] and \symbol[S]) are
%D variations in their math counterparts. The following ones
%D {\em do} scale.

% todo : hook this into \textsection

\definesymbol [S] [\getglyph{MathSymbol}{\char"78}]
\definesymbol [P] [\getglyph{MathSymbol}{\char"7B}]

%D These symbols are taken from the Computer Moders Roman
%D symbol set or, when present, from the additional symbols of
%D the American Mathematical Society. Of course one can use
%D his or her own symbols by redefining them.

\def\dogotocharacter#1#2#3%
  {\ifx#1\undefined#2\else#3\fi}

\def\gotobegincharacter
  {\hbox
     {\dogotocharacter\blacktriangleleft
        {\setbox0\hbox{\mathematics{\triangleleft}}%
         \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0
         \kern-.11ex\box0}
        {\setbox0\hbox{\mathematics{\blacktriangleleft}}%
         \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}%
         \hbox{\lower.03ex\box2\kern-.35ex\box0}}}}

\def\gotoendcharacter
  {\hbox
     {\dogotocharacter\blacktriangleright
        {\setbox0\hbox{\mathematics{\triangleright}}%
         \copy0\kern-.11ex
         \vrule\!!width.085ex\!!height1.075\ht0\!!depth\dp0}
        {\setbox0\hbox{\mathematics{\blacktriangleright}}%
         \setbox2\hbox{\vrule\!!height\ht0\!!depth\dp0\!!width.25ex}%
         \hbox{\box0\kern-.35ex\lower.03ex\box2}}}}

\def\gobackwardcharacter
  {\mathematics{\dogotocharacter\blacktriangleright\triangleleft\blacktriangleleft}}

\def\goforwardcharacter
  {\mathematics{\dogotocharacter\blacktriangleright\triangleright\blacktriangleright}}

\def\gonowherecharacter
  {\mathematics{\bullet}}

\def\gotosomewherecharacter
  {{\hbox{\hsmash{\symbol[\v!previous]}\symbol[\v!next]}}}

\unexpanded\def\closecharacter
  {\dogotocharacter\boxtimes
     {\ruledhbox{\mathematics{\times}}}
     {\mathematics{\boxtimes}}}

\def\goforjumpcharacter
  {\hbox{\goforwardcharacter \kern-.5em\goforwardcharacter}}

\def\gobackjumpcharacter
  {\hbox{\gobackwardcharacter\kern-.5em\gobackwardcharacter}}

%D The next two symbols are for Daniel Flipo:

\ifx\high          \undefined \let\high          \firstofoneargument \fi % todo
\ifx\notsmallcapped\undefined \let\notsmallcapped\firstofoneargument \fi % todo

\definesymbol [Numero] [N\high{\notsmallcapped{o}\kern.2em}]
\definesymbol [numero] [n\high{\notsmallcapped{o}\kern.2em}]

\def\Numero{\symbol[Numero]}
\def\numero{\symbol[numero]}

\protect \endinput
