10

I am trying to typeset the symbol for empty set and using the answer of that question I chose \varnothing but when I used it I got the symbol that is described to be \emptyset and vice versa. Also when I use the amssymb package I get these errors:

Command `\eth' already defined.

Command `\digamma' already 

Command `\backepsilon' already 

If I don't useamssymb it still happens the same regarding those 2 symbols. What is happening? How can I get the right symbol? (Meaning the \varnothing)

\documentclass[12pt]{article}

\usepackage{fontspec}

\setmainfont
[
  Ligatures=TeX,
  Extension=.otf,
  UprightFont=*,
  BoldFont=*Bold,
  ItalicFont=*It,
  BoldItalicFont=*BoldIt,
  Mapping=tex-text
]{GFSArtemisia}

\setsansfont[Mapping=tex-text]{GFSArtemisia.otf}

\usepackage[english,greek]{babel}

\usepackage[fleqn]{amsmath}

\usepackage{unicode-math}

\begin{document}

This is the problem:

\vspace{1cm}

$\varnothing \quad \emptyset$

\end{document}
5
  • You should post a minimal compilable example, so we can reproduce your problem.
    – Manuel
    Oct 19, 2014 at 23:36
  • Ok I will edit my question.
    – Adam
    Oct 19, 2014 at 23:36
  • 1
    Now your question looks better. It seems that, by default \emptyset and \varnothing output the same symbol with unicode-math.
    – Manuel
    Oct 19, 2014 at 23:46
  • Related.
    – Manuel
    Oct 19, 2014 at 23:53

2 Answers 2

9

There are not two distinct Unicode points for the empty set and its variant symbol (they are just different forms of the same symbol). Find a font that has the circle form and use it.

\documentclass[12pt]{article}

\usepackage[fleqn]{amsmath}
\usepackage{unicode-math}
\usepackage[english,greek]{babel}

\setmainfont[
  Ligatures=TeX,
  Extension=.otf,
  UprightFont=*,
  BoldFont=*Bold,
  ItalicFont=*It,
  BoldItalicFont=*BoldIt,
]{GFSArtemisia}

%\setsansfontMapping=tex-text]{GFSArtemisia.otf} %%% it's not sans serif!

\setmathfont{Latin Modern Math}
\setmathfont[range=\varnothing]{Asana Math}
\setmathfont[range=\int]{Latin Modern Math}

\begin{document}

This is the problem: $\varnothing\subseteq A\times B$

\end{document}

enter image description here

By the way, Latin Modern Math together with GFS Artemisia doesn't seem too nice a combination. If your document is math intensive, Artemisia for the Latin characters is not recommendable, in my opinion, because there's no matching math font.

Loading Latin Modern Math explicitly is necessary if another math font is chosen for some range of characters (it's a bug of fontspec, I'd say).

Note that, depending on the host system (say ShareLaTeX or WriteLaTeX) or your own system, the font may have to be loaded by file name and not by font name; in this case, the math fonts should be loaded with

\setmathfont{latinmodern-math.otf}
\setmathfont[range=\varnothing]{Asana-Math.otf}
\setmathfont[range=\int]{latinmodern-math.otf}
12
  • Another thing that annoys me is the necessity of calling range=\int (or whatever) to get the correct “dimensions”. Wouldn't it be more clear if range=\varnothing imported nothing else but \varnothing?
    – Manuel
    Oct 20, 2014 at 8:15
  • @Manuel It's really annoying. Let's hope these bugs will be fixed soon.
    – egreg
    Oct 20, 2014 at 8:45
  • @egreg thank you I will try it! Can you please explain to me why except the first \setmathfont there are two more?
    – Adam
    Oct 20, 2014 at 11:24
  • 1
    @Adam The first and third \setmathfont shouldn't be necessary in an ideal world (Latin Modern Math is the default of unicode-math), but they're unfortunately needed if different fonts are used for some ranges. With only the second declaration, two bugs of unicode-math show, which are corrected with the other two declarations. The order matters.
    – egreg
    Oct 20, 2014 at 11:35
  • @egreg I used these lines of code and I get errors: Undefined control sequence. l.37 \setmathfont {Latin Modern Math} LaTeX Error: Missing \begin{document}. Undefined control sequence. l.38 \setmathfont[range=\varnothing ]{Asana Math} Missing $ inserted. <inserted text>
    – Adam
    Oct 20, 2014 at 19:53
1

Another way is to use the "msb" (?) font which is what is being used when amssymb package is loaded without unicode-math.

Just open amssymb.sty and amsfonts.sty and copy the 2 lines, change \varnothing to \varnothingold.

%! TEX program = lualatex
\documentclass{article}
%\usepackage{amssymb}
\usepackage{unicode-math}
\DeclareSymbolFont{AMSb}{U}{msb}{m}{n}  % not needed with \usepackage{amsfonts} or \usepackage{amssymb}
\DeclareMathSymbol{\varnothingold}     {\mathord}{AMSb}{"3F}
\begin{document}
$\varnothing$
$\varnothingold$
\end{document}

Output: Output image


Yet another way is to use the New Computer Modern font, which looks similar to the "default TeX math font", except that it has a cv01 character table (or CharacterVariant=1 option) that selects the rounded variant of the symbol.

\documentclass{article}
\usepackage{unicode-math}
\begin{document}

$\emptyset$
\setmathfont[CharacterVariant=1]{NewCMMath-Regular.otf}
$\emptyset$

\end{document}

Output is same as the above.

You must log in to answer this question.

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