3

I know that the TeXbook says : "boundary ligatures are automatically disabled in math mode". But I'd like to know if this behaviour can be bypassed.

I am creating an environment in order to copy my (young) students' works. For that purpose, I use the frcursive package. But the problem is that, in math mode, the letters are partially displayed because of the boundary ligatures the font designer used in his METAFONT's font files.

As you can see with the ECM below, TeX renders perfectly ligatures between letters in both text and math modes, but boundary ligatures only in text mode. Oddly, the right boundary ligature is displayed correctly for the letter a juste before the closing parenthesis...

Thanks in advance if you could help me.

Fab.

(Sorry for my english speaking, french inside)

ECM

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{frcursive}

\DeclareMathVersion{cursiveMath}

% Initialize cursive fonts with default ones
\DeclareSymbolFont{cursiveOperators}{OT1}{cmr}{m}{n}
\DeclareSymbolFont{cursiveLetters}{OML}{cmm}{m}{it}

% Modification of cursive fonts for the "cursiveMath" version
\SetSymbolFont{cursiveOperators}{cursiveMath}{T1}{frc}{m}{n}
\SetSymbolFont{cursiveLetters}{cursiveMath}{T1}{frc}{m}{n}

% Some new symbols
\DeclareMathSymbol{a}{\mathalpha}{cursiveLetters}{`a}
\DeclareMathSymbol{b}{\mathalpha}{cursiveLetters}{`b}
\DeclareMathSymbol{m}{\mathalpha}{cursiveLetters}{`m}
\DeclareMathSymbol{r}{\mathalpha}{cursiveLetters}{`r}
\DeclareMathSymbol{s}{\mathalpha}{cursiveLetters}{`s}

\DeclareMathSymbol{2}{\mathalpha}{cursiveOperators}{`2}
\DeclareMathSymbol{,}{\mathpunct}{cursiveOperators}{`,}

\DeclareMathSymbol{(}{\mathopen}{cursiveLetters}{`(}
\DeclareMathSymbol{)}{\mathclose}{cursiveLetters}{`)}


\begin{document}

\cursive
\mathversion{cursiveMath}
\begin{center}
    Test with {\slshape frcursive}
\end{center}

\bigskip
\underline{Text mode:}

\smallskip
\qquad a, b, m, r, s


\vspace{20pt}
\underline{Math mode:}

\medskip
\qquad $ab^2 + ba^2 = ab (b + a)$

\smallskip
\qquad $mr^2 + sm^2 = rs^2$

\end{document}
  • Welcome to TeX.SX! Unfortunately you can do nothing about it because, as you said, boundary ligatures are disabled. The one you think is used is actually due to the parenthesis being in the same font, so the a is not at a boundary. If you want to use a letter, define \newcommand{\cl}[1]{\textup{#1}} after loading amsmath. Then \cl{ma} would use text mode and boundary ligatures. – egreg May 11 '16 at 11:45
  • Thanks for your answer. I was afraid to read your statement and was really hoping that a bit of magic TeX could modify the default behaviour (even if, as often with the TeXbook, things are pretty clear in it !). The primitive \noboundary doesn't have a positive version... snif I thought about using macros too ; see comment in David Carlisle's answer. – F... May 12 '16 at 18:49
1

As this is presumably only for relatively simple math you could keep in text mode but fake the math. In practice you might want to limit these definitions to a defined environment as for example the fontdimen settings mean that spaces are ignored.

enter image description here

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{frcursive}

\DeclareMathVersion{cursiveMath}

% Initialize cursive fonts with default ones
\DeclareSymbolFont{cursiveOperators}{OT1}{cmr}{m}{n}
\DeclareSymbolFont{cursiveLetters}{OML}{cmm}{m}{it}

% Modification of cursive fonts for the "cursiveMath" version
\SetSymbolFont{cursiveOperators}{cursiveMath}{T1}{frc}{m}{n}
\SetSymbolFont{cursiveLetters}{cursiveMath}{T1}{frc}{m}{n}

% Some new symbols
\DeclareMathSymbol{a}{\mathalpha}{cursiveLetters}{`a}
\DeclareMathSymbol{b}{\mathalpha}{cursiveLetters}{`b}
\DeclareMathSymbol{m}{\mathalpha}{cursiveLetters}{`m}
\DeclareMathSymbol{r}{\mathalpha}{cursiveLetters}{`r}
\DeclareMathSymbol{s}{\mathalpha}{cursiveLetters}{`s}

\DeclareMathSymbol{2}{\mathalpha}{cursiveOperators}{`2}
\DeclareMathSymbol{,}{\mathpunct}{cursiveOperators}{`,}

\DeclareMathSymbol{(}{\mathopen}{cursiveLetters}{`(}
\DeclareMathSymbol{)}{\mathclose}{cursiveLetters}{`)}


\begin{document}

\cursive
\mathversion{cursiveMath}
\begin{center}
    Test with {\slshape frcursive}
\end{center}

\bigskip
\underline{Text mode:}

\smallskip
\qquad a, b, m, r, s


\vspace{20pt}
\underline{Math mode:}

\medskip
\qquad $ab^2 + ba^2 = ab (b + a)$

\smallskip
\qquad $mr^2 + sm^2 = rs^2$

\vspace{20pt}
\underline{New Not Math mode:}

\catcode`\^\active
\let^\textsuperscript

\catcode`\+\active
\edef+{${}\string+{}$}

\catcode`\=\active
\edef={${}\string={}$}

\fontdimen2\font0pt
\fontdimen3\font0pt
\fontdimen4\font0pt
\fontdimen7\font0pt

\medskip
\qquad ab^2 + ba^2 = ab (b + a)

\smallskip
\qquad mr^2 + sm^2 = rs^2

\end{document}
  • Thanks for your answer. Unfortunately, I need some more maths, like fractions, roots, etc. (my students are up to GCSE, or grade 9), so it will be a lot of work to make active (or create) all the symbols I may need, with right spacing and everything else. – F... May 12 '16 at 18:49
  • I thought about making active all lower case letters in order to automatically wrap them into \text{} but I loose the ligatures between letters, and the exponents are too high... And more things may need adjustments... I managed to test if next char is active too (I considered it as a argument) but one single \text{} can't contain them all (only got multiple nested \text{})... Still searching... – F... May 12 '16 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.