6

This question is general, but arises because I am using Times fonts; in CM, I would not make these changes. In CM, delimiters have a height that is larger than that of a capital letter, whereas in Times, the heights are the same.

I want the ordinary delimiters, such as ()[]|\|\{\}\langle\rangle, to be from the same font they already come from, just 1pt larger than normal. When it is a macro, this is not too hard since I can redefine it. This leaves just |, I think.

My constraints are the following (this is being used in a 720-page book that is already written, so some things are fixed): It should be (e)plain tex. I don't want to make any of these characters active, as they might cause problems for some macros (of which I have many). I don't mind using a new family, but would prefer not to use 2 new families. I do have a scratch family that I use for symbols that are defined via a macro; that family can change to any font at any time in an \hbox. I don't want to replace all occurrences of delimiters by macros. Also, I do not want to change the delimiters when they come from the extension font (like \big(). No doubt I could create new fonts, but I don't know how to do that, nor do I know how to install them; further, it would make it harder for others (such as my co-author) to TeX the book files.

Note that ()[] come from the rm font, whereas the others come from the sy font.

To handle the former, I can use the following, after building a new family that is simply the existing rm family but 1pt larger (which seems wasteful, but works):

\multiply\buildfam by "100 

\count255=\mathcode`(
\advance\count255 by \buildfam
\mathcode`(=\count255
\count255=\mathcode`)
\advance\count255 by \buildfam
\mathcode`)=\count255
\count255=\mathcode`[
\advance\count255 by \buildfam
\mathcode`[=\count255
\count255=\mathcode`]
\advance\count255 by \buildfam
\mathcode`]=\count255

I could do a similar thing for the other symbols, but that would require a new family.

Even so, this works only in mathmode; that's an acceptable limitation, but not perfect.

The following shows how things look in roman (unchanged in the first two and changed in the third):

enter image description here

For comparison, here's how CM looks unchanged:

enter image description here

As an alternative, I would be happy to raise the axis for these delimiters (indeed, using a larger font does raise the axis), but changing \fontdimen22 is taken into account only for ex fonts (in mathmode) and would also change the axis of other symbols. (CM's delimiters have a larger depth than those of Times to make up for their larger height, in order to keep the axis the same.)

I would also like to do the same with the delimiter /, but that is in yet a 3rd font, mi.

I discovered that I can use \mathcode="8000 to make characters active only in math mode. This seems to avoid any problems with macros, at least so far. Furthermore, I do not need to create any new font families, even in scratch. E.g., I can do the following:

\def\hboxmathit#1#2{\hbox{$#1#2$}}
{\catcode`|=\active
\gdef|{{\mathpalette\hboxmathit{\biggersize\vert}}}}
\mathcode`|="8000

Here, I have font environments, like \tenpoint, \ninepoint, \elevenpoint, already defined (sometimes I want to change the overall font sizes), and have a macro \biggersize that simply increases the font environment by 1. In the present case, I put the whole thing in an extra layer of grouping since it can appear as an argument to \mathopen. It works even after \big, though I don't know why.

However, I cannot figure out how to do something similar with \langle so that it works after \big. It seems that expansion of a \mathcode"8000 character occurs at a different time than that of a macro. For example, \big|, using the simpler definition

\gdef|{{\hbox{$\biggersize\vert$}}}}

expands as follows:

\big #1->{\hbox {$\left #1\vbox to8.5pt{}\right .\n@space $}}
#1<-|

\n@space ->\nulldelimiterspace \z@ \m@th 

\m@th ->\mathsurround \z@ 

|->{\hbox {$\biggersize \vert $}}

...

\vert ->\delimiter "26A30C 

On the other hand, if I try $\big{{\hbox{$\biggersize\vert$}}} X|$, then it expands with a missing delimiter:

\big #1->{\hbox {$\left #1\vbox to8.5pt{}\right .\n@space $}}
#1<-{\hbox {$\biggersize \vert $}}

! Missing delimiter (. inserted).
<to be read again> 
                   {
<argument> {
            \hbox {$\biggersize \vert $}}
\big #1->{\hbox {$\left #1
                          \vbox to8.5pt{}\right .\n@space $}}
l.183 $\big{{\hbox{$\biggersize\vert$}}}
                                         X|$
? r
  • Very related, perhaps even duplicate: tex.stackexchange.com/questions/276819/… – Henri Menke Dec 6 '15 at 10:59
  • Also, you have the choice: Either you allocate additional families for all the glyphs you'd like to replace, or you edit the font itself. TeX will only load the fonts from the tfm files, adjusting the shapes of the glyphs is thus not only impossible but also beyond the scope of TeX. – Henri Menke Dec 6 '15 at 11:06
  • You could apply some \pdfliteral trickery though to modifiy the glyph shapes. This would then involve making the characters active or replacing them by a macro. tex.stackexchange.com/questions/135783/make-math-symbol-italic/… – Henri Menke Dec 6 '15 at 11:08
  • @HenriMenke Indeed, I myself asked that first question (tex.stackexchange.com/questions/276819/…) and I thus would know how to use (a simpler version of) such a solution for the delimiters that are macros. I did not know of pdfliteral; it sounds interesting, but still has the disadvantage of making the characters active or replacing them by a macro, as you say. – Russ Lyons Dec 6 '15 at 14:04
  • @HenriMenke I was wrong (see my edited question): Since I am working with delimiters here, even though they may be macros, they need to work with such prefixes as \big, and I have not figured out how to do that. – Russ Lyons Dec 7 '15 at 3:51
3

This answer has 3 parts.

Part 1

For my original purpose, this whole endeavor was not needed since, in fact, the Times fonts I am using do have slightly larger delimiters; they are simply in different places than I knew. Thus, it suffices to redefine them all.

Part 2

Nevertheless, here's how to achieve the remaining delimiters that I did not see how to do in the question.

It works to set up a new character, say, ^^B, for \langle in parallel with | and then to define \langle to be ^^B. Thus:

\def\hboxmath#1#2{\hbox{$#1#2$}}
{\catcode`|=\active
\gdef|{{\mathpalette\hboxmath{\biggersize\vert}}}}
\mathcode`|="8000

\let\oldlangle=\langle

{\catcode`^^B=\active
\gdef^^B{{\mathopen{\mathpalette\hboxmath{\biggersize\oldlangle}}}}}
\catcode`^^B=12
\delcode`^^B="26830A
\mathcode`^^B="8000

\def\langle{^^B}

\let\oldrangle=\rangle

{\catcode`^^C=\active
\gdef^^C{{\mathclose{\mathpalette\hboxmath{\biggersize\oldrangle}}}}}
\catcode`^^C=12
\delcode`^^C="26830B
\mathcode`^^C="8000

\def\rangle{^^C}

The same method works for \{ and \}.

All these changes can affect radicals (such as \sqrt) by giving the atom inside a larger height and depth. TeX does not always set radicals well anyway, especially in displaystyle, where too much can be added to the height. (The issue arises because the extension font can extend only in discrete increments.) The following fix is not perfect, but adjusts for the changes due to the above. (See Rule 11 in Appendix G of the TeXbook, where in style D and D' only, (1/4)\fontdimen5\textfont2 is added to a height instead of (1/4)\fontdimen8\textfont3 that would otherwise be added.) It seems to work well.

\def\smftd{\dimen0=\fontdimen5\textfont2 \advance\dimen0 by
-2\fontdimen8\textfont3 \fontdimen5\textfont2=\dimen0 }
\def\rsftd{\dimen0=\fontdimen5\textfont2 \advance\dimen0 by
2\fontdimen8\textfont3 \fontdimen5\textfont2=\dimen0 }

\let\oldsqrt=\sqrt
\def\sqrt#1{\mathchoice
   {\setbox0=\hbox{$\displaystyle #1$}\smftd
   \hbox{$\displaystyle \oldsqrt{\box0}$}\rsftd }
   {\oldsqrt{#1}}
   {\oldsqrt{#1}}
   {\oldsqrt{#1}}
   }

Part 3

Regardless which solution is taken, or even in CM, as I wrote, TeX does not always set radicals well. This seems inevitable since the extension font is discrete. A trade-off between the height and the depth can improve looks, however.

Such fine tuning is made more quickly by using the following, which is useful even in CM:

\def\updown#1#2#3{\vrule width0pt height #1 pt depth #2 pt \smash{#3}}

For example, \sqrt{\updown{7.5}{3.5}{1 - \Phi_E^2}}.

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.