groff
[Top][All Lists]
Advanced

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

Re: [Groff] computer modern fonts in EQN with Tps?


From: Tadziu Hoffmann
Subject: Re: [Groff] computer modern fonts in EQN with Tps?
Date: Mon, 10 Mar 2008 10:46:19 +0100
User-agent: Mutt/1.5.16 (2007-06-09)

> [...] is it possible to switch the ``mathematical fonts'' to
> computer modern fonts shipped by TeX and how?

You can tell eqn which fonts to use with the "gfont", "grfont",
and "gbfont" commands (see eqn manual page).

> [...] to just typeset formulas in CM fonts and let other parts
> in Times.

I strongly recommend against doing this (using Computer Modern for
the math and Times for the body text).  This is what the "times"
package for LaTeX did, and the results were never very good.
(Now LaTeX has the "txfonts" package, which sets both math and body
text in Times (and has greek characters that integrate quite nicely
with the rest) and results in a much more pleasing appearance.)
Computer Modern and Times are just too different to work well
together.

(Of course, if you're just talking about using individual characters
from Computer Modern which are not available in other fonts, then I
agree that having a character from another font is better than not
having the character at all.)


It's actually quite straightforward to make Computer Modern available
to groff once you understand how the different parts work together.
Here's a step-by-step description of what to do.  I just tried this
out, and unless I've forgotten to write something down, this should
mostly work as-is.  (Nevertheless, you may need to experiment and
improvise at some places).


Recipe:

Chose appropriate directories for the font description and font files.
For the following discussion I will refer to them as

  GROFF_FONT_PATH (usually something like /usr/share/groff/current/font,
                  but I have mine in $HOME/lib/roff/font)
  PSDITDIR        (this will then be $GROFF_FONT_PATH/devps)
  PFADIR          (for the font files themselves)
  AFMDIR          (for the font metrics)

If you have a non-standard $PSDITDIR, also copy the "DESC", "prologue",
and "download" files and the "generate" subdirectory into it.

Obtain the computer modern fonts.  You'll probably get a pfb and an
afm file for each.  Put the afm files into $AFMDIR.  Convert the pfb
files to pfa using "pfatops" from the groff distribution.  Put the pfa
files into $PFADIR.  Add an appropriate line in your $PSDITDIR/download
file for each font (pointing to the file in $PFADIR).

Generate the font description files using "afmtodit" from the groff
distribution. For example,

  afmtodit -e $PSDITDIR/generate/text.enc -d $PSDITDIR/DESC \
    $AFMDIR/CMR10.afm $PSDITDIR/generate/textmap $PSDITDIR/CMR10

  afmtodit -i 50 -e $PSDITDIR/generate/text.enc -d $PSDITDIR/DESC \
    $AFMDIR/CMTI10.afm $PSDITDIR/generate/textmap $PSDITDIR/CMTI10

  afmtodit -s -d $PSDITDIR/DESC \
    $AFMDIR/CMSY10.afm $PSDITDIR/generate/symbolmap $PSDITDIR/CMSY10

  afmtodit -s -d $PSDITDIR/DESC \
    $AFMDIR/CMEX10.afm $PSDITDIR/generate/symbolmap $PSDITDIR/CMEX10

  afmtodit -s -i 50 -e $PSDITDIR/generate/text.enc -d $PSDITDIR/DESC \
    $AFMDIR/CMMI10.afm $PSDITDIR/generate/mathitalicmap $PSDITDIR/CMMI10

where mathitalicmap consists of the latin and greek letters (copy
and paste from textmap and lgreekmap, and consider that some greek
letters must be mapped to latin lookalikes: *o->o, *A->A, *B->B, *E->E,
*Y->H, *I->I, *K->K, *M->M, *N->N, *O->O, *R->P, *T->T, *C->X, *Z->Z ).

Create a file containing eqn definitions for use with Computer Modern
fonts, say $CMEQNRC. You can source this file at the beginning of
your document (you'll need to use soelim to make sure eqn sees the
definitions), or you can explicitly tell eqn where to look for eqnrc
with the -M flag (then, $CMEQNRC has to be named eqnrc).  In this file,
override some of the definitions of the groff distribution eqnrc,
for example,

  sdefine inf %\[if]%

(the infinity symbol in Computer Modern already has the appropriate size).

Now, tweak the font description files.  For example:

* In CMR, alias "pl" to "+" and "eq" to "="
  ("mi" is already aliased to "\-" in CMSY).

* Create appropriate names for the symbols which exist in text and
  display sizes.  For example, in $PSDITDIR/CMEX10, put something
  like "sumtext" in the first column for glyph "summationtext", and
  "sumdisp" in the first column for glyph "summationdisplay". Then
  in your $CMEQNRC,

    sdefine sum  %{type "operator" vcenter \[sumtext]}%

  and in your macro definitions or in your document before a displayed
  equation

    .tr \[sumtext]\[sumdisp]

  and before a text equation

    .tr \[sumtext]\[sumtext]

* Give appropriate names to the different-sized parentheses in
  $PSDITDIR/CMEX10, for example,

    parenleft0   [...]   parenleftbig
    parenleft1   [...]   parenleftBig
    parenleft2   [...]   parenleftbigg
    parenleft3   [...]   parenleftBigg
    [etc.]

* Adjust subscript corrections for letters such as T, F, etc. in CMMI.

* Tweak metrics for parenthesis-parts in $PSDITDIR/CMEX10. The
  parenthesis-parts are rounded instead of flat where they will connect
  to other parts, and you have to tell groff to imagine that they're
  slightly shorter so it'll overlap them a bit when stacking them up,
  otherwise you'll get a small indentation at each junction.
  (See right parenthesis around vector b in the attached pdf.)

etc.


And now the hard part: how can we convince eqn to use different fonts
for different parts of equations, e.g., CMMI10 for body-size text and
CMMI7 for subscripts?  I don't know.


Attachment: cm-fonts.ro
Description: Text document

Attachment: cm-fonts.pdf
Description: Adobe PDF document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]