• No results found

The icomma package for L

N/A
N/A
Protected

Academic year: 2021

Share "The icomma package for L"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The icomma package for L

A

TEX 2ε

Walter Schmidt

(v2.0 – 2002/03/10)

With ordinary LATEX, the comma cannot be used as a decimal separator in math

mode, because it is treated as a punctuation character and LATEX adds some

extra space after it. This can be overcome by defining an ‘intelligent’ comma, which ‘recognizes’, whether it is used as a decimal separator or as a punctuation character.

An appropriate definition was given in [1] and [2]. However, it relied on the particular encoding of the CM fonts, so it would not always work with alternative math fonts such as Euler. The package icomma provides an enhanced variant of this ‘intelligent’ comma. It can be used with the default CM math fonts as well as with alterative math font sets.

After loading of the package, the comma will be typeset as a punctuation character, if the next input character is a space; otherwise the comma is treated as a decimal separator. Thus, a decimal number is to be entered as, for instance,

1,234

whereas the mathematical expression (x, y) is to be written with a space after the comma:

(x, y)

Bugs and problems

In case the ‘intelligent comma’ is used together with the dcolumn package, a comma to be printed as the decimal separator in a column of type D is to be specified as {\mathord\mathcomma}, rather than {,}, since the latter leads to an error. For instance:

\begin{tabular}{... D{,}{\mathord\mathcomma}{2} ...}

Note that specifying the comma as the related input character works as usual. Generally, since the icomma package makes the comma ‘active’, further prob-lems are not unlikely.

The package code

At \begin{document}, we memorize the \mathcode of the ‘punctuation’ comma, in the \mathcomma macro, and we make the comma in math mode active:

(2)

1h∗packagei

2\AtBeginDocument{%

3 \mathchardef\mathcomma\mathcode‘\,%

4 \mathcode‘\,="8000 %

5}

The active comma checks the next input character. If this is a space , the active comma simply returns the saved \mathcomma; otherwise, \mathord\mathcomma is returned, so that no space will be added:

6{\catcode‘,=\active 7 \gdef,{\futurelet\@let@token\sm@rtcomma} 8} 9\def\sm@rtcomma{% 10 \ifx\@let@token\@sptoken \else 11 \ifx\@let@token\space \else 12 \mathord\fi\fi \mathcomma} 13h/packagei

The next line of code prevents DocStrip from adding the character table to the generated package:

14\endinput

Credits

Special thanks to Bernd Raichle for fixing the deficiencies of version 1.

References

[1] Richard Hirsch. Dezimalkomma beim TEXsatz in deutsch. Die TEXnische

Komödie 1/1994 (July 1994), 42–45.

[2] Peter Schmitt. Dezimalkomma beim TEXsatz in deutsch. Die TEXnische

Komödie 4/1997 (Feb. 1998), 50.

Referenties

GERELATEERDE DOCUMENTEN

(In fact, ordinary LaTeX footnotes sometimes do not work well if they need splitting (e. producing blank pages, or appearing in shufled form): but these problems should not affect

12 The mathcommand package provides functionalities for defining macros: 13 - that have different behaviors depending on whether in math or text mode, 14 - absorb Primes,

It can be particularly useful when math terms must appear in section headings, as this implies the same expression appearing in several boldness contexts: the heading itself, the

This is not even possible if you wanted to use Ghostscript in a single run for generating the files from a single PostScript file, since Dvips will in that case leave no bounding

The next figure 7 uses different task symbols, does not show the numbers on the time line, and the color of the boxes that denote the execution of the second instance of the second

Aliquam pellentesque, augue quis sagittis posuere, turpis lacus congue quam, in hendrerit risus eros eget felis.. Maecenas eget erat in sapien

• comma: substitute keyword “natural” or skip (default: natural) • semicolon: substitute keyword “natural” or skip (default: natural) • colon: substitute keyword

Let us compare this solution with the concurrent solution from the icomma package by Walter Schmidt: • In icomma, a comma in math works as the punctuation mark if a space goes..