3

I'm experimenting with Unicode-Math. I am using Neo-Euler with Concrete so I am generating my document with xelatex. I want \Re to give me the AMS-style double-lined \mathbb{R} but I am having trouble redefining \Re in my .cls.

That is, using test.cls at the bottom of this question I run this sample document and it works great; I see the double-lined R in all three places.

\documentclass{test}
% If \def here then it does not work. 
\begin{document}
\def\Re{\mathbb{R}}
Hello.  $x=4\mathbb{R}$. Give me a $\Re$ and a $\R$.
\end{document}

However, if I move the \def to above the \begin{document} then I only see the double-lined R in two places and in the middle I get Knuth's \Re, the somewhat-fractur single-lined shape. In particular, putting my redefinition inside the .cls below has no effect. I expect there is some \AtBeginDocument at work, but I was unable to make it out. Is there some way to not have the \def inside the \begin{document}?

% test.cls

% --- Class structure: identification part
% ---
\ProvidesClass{ltest}[2012/09/10 version 0.01 Test unicode-math]
\NeedsTeXFormat{LaTeX2e}

% --- Class structure: initial code part
% ---


% --- Class structure: declaration of options part
% ---
% This class extends the article class
% Read all the documentclass options; pass them to article
%\DeclareOption*{\InputIfFileExists{\CurrentOption.tut}{}{%
%    \PassOptionsToClass{\CurrentOption}{report}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

% --- Class structure: execution of options part
% ---
\ProcessOptions \relax

% --- Class structure: declaration of options part
% ---
\LoadClass{article}

% --- Class structure: main code part
% ---

% Set the fonts
\usepackage{fontspec}
\setmainfont[Ligatures=TeX,  % CM-Super Concrete
             Path = /usr/local/texlive/2012/texmf-dist/fonts/type1/public/cm-super/,
             ItalicFont = sfoti10.pfb,
             SmallCapsFont = sfocc10]{sform10.pfb}

\usepackage[math-style=upright]{unicode-math} % see http://tex.stackexchange.com/questions/50995/font-mixup-with-neo-euler-and-fontspec
\setmathfont[Path=/usr/local/texlive/texmf-local/fonts/opentype/euler/]{euler.otf}
% \AtBeginDocument{\DeclareMathAlphabet\mathbf{U}{eur}{b}{n}} % fontspec manual p. 11; doesn't seem to do anything.
\setmathfont[range=\mathbb,
             Path=/usr/local/texlive/2012/texmf-dist/fonts/type1/public/amsfonts/symbols/]{msbm10.pfb}  

\newcommand{\R}{\mathbb{R}}
1
  • Not related to the issue, but normally I would not hard-code the font paths into a class file.
    – Joseph Wright
    Sep 10, 2012 at 14:14

1 Answer 1

5

unicode-math does many of its workings \AtBeginDocument.

Just put the redefinition of \Re in \AtBeginDocument after loading unicode-math (also in the class, if you so wish).

\documentclass{test}

\AtBeginDocument{\def\Re{\mathbb{R}}}

\begin{document}
Hello.  $x=4\mathbb{R}$. Give me a $\Re$ and a $\R$.
\end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .