[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

radical thoughts



Hello,

I have thought about an uglyness in our current proposal for
the extensible encoding MXP: The text/script/scriptscript
ratio is fixed, since we include the small radicals. I have 
worked on some ideas how we could avoid this while still 
being able to load the extensible font in only one size. 

You can find a first sketch for such an implementation
of \sqrt in the document below. It works, as far as I could
see from some tests. Of course it needs some extension
(integration with NFSS, the optional argument, etc). 
But before I continue to investigate this I'd like to 
hear your opinion on this. Is it a viable alternative to
our current proposal ?

Regards, Matthias

------------------


\documentclass[preprint]{ltugboat}
\usepackage{shortvrb}

\overfullrule0pt

\title{How many sizes of radicals do we need?}
\author{Matthias Clasen}
\address{%
  Albert-Ludwigs-Universit{\"a}t Freiburg\\
  Institut f{\"u}r Mathematische Logik\\
  D-79104 Freiburg, Germany}
\netaddress{clasen@mathematik.uni-freiburg.de}
\def\rtitlex{MFG discussion document}
\def\midrtitle{{\sl Task 3: Technical Studies\/}}
\setcounter{page}{1}

\makeatletter
\def\fsqrt#1{{\mathpalette\@fsqrt{#1}}}
\def\@fsqrt#1#2{%
  % set #2 in cramped style #1
  \setbox0=\hbox{%
     \nulldelimiterspace=0pt
     $\m@th#1\radical0{#2}$}%
  % remove the extra vertical space
  % added by \radical
  \ifx#1\displaystyle 
     \dimen0=\fontdimen8\textfont3
     \advance\dimen0 .25\fontdimen5\textfont2
  \else \dimen0=1.25\fontdimen8
     \ifx#1\textstyle \textfont
     \else \ifx#1\scriptstyle \scriptfont
           \else \scriptscriptfont
           \fi
     \fi 3 
  \fi
  \advance\dimen0-\ht0 \ht0=-\dimen0 
  % add the radical, using exscale locally
  \setbox1=\hbox{%
     $\m@th\exsc@le#1\fsqrtsign{\box0}$}%
  \box1\relax}
\DeclareFontFamily{U}{fsym}{}
\DeclareFontShape{U}{fsym}{m}{n}{<->sfixed*cmsy10}{}
\DeclareSymbolFont{fsym}{U}{fsym}{m}{n}
\DeclareMathRadical{\fsqrtsign}{fsym}{"70}{largesymbols}{"70}
\DeclareMathSymbol{\afsym}{\mathord}{fsym}{3}
\font\fsyten=cmsy10
\font\fsyseven=cmsy7
\font\fsyfive=cmsy5
\def\exsc@le{%
 \textfont\symfsym=\fsyten
 \scriptfont\symfsym=\fsyseven
 \scriptscriptfont\symfsym=\fsyfive
}


\begin{document}
\maketitle

\section{The current approach}

In his ``Technical Report on Math Font Encoding'', Justin Ziegler
states that 
\begin{quote}
  The present \texttt{cmsy} font contains one glyph that is set in a
  strange way --- the radical sign, and thus makes that whole font
  unusable for the outer world. It would be a good idea to make sure
  that this does not happen again. 

  \dots [\texttt{cmsy}] has always been loaded in three sizes, and must remain
  so. If it [the radical] is taken out of \texttt{cmsy}, and put in a \texttt{cmex}
  replacement, then this point must be taken into consideration.
\end{quote}
And he comes to the conclusion that  
\begin{quote}
  If the new \texttt{cmex} is loaded in one size, it must contain
  three different sizes of the radical in order to stay compatible
  with plain.
\end{quote}
This makes script and scriptscript sizes of the radical available even
if the MXP-encoded font is loaded in only one size. But it has the very ugly
side effect of fixing the text/script/scriptscript size ratios, i.\,e.\ a
MXP-encoded font designed for 10\,pt / 7\,pt / 5\,pt will not be usable with
e.\,g.\ 10\,pt / 8\,pt / 6\,pt. 

\section{A new approach}

If we assume that loading three sizes of the MXP-encoded font will be the
normal situation and loading one size will only be necessary for 
compatibility with old documents, then the cleaner solution would be to put
only a textsize radical into MXP.

I claim that we can do this and still enable loading one size. The idea is to 
use three sizes \emph{locally} for radicals. The following macros are my
first try at such a solution, inspired by some old macros to set math material
in cramped style:

\begin{verbatim}
\def\fsqrt#1{{\mathpalette\@fsqrt{#1}}}
\def\@fsqrt#1#2{%
  % set #2 in cramped style #1
  \setbox0=\hbox{%
     \nulldelimiterspace=0pt
     $\m@th#1\radical0{#2}$}%
  % remove the extra vertical space
  % added by \radical (see appendix G)
  \ifx#1\displaystyle 
     \dimen0=\fontdimen8\textfont3
     \advance\dimen0 .25\fontdimen5\textfont2
  \else \dimen0=1.25\fontdimen8
     \ifx#1\textstyle \textfont
     \else \ifx#1\scriptstyle \scriptfont
           \else \scriptscriptfont
           \fi
     \fi 3 
  \fi
  \advance\dimen0-\ht0 \ht0=-\dimen0 
  % add the radical, using exscale locally
  \setbox1=\hbox{%
     $\m@th\exsc@le#1\fsqrtsign{\box0}$}%
  \box1\relax}
\end{verbatim}
The macro \cs{exsc@le} has to change the font allocations for the family  
from which we take the \cs{fsqrtsign} to use three sizes. 

\section{An example}

My simple test version of \cs{exsc@le} (ignoring NFSS) used in this 
document is:  
\begin{verbatim}
\font\fsyten=cmsy10
\font\fsyseven=cmsy7
\font\fsyfive=cmsy5
\def\exsc@le{%
 \textfont\symfsym=\fsyten
 \scriptfont\symfym=\fsyseven
 \scriptscriptfont\symfsym=\fsyfive}
\end{verbatim}
For demonstration purposes within this document,
I take the \cs{fsqrtsign} from a symbol font containing  
only one size of \texttt{cmsy}: 
\begin{verbatim}
\DeclareFontFamily{U}{fsym}{}
\DeclareFontShape{U}{fsym}{m}{n}
   {<->sfixed*cmsy10}{}
\DeclareSymbolFont{fsym}{U}{fsym}{m}{n}
\DeclareMathRadical{\fsqrtsign}
   {fsym}{"70}{largesymbols}{"70}
\end{verbatim}
Now compare 
\[\sqrt{*}^{\sqrt{*}^{\sqrt{*}}}\sqrt{*^{*^*}}*^{*^*}
  \quad\textrm{(using \cs{sqrt})}\]
\[\fsqrt{*}^{\fsqrt{*}^{\fsqrt{*}}}\fsqrt{*^{*^*}}*^{*^*}
  \quad\textrm{(using \cs{fsqrt})}\]
\[\fsqrt{\afsym}^{\fsqrt{\afsym}^{\fsqrt{\afsym}}}
  \quad\textrm{(using \cs{fsqrt}, * from \texttt{fsym})}\]
I'd very much like to hear your opinions on the practicability of this
approach. 

\makesignature
\end{document}






-- 
Matthias Clasen, 
Tel. 0761/203-5606
Email: clasen@mathematik.uni-freiburg.de
Institut fuer Mathematik, Albert-Ludwigs-Universitaet Freiburg