• No results found

The maybemath package for L

N/A
N/A
Protected

Academic year: 2021

Share "The maybemath package for L"

Copied!
3
0
0

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

Hele tekst

(1)

The maybemath package for L

A

TEX

Andy Buckley, andy@insectnation.org

January 25, 2005

The maybemath package provides a set of commands for adjusting math-mode typesetting to match the context of the surrounding paragraph. This includes making the math-mode text bold, upright, forced italic or sans-serif according to context, or any combination of these. 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 table of contents and perhaps a page header or footer. Typically this has been resolved manually by use of the optional second argument of the sectioning commands: maybemath provides a more seamless solution.

This package was developed in order to implement the hepparticles package, used for typesetting high-energy physics particle names.

The commands available are defined below. In general they may be nested and can take arbitrarily large arguments within a single math expression. The term to watch in the expressions below is the x3:

1

Bold contexts

• For context-sensitive boldness use \maybebm {expr }: \dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$ ⇒ . . . foo bar, x2 + x3+ · · ·

\textbf{\dots foo bar, $x^2 + \maybebm{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

(2)

2

Upright and italic contexts

• For context-sensitive upright math typesetting use \mayberm {expr }: \dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$

⇒ . . . foo bar, x2 + x3+ · · ·

\textit{\dots foo bar, $x^2 + \mayberm{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

• Alternatively, to force \mathit in italic contexts use \maybeit {expr }: \dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$

⇒ . . . foo bar, x2 + x3+ · · ·

\textit{\dots foo bar, $x^2 + \maybeit{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

• The functionality of both \mayberm and \maybeit is combined for con-venience in the command \maybeitrm {expr }:

\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$ ⇒ . . . foo bar, x2 + x3+ · · ·

\textit{\dots foo bar, $x^2 + \maybeitrm{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

• An extra command is available for adjusting the spacing of subscripts in italic contexts: they are shifted to the left if wrapped with the command \maybeitsubscript {expr }:

\dots foo bar, $\mayberm{B_d^0} \to \ \mayberm{B_\maybeitsubscript{d}^0}$ ⇒ . . . foo bar, B0

d → B0d

\textit{\dots foo bar, $\mayberm{B_d^0} \to \ \mayberm{B_\maybeitsubscript{d}^0}$}

⇒ . . . foo bar, B0 d → Bd0

I’m not aware if there are particular uses for this outside the pickinesses of particle-name typesetting but it may be useful!

3

Sans-serif contexts

• For context-sensitive sans-serif math typesetting use \maybesf {expr }: \dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$

⇒ . . . foo bar, x2 + x3+ · · ·

(3)

\textsf{\dots foo bar, $x^2 + \maybesf{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

Note that there is no italic version of the sans-serif math font, so use of \maybesf eliminates italic context handling.

4

Combined contexts

• For combined bold-and-sans-serif context handling, a \maybebmsf{expr } command is provided:

\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$ ⇒ . . . foo bar, x2 + x3+ · · ·

\textbf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

\textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$} ⇒ . . . foo bar, x2+ x3+ · · ·

\textbf{\textsf{\dots foo bar, $x^2 + \maybebmsf{x^3} + \dotsb$}} ⇒ . . . foo bar, x2+ x3+ · · ·

This is assumed to be the most commonly required combination of context-sensitive math typesetting: most other combinations can be achieved by nesting the primitive maybemath commands.

Any feedback is appreciated! Email to andy@insectnation.org, please.

Referenties

GERELATEERDE DOCUMENTEN

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,

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

If the section produces empty output for a value then the section will start flush at the margin or \secindent if it is positive and there will be no \nmdot.. It will produce

If you have an extended AMS font set available in scalable form (msam6, msam8 and msam9 in addition to msam5, msam7 and msam10) then remove the ‘%’ from the line

Many packages for using alternative math fonts, such as mathpazo (for Palatino), provide the \mathbold alphabet already and can be loaded with an option slantedGreek to make

When textcomp is not used (for instance, because your text fonts are not available with TS1 encoding), the gensymb package tries to emulate the above symbols using what is available

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..