Typesetting the Currency Symbols in SWP

    Back to Computer Support     Back to PAV Home Page     Email to PAV    


Typesetting the Currency Symbols in SWP

Philip A. Viton

August 27, 2001

Contents

1 Introduction
2 Updates
3 Up and Running
 3.1 Get the software
 3.2 Set up the support
 3.3 Test the installation
 3.4 Troubleshooting
4 Using the Support
 4.1 Other Macros
 4.2 Portability considerations
5 Hypertext support
 5.1 TeX4ht installation
 5.2 Limitations of the hypertext support
6 Technical Notes
 6.1 The LSW encoding
 6.2 Scaling
7 File list

1 Introduction

This note announces typesetting support for the currency symbols (plus some others) in Scientific Word / Scientific WorkPlace (SWP, for short) versions 3.5+. (See below for SWP 3.0). As you may know, Melissa Harrison also provides currency support, via an adapted marvosym font. The support offered here differs from Melissa’s in the following respects:

  • We support all the currency symbols — the Euro, the Franc, the Lira and the Pesetas —  on the SWP Miscellaneous Symbols panel. Melissa supports only the Euro.
  • We support direct entry of those symbols from the pull-down panels —  for Melissa’s support you need to enter a stand-alone TeX field or work in a special environment.
  • The currency symbols automatically change shape and weight according to the tag in force: if you are using a sans-serif text face and you enter a currency symbol, it will come out in sans-serif; similarly for bold, italic, etc.
  • We also support the rest of the text symbols on this panel — the ones that don’t switch you into math mode when you enter them into your document. However, unlike the currency symbols, these do not come in sans-serif or typewriter versions — only bold or italic.

Support for the currency symbols is provided via standard Windows fonts — Times, Arial and Courier — and we use these even when typesetting in Computer Modern. My own limited experimentation suggests that although Computer Modern is a notably thin-stroke typeface,  for the occasional symbol or so, the difference isn’t jarring. In addition — see below — I’ve tried to scale the glyphs when they are used with Computer Modern.

The other text symbols are supported using the Times-like tci fonts supplied with SWP; the same considerations apply when using them with Computer Modern. These are supposed to be text symbols: I don’t know how well they’ll work if you try to use, say, L-script in math for a Laplace transform.

SWP 3.0: Full on-screen support for SWP 3.0 may or may not work. On my NT4 system, currency-symbol support with SWP 3.0 behaves the same way as SWP3.51, ie with no problems at all. On a Win98 setup, I am unable to see the currency glyphs in the SWP 3.0 workspace; however, on the same machine, SWP 3.51 — using the same fonts — works as advertised. There must be some subtle interaction between SWP 3.0, the operating system and the fonts which prevents things from coming together smoothly. However, all is not lost. If you’re willing to put up with a bit of untidyness on-screen in the form of TeX fields, you can get typeset currency symbols even with SWP 3.0. However, you will not be able to see them with non-typeset previewing and printing. In no case have I been able to obtain the “extra” text symbols (script-F, script-L etc) with SWP 3.0, but since these are not supported via SWP 3.0’s symbol panels, this isn’t, I hope, a major loss. See below for more on this.

A copy of this note is enclosed as currency.html in the distribution referred to below.

2 Updates

This section lists updates and fixes, for easy reference.

August 25, 2001: added notes on problems with SWP 3.0, and some ways to work around them.

July 16, 2001: slight revision of the instructions for modifying truetex.ini, to accomodate different layouts. (Thanks to Steve Mayer for pointing this out).

May 24, 2001: I’ve revised the currency support to use the tci fonts instead of tciuni.

May 13, 2001: initial release.

3 Up and Running

3.1 Get the software

Support for the SWP currency symbols is contained in the archive currency.zip obtainable from here. When you retrieve it, unzip the contents to an empty directory on your hard disk.

3.2 Set up the support

I provide a batch file which will move most of the files to the correct locations — or at least it will if you have a standard SWP setup. If you don’t, you’ll have to parse the batch file and figure out how to move things yourself.

You must first customize the batch file, which involves setting values for two parameters. The first identifies the top-level SWP directory, and is straightforward. The second allows you to decide where the LaTeX support files will be placed. As distributed, I place them in the subdirectory \contrib\supported\currency of the LaTeX system, which will be created automatically if it does not already exist (which typically it will not). You are free to change this: all that’s required is that it be placed somewhere in the LaTeX tree.

This batch file will also check for, and remove if found, the four tciuni*.xfm files, from the initial release of the currency support, since, as noted above, we now use the plain tci fonts instead.

