3

I am having trouble using the physymb and fontspec packages together. When I compile using PDFLaTeX, everything works, even with the lmodern package. However, when I compile with XeLaTeX, it does not work if I've loaded fontspec (even if I don't use it), but it does work if I later load the package mathpazo (which I don't really want to use, but found via debugging). My question is, where are these errors coming from and is there a workaround? Will loading only certain fonts work?

The document I'm using to test is

\documentclass[]{article}
\usepackage{ifxetex}
\ifxetex
    \usepackage[cm-default]{fontspec}
    %\usepackage{mathpazo} % If you commento ut this line you get many errors.
\else
    \usepackage{lmodern}
\fi

\usepackage{physymb}

\begin{document}
    This is sample text.
\end{document}
2
  • 2
    The problem is with the accents package. You should report the issue to the package author; meanwhile, the no-math option for fontspec should allow compiling the document.
    – egreg
    Commented Sep 16, 2012 at 22:37
  • Thanks! I'll try that within a few hours. You should put that in an answer so I can accept it if it works.
    – Daniel H
    Commented Sep 17, 2012 at 23:45

2 Answers 2

2

The problem is with the accents package; I guess that some cooperation between accents and fontspec is in order, so the best is to contact both package maintainers.

A workaround is to load fontspec with the no-math option: this doesn't produce the error, but may have other consequences.

Another one is to patch something before the damage is done:

\documentclass[]{article}
\usepackage{ifxetex}
\usepackage{physymb}

\let\acute\relax
\let\grave\relax
\let\ddot\relax
\let\tilde\relax
\let\bar\relax
\let\breve\relax
\let\check\relax
\let\hat\relax
\let\dot\relax
\let\mathring\relax

\ifxetex
    \usepackage{fontspec}
\else
    \usepackage{lmodern}
\fi


\begin{document}

This is sample text.

\end{document}

In my small experiments, it seems that the accents work well, using the accents definition, albeit slighly modified. This might be the best way to temporarily solve the incompatibility.

1
  • I think for this I will go for the no-math option, but I'll keep the rest in mind if it's needed.
    – Daniel H
    Commented Sep 19, 2012 at 10:21
0

you can fool the package that accents is already loaded

\documentclass[]{article}
\makeatletter
\@namedef{[email protected]}{}
\makeatother

\usepackage{physymb}
\usepackage{fontspec}

\begin{document}
    This is sample text.
\end{document}

You should load LaTeX related font packages always before fontspec!

2
  • Why should you always load font packages before fontspec? Do the font packages otherwise break things in fontspec subtly, and fontspec knows how to handle it if it's loaded later, or is there a different reason? Even if it's that, can you expand on that point?
    – Daniel H
    Commented Sep 19, 2012 at 10:22
  • yes, they can break settings from fontspec
    – user2478
    Commented Sep 19, 2012 at 10:38

You must log in to answer this question.

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