Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I included the blackboard bold characters adding the following lines to my preamble. (Inspired by txfonts.sty)

\let\mathbb\relax
\DeclareSymbolFont{lettersA}{U}{txmia}{m}{it}

\DeclareMathSymbol{\m@thbbch@rA}{\mathord}{lettersA}{129}
\DeclareMathSymbol{\m@thbbch@rB}{\mathord}{lettersA}{130}
\DeclareMathSymbol{\m@thbbch@rC}{\mathord}{lettersA}{131}
\DeclareMathSymbol{\m@thbbch@rD}{\mathord}{lettersA}{132}
\DeclareMathSymbol{\m@thbbch@rE}{\mathord}{lettersA}{133}
\DeclareMathSymbol{\m@thbbch@rF}{\mathord}{lettersA}{134}
\DeclareMathSymbol{\m@thbbch@rG}{\mathord}{lettersA}{135}
\DeclareMathSymbol{\m@thbbch@rH}{\mathord}{lettersA}{136}
\DeclareMathSymbol{\m@thbbch@rI}{\mathord}{lettersA}{137}
\DeclareMathSymbol{\m@thbbch@rJ}{\mathord}{lettersA}{138}
\DeclareMathSymbol{\m@thbbch@rK}{\mathord}{lettersA}{139}
\DeclareMathSymbol{\m@thbbch@rL}{\mathord}{lettersA}{140}
\DeclareMathSymbol{\m@thbbch@rM}{\mathord}{lettersA}{141}
\DeclareMathSymbol{\m@thbbch@rN}{\mathord}{lettersA}{142}
\DeclareMathSymbol{\m@thbbch@rO}{\mathord}{lettersA}{143}
\DeclareMathSymbol{\m@thbbch@rP}{\mathord}{lettersA}{144}
\DeclareMathSymbol{\m@thbbch@rQ}{\mathord}{lettersA}{145}
\DeclareMathSymbol{\m@thbbch@rR}{\mathord}{lettersA}{146}
\DeclareMathSymbol{\m@thbbch@rS}{\mathord}{lettersA}{147}
\DeclareMathSymbol{\m@thbbch@rT}{\mathord}{lettersA}{148}
\DeclareMathSymbol{\m@thbbch@rU}{\mathord}{lettersA}{149}
\DeclareMathSymbol{\m@thbbch@rV}{\mathord}{lettersA}{150}
\DeclareMathSymbol{\m@thbbch@rW}{\mathord}{lettersA}{151}
\DeclareMathSymbol{\m@thbbch@rX}{\mathord}{lettersA}{152}
\DeclareMathSymbol{\m@thbbch@rY}{\mathord}{lettersA}{153}
\DeclareMathSymbol{\m@thbbch@rZ}{\mathord}{lettersA}{154}

\DeclareRobustCommand*{\mathbb}[1]{\csname m@thbbch@r#1\endcsname}

Now I wonder whether there is a more elegant way to achieve this goal. But replacing the above with

\let\mathbb\relax
\DeclareMathAlphabet{\mathbb}{U}{txmia}{m}{it}

yields the typical \mathfrak-characters.

(I should mention that the packages fourier, amsmath, amssymb are loaded.)

share|improve this question

2 Answers 2

up vote 4 down vote accepted
\DeclareSymbolFont{lettersA}{U}{txmia}{m}{it}
\renewcommand{\mathbb}[1]{\mathchar\numexpr\symlettersA*256+64+`#1\relax}

Of course you have to use only one character in the argument of \mathbb.

Explanation: LaTeX assign a math group to lettersA and refers internally to this math group number as \symlettersA. Thus we have to build the mathchar code as the four byte hexadecimal number

<class><mathgroup><two bytes for the character's slot>

Here <class> is 0, because we want an ordinary symbol and so we need to multiply \symlettersA by 256 and add the slot. Since there's an offset of 64 places for the blackboard letters with respect to their usual location, we add 64 to the ASCII code of the argument.

share|improve this answer

the blackboard bold alphabet (uppercase only) is located in an area "above" the range of normal ascii. the normal uppercase area is occupied by fraktur, as you discovered.

an easy way to determine where particular glyphs are located is to generate a font chart for the font in question, comparing it with the canonical cmr10. you can do this interactively from the command line, with these instructions:

tex testfont
txmia at 10pt
\table\vfill\eject\init
cmr10
\table\bye

(there will be a prompt for every line after the first.)

compare the charts on the two pages and you will readily see the relative locations.

there is undoubtedly an elegant way to express the "offset" between the ascii uppercase area and that occupied by the blackboard bold in txmia so that \mathbb can be redefined, but what you've done is straightforward and reliable. however, if i were doing it, i'd probably represent the locations in hex ("201 - "232) rather than decimal (129 - 154).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.