So to set up the support:

  • Open setup.bat in a text editor like NotePad.
  • Find the line beginning set swpdir=. Make sure the text after the = sign points to your top-level SWP directory. This must not end with the \ character.
  • Find the line beginning set latex=. Make sure the text after the = points to the subdirectory of swpdir where you want to install the LaTeX support files. This must not begin or end with the \ character.
  • Save the file and exit NotePad.
  • Start a DOS session, switch to the directory containing setup.bat and run the batch file.

The batch file ends by reminding you that you need to update truetex.ini before using the support. This involves adding a file to the list of font-substitution files recognized by TrueTeX. The file to be added is currsubs.ini, and has already been placed in your TrueTeX directory. In addition, a backup copy of truetex.ini has already been created, under the name truetex.inj. Note that if you already have a personal font-substitution file added to the list, you can just add the entries from currsubs.ini (ie everything except the line [fonts]) to that file. Otherwise, with the SWP Previewer not running:

  • Open swpdir\tcitex\truetex\truetex.ini in a text editor (where swpdir is your top-level SWP directory).
  • Find the line beginning FONTSUB=
  • On this line, find an entry for an ini file which includes a full path name. Copy it to the clipboard. On my system the first .ini entry in the list is c:\swp35\tcitex\truetex\dcsubs.ini so that’s the one I use.
  • Now paste the contents of the clipboard to right after the = sign in FONTSUB= and insert a semicolon (; ) after it.
  • Finally, edit the file name in the new entry read currsubs.ini. On my system the revised line begins

    FONTSUB=c:\swp35\tcitex\truetex\currsubs.ini;c:\swp35\tcitex\truetex\dcsubs.ini;
  • Save the file.

(Actually, it doesn’t matter where you place the new entry; you may find it more convenient to put it at the end of the FONTSUB list, depending on how your entry looks.)

If you are using TeX4ht, you should now read section 5.1, since there’s one more file to be installed.

3.3 Test the installation

I include a small test document to allow you to verify that the installation succeeded. To run it, start SWP, and open currtest.tex, which is located in the directory where you stored the LaTeX files (by default swpdir/tcitex/tex/latex/contrib/supported/currency, where swpdir is your top-level SWP directory). Then typeset-compile and/or typeset-print the document. You should see all the currency symbols. If you do, you can delete all the files you unzipped from currency.zip.

If you are running SWP3.0 and you do not see the currency symbols when you open currtest.tex, then you may be a victim of the incompatibility noted in the Introduction. Open currtest30.tex instead.This substitutes macros in unencapsulated TeX fields for the currency symbols. You should be able to Typeset-Preview and Typeset-Print this document, and get the currency symbols. If this applies to you, you may wish to make Fragments out of the various TeX fields, so you can insert them into your doucment as needed. 

3.4 Troubleshooting

If the TrueTeX compiler (IniTeX) complains, you should check that the following sets of files from the File List in section 7 were successfully installed in the appropriate locations: *.tfm, *.fd, currency.sty.

Under Win95/98 there may be a problem with compiling files located deep in the LaTeX tree. The symptom is that the Previewer hats with an error referring to the presence of a bad character (~) in the name. If this happens, just move currency.tex to a directory from which you’ve successfully compiled before, and try again.

If compilation succeeds but the Previewer reports a problem, check on these files: *.xvf, *.xfm. Make sure that currsubs.ini is in the TrueTeX directory, that truetex.ini refers to it using its full path, and that the entry is separated by the next one (typically dcsubs.ini) by a semi-colon.

Otherwise, please let me know, and I’ll see if I can fix the problem. Send me the file currtest.log together with a brief description of the problem, and state (a) what operating system you’re using; (b) which SWP version; and (c) whether any missing typeset characters are visible on-screen in SWP itself (if they’re not visible on-screen, then you may not have the right fonts; and you may want to upgrade them from Microsoft’s site).

4 Using the Support

If you can see the currency symbols in your SWP workspace, then all you need to do to enable the typeset support is load the package currency.sty. You can do this in various ways:

  • Open the document Preamble (Typeset -> Preamble) and enter the following on a line of its own: \RequirePackage{currency}.
  •  Open the document Preamble (Typeset -> Preamble) and enter the following on a line of its own: \usepackage{currency}. The effect of this is that SWP will move the statement out of the preamble when you next open the document; it has the same effect as the next method.
  • Click Typeset -> Options and Packages. Click the tab Package Options, then Go Native. In the next dialog, click with the mouse at the end of the last highlighted line; press Return to start a new line, and type {currency} (with the surrounding braces). Click OK and then OK again, to exit the dialog.

