[tug-summer-of-code] A couple of project proposals

Scott Pakin scott at pakin.org
Sat Jul 4 20:41:57 CEST 2009


Daniel,

> I am working on a solution now and I think I have almost understood
> what is needed. From what I have seen so far for a particular symbol I
> need to know
>
> package,
> \command,
> fontenc
> and if it is made for math mode.

How about the number and type of arguments \command takes?

> The last point is something I have problems with. How do I know which
> symbols work in math mode and which don't? My understanding so far is
> that there are some latex2e and ams symbols that work in both math an
> text mode and the rest of the symbols is either math or text mode.
> Math mode symbols are the ones from section 3 of the comprehensive
> symbols list and all the others are text mode.
> What bothers me most is that non math mode symbols will get rendered
> without an error in math mode but the outcome is not as desired (so I
> can't find out programmatically).

I don't believe it's possible in the general case to determine
automatically if a given macro produces a text-mode or math-mode
symbol (or either).  Going by "Section 3 = math; non-Section 3 = text"
in the CLSL might not be such a bad way to start.  Another possibility
is to look at how each symbol is defined in its .sty file.
\DeclareMathSymbol, \DeclareMathDelimiter, \DeclareMathAccent, and
\DeclareMathRadical, and even the primitive \mathchar give you plenty
of information.  Text symbols exhibit more variety in definition,
unfortunately, but you may be able to assume that if a symbol isn't
clearly math, then it's probably text.  Yet another possibility is to
trace the use of a symbol.  Build a little LaTeX document (using
-interaction=nonstopmode, just in case) that loads a package and
places a symbol, maybe somewhat like this:

    \documentclass{article}
    \usepackage{<SOME PACKAGE>}
    \begin{document}

    \[
    \tracingmacros=2
    \typeout{BEGIN SYMBOL TEST}
    <SOME SYMBOL>
    \typeout{END SYMBOL TEST}
    \tracingmacros=0
    \]

    \end{document}

Then search the log file for the macro expansions between the "BEGIN
SYMBOL TEST" and "END SYMBOL TEST" lines.  If "math" occurs, then
<SOME SYMBOL> is likely to be a math symbol; if not, it's likely to be
a text symbol.

Whatever approach you end up taking will certainly require some manual
effort to verify the results.

-- Scott

P.S.  Another useful set of symbols to include would be a
blackboard-bold font (especially the uppercase letters and the digit
"1").  Most people resort to creative ways to describe what they're
looking for because they don't know the term "blackboard bold".


More information about the summer-of-code mailing list