Skip to content

@khaledhosny /sscript.tex

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
%% the following is needed for the stolen code to work
\def\fontexheight{\fontdimen5 }
\def\mathsubnormal{\fontdimen16 }
\def\mathsupnormal{\fontdimen14 }
%% below, almost, unchanged ConTeXt code
%D \macros
%D {low, high, lohi}
%D Although \TEX\ is pretty well aware of super- and
%D subscripts, its mechanism is mainly tuned for math mode.
%D The next few commands take care of script texts both modes.
%D \startbuffer
%D The higher\high{one goes} the lower\low{one drops}, or\lohi{yes}{no}?
%D \stopbuffer
%D \typebuffer
%D \getbuffer
%D Note the different placement of \type {\lohi}, where we
%D need a bit more space. The implementation looks a bit
%D fuzzy, since some \type {\fontdimen}'s are involved to
%D determine the optimal placement.
\ifnum\fam<0 \tx \else \holamathfont \fi
\def\dohighlow#1#2#3#4#5% todo, named fontdimens
\scratchdimen\ifdim\fontexheight\textfont2=1ex #2\textfont2\else #3ex\fi
\advance\scratchdimen #4ex
\unexpanded\def\low {\dohighlow\lower\mathsubnormal{.48}{0}}
% \unexpanded\def\lohi#1#2%
% {\dontleavehmode
% \hbox
% {\setbox4=\hbox{\dohighlow\lower\mathsubnormal{.48}{.1}{#1}}%
% \setbox6=\hbox{\dohighlow\raise\mathsupnormal{.86}{.1}{#2}}%
% \ifdim\wd4<\wd6
% \wd4=\zeropoint\box4\box6
% \else
% \wd6=\zeropoint\box6\box4
% \fi}}
\setbox4\hbox to \wd6{\hss\box4}%
\setbox6\hbox to \wd4{\hss\box6}%
%D You can provide an optional keyword \type {left}, in which
%D case the super and subscripts will be aligned in a way that
%D permits placement at the left of a word (which means that
%D it will be right aligned).
%D \startbuffer
%D \lohi{aha}{ah} test \lohi{aha}{ah} test
%D \lohi[left]{aha}{ah} test \lohi[left]{aha}{ah} test
%D \lohi{aha}{ah} test\lohi{aha}{ah} test
%D \lohi[left]{aha}{ah}test \lohi[left]{aha}{ah}test
%D \stopbuffer
%D \typebuffer
%D \getbuffer
%% test
A\low{xy} A\high{xy}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.