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 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}
share|improve this question
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 Sep 16 '12 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 Sep 17 '12 at 23:45

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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 Sep 19 '12 at 10:21

you can fool the package that accents is already loaded

\documentclass[]{article}
\makeatletter
\@namedef{ver@accents.sty}{}
\makeatother

\usepackage{physymb}
\usepackage{fontspec}

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

You should load LaTeX related font packages always before fontspec!

share|improve this answer
    
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 Sep 19 '12 at 10:22
    
yes, they can break settings from fontspec –  Herbert Sep 19 '12 at 10:38

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.