3

I've been using musixtex and amsmath in the same document (article class) up until I today encountered the problem that whenever I type \cup for a set union, a quaver appears instead (or sometimes compiling just reports an error). I am not within the environment called by \begin{music} when this occurs. Is there anything I can do to fix this?

To give an example:

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath} %Maths stuff
\usepackage{amsthm} %Theorems
\usepackage{amsfonts}  % for blackboard bold, etc
\usepackage{musixtex}

\begin{document}
$A\cup B$
\end{document}
  • welcome to tex.xs. please provide a small example that will compile and show the problem, so that others can experiment. – barbara beeton Dec 3 '15 at 20:00
  • Oh - sorry, I've added an example now. – Lammey Dec 3 '15 at 20:08
4

musixtex overrides the latex \cup command, but you could do the following to use one or other definition, depending on whether you are in math.

enter image description here

\documentclass[11pt,a4paper]{article}
\usepackage{amsmath} %Maths stuff
\usepackage{amsthm} %Theorems
\usepackage{amsfonts}  % for blackboard bold, etc
\let\cupA\cup
\usepackage{musixtex}
\let\cupB\cup

\protected\def\cup{\ifmmode\expandafter\cupA\else\expandafter\cupB\fi}

\begin{document}

1: $A\cup B$

2: A \cup B

\end{document}
  • That's fantastic, thankyou! – Lammey Dec 3 '15 at 20:34
  • actually, \cup for math isn't defined by amsmath -- it's a symbol name command carried over from plain tex. anyhow, this is a good approach when such symbol names are re-used and their context can be separated by whether it's within math or not. – barbara beeton Dec 3 '15 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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