If you are using SWP 3.0 and you cannot see the currency symbols in currtest.tex, then you must still load currency.sty. However, each time you want a currency symbol, you must enter a TeX field, whose content is the appropriate macro from the list in the next section. The simplest way to make these fields available is probably to load currtest30.tex, and then highlight each of the “plain” (ie Roman or upright) macros and make it into a Fragment. You can then insert the appropriate Fragment into your document, and apply a tag (eg, Sans-serif, or emphasize) to it if you need the symbol in another style. Note that you will not be able to get the currency symbols if you preview or print in non-typeset mode.

4.1 Other Macros

The currency package defines the following macros which can also be used in TeX fields to refer to the currency symbols:

SymbolMacroSymbolMacro
Euro \euro Franc \franc
Lira \lira Pesetas \pesetas

The package also defines \newsheqel for the New Sheqel symbol. This is present in some versions of the basic Windows fonts, but not in others: you can check this using the Windows Character Map, in the Unicode Currency plane.

Finally, the package also defines macros for the following currency symbols: the corresponding glyphs are not present in any version of the fonts that I’ve seen, but may be in some “national” versions of Windows. Note that none of these is supported in the SWP symbol panels.

SymbolMacro UnicodeSymbolMacroUnicode
Cruzeiro\cruzeiro0x20a2 Mill \mill 0x20a5
Naira \naira 0x20a6 Rupee \rupee0x20a8
Won \won 0x20a9

4.2 Portability considerations

DVI files using this support are almost maximally non-portable. They contain references to the currency virtual fonts with names like currr, but more important, resolving those fonts into glyphs numbered above 255 relies on the rules of the TrueTeX previewer, both in the way it utilizes Omega virtual fonts and in the way it decides when a virtual font is or is not referencing an actual font file. Support for the non-currency symbols is via the special tci fonts; and these are unlikely to be available on anyone else’s system.

On the other hand, except for the reference to the currency package, your source (.tex) file is untouched. All the symbols under discussion here appear as instances of SWP’s Unicode macros (\U or \UNICODE). So if you’ve figured out how to exchange files containing those macros, you’ll still be able to — all you really need to do is supply an empty currency.sty file.

5 Hypertext support

5.1 TeX4ht installation

If you are using TeX4ht, Eitan Gurari’s TeX/LaTeX-to-hypertext translation system, you need to copy the included hypertext font file curr.htf to the appropriate place. Unfortunately, this place depends on how old your TeX4ht system is, so we can’t do it automatically. (The file will be included in TeX4ht update distributions dated May 6, 2001 or later, so if you’re just now installing or updating TeX4ht you can ignore this part of the installation). Let tex4ht refer to your top-level TeX4ht directory. The file goes into the ht-fonts subdirectory, per the following table:

If you see Then
tex4ht\ht-fonts\iso8859\1Create an sw subdirectory  if necessary
(tex4ht\ht-fonts\iso8859\1\sw), and place curr.htf there
tex4ht\ht-fonts\iso8859 Create an sw subdirectory if necessary
(tex4ht\ht-fonts\iso8859\sw), and place curr.htf there

5.2 Limitations of the hypertext support

There are serious problems when attempting to convert documents containing these symbols to hypertext because the symbols are from high-order Unicode planes. The present solution — which is somewhat unsatisfactory — is to simply write out Unicode entities corresponding to the symbols. This means that browsers will attempt to render the symbols using whatever font the user has selected; and the symbols may simply not be present in that font. In addition, there are character-set issues: both TeX4ht and Hevea by default reference the ISO-8859-1 set; for best results with Unicode symbols you should consider changing to the UTF-8 set.

TeX4ht You can change the character set manually (by editing TeX4ht’s HTML) or by putting the following (on one line) into a configuration file:

\Configure{@HEAD}{\HCode{<meta http-equiv=’’Content-Type’’ content=’’text/html; charset=UTF-8’’>} }

With this change, many browsers will correctly render the basic currency symbols. But because the text characters from the Miscellaneous Symbols panel are not present in the Times (etc) fonts distributed with Windows most browsers will not be abler to render those characters. If you know of a font which has all or some of these — and which your readers are likely to have available on their workstations — you can edit curr.htf to refer to it. Suppose, for example, that you want to use the cyberbit font. Then you’d change lines in curr.htf from eg

’&#8466;’ ’’ 176 L-script

 to

’<font face="cyberbit">&#8466;</font>’ ’’ 176 L-script

(if you know your readers have SW/SWP/SN installed, you could specify tciuni instead of cyberbit here).

A final possibility is to write out a bit of explanatory text: if you make frequent use of script-L (say) and you don’t want to risk getting nothing on readers’ screens, you could change curr.htf to say something like

’[script-L]’ ’’ 176 L-script

which will write the literal [script-L] into your document whenever your source uses script-L.

Hevea To change the character set in Hevea’s HTML, put the following (on one line) in a configuration file:

\renewcommand{\@meta}{\@print{<META http-equiv=’’Content-Type’’ content=’’text/html; charset=UTF-8’’>}%

Because Hevea does not have the concept of a hypertext font, you cannot selectively change the way browsers render a particular Unicode entity. This means you will probably not be able to display the non-currency text symbols.

6 Technical Notes

6.1 The LSW encoding

The ability to switch from one shape of currency symbols to another as the surrounding text changes is based on introducing a new LaTeX encoding scheme for existing font families. This new scheme is denoted LSW: L is the standard LaTeX abbreviation for a local encoding, and you can probably guess what SW stands for. The only reason to note this is that if some other package also happens to define this encoding, then things could begin to go wrong. (Also, if you decide to emulate this trick, please use, eg LSW1 for your new encoding).

The rules associating encodings with fonts are contained in font definition files (.fd files) named LSWnnn.fd where nnn is the name of some existing font family. For example LSWptm.fd contains the definitions applicable to Times typesetting.

The virtual font files are named currfn where f identifies the family and is r for serif’d fonts, s for sans-serif and t for typewriter; and n is omitted for an upright font, b for bold, i for italic and bi for bold-italic. Thus, for example, the virtual font currrbi (note: three r’s) is used when typesetting serif’d bold-italic text.

6.2 Scaling

In an attempt to make the symbols more closely match the size of the Computer Modern letters, I’ve specified that in this context they (the additional symbols, not Computer Modern) be used slightly scaled from the design size. The scaling factors are:

Family Font Scale
Serif cmr/dcr .9963
Typewritercmtt/dctt1.0245
Sans-Serif cmss/dcss.9440

The scale factors were obtained as the ratio of the size of the numeral 5 in Computer Modern to Times. I’m not sure how much difference it makes; but if you don’t like it — or want to change it — you can do so by editing the files LSWcm*.fd in (by default) swpdir\tcitex\tex\latex\contrib\supported\currency. In each of these files you will see a bunch of lines like

\DeclareFontShape{LSW}{cmr}{m}{n}{<->[.9963]currr}{}

in which the [.9963] is the scaling factor. To get rid of all scaling, just edit out the entire value (including the square brackets). If you’d like to experiment with alternative values, just replace the numeric value. Note that the corresponding files for use with Times (LSWp??.fd)contain no scaling.

7 File list

Here’s a list of the many small files included with the currency support, so you know what you will need to move or copy if you update your SWP system. In what follows, swpdir is your top-level SWP directory.

  • In swpdir\tcitex\fonts\tfm: font metrics for the currency fonts.
    currr.tfmcurrri.tfmcurrrb.tfmcurrrbi.tfm
    currs.tfmcurrsi.tfmcurrsb.tfmcurrsbi.tfm
    currt.tfmcurrti.tfmcurrtb.tfmcurrtbi.tfm
  • In swpdir\tcitex\fonts\tfm: font metrics for the tci fonts.
tci1.tfmtci1i.tfmtci1b.tfmtci1bi.tfm
tci2.tfmtci2i.tfmtci2b.tfmtci2bi.tfm
tci3.tfmtci3i.tfmtci3b.tfmtci3bi.tfm
tci4.tfmtci4i.tfmtci4b.tfmtci4bi.tfm
  • In swpdir\tcitex\fonts\xvf: Omega-extended virtual fonts. This is the only way to utilize glyph positions above 255.
    currr.xvfcurrri.xvfcurrrb.xvfcurrrbi.xvf
    currs.xvfcurrsi.xvfcurrsb.xvfcurrsbi.xvf
    currt.xvfcurrti.xvfcurrtb.xvfcurrtbi.xvf
  • In swpdir\tcitex\tex\latex\contrib\supported\currency (unless you elected to place them elsewhere): LaTeX support files and test document.
    LSWptm.fd LSWphv.fd LSWpcr.fd
    LSWcmr.fd LSWcmss.fd LSWcmtt.fd
    currency.sty
    currtest.texcurrtest30.tex
  • In swpdir\tcitex\truetex: the font substitution file currsubs.ini, whose full path+name+extension you added to swpdir\tcitex\truetex\truetex.ini in the fontsub= line. Note that if you upgrade SWP you will need to alter truetex.ini again, before the support will work. If you suddenly find that currency symbols no longer appear in typesetting, this is something to check.  
  • If you have installed TeX4ht: In tex4ht\ht-fonts\iso8859\1\sw\ (or possibly  tex4ht\ht-fonts\iso8859\sw\) where tex4ht is your top-level TeX4ht directory: curr.htf, a hypertext font controlling how the symbols are rendered in hypertext documents.