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'm using the musixtex package and it contains a \cup command (command for a dotted note). Unfortunately, I need the usual \cup command (command for the union of sets).

Now, LaTeX doesn't recognize the 'normal' \cup command and gives me an error.

What could I do to solve the problem?

share|improve this question
    
Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  egreg Mar 18 at 22:12
1  

1 Answer 1

The definition of of \cup can be stored in other macros, see the example. In this case the \cup of musixtex is probably not used in math mode, thus a "switcher" macro \cup can be defined that uses the mathematical \cup in math mode and the \cup of musixtex otherwise:

\documentclass{article}

\let\mathcup\cup
\usepackage{musixtex}
\let\musixcup\cup

\DeclareRobustCommand*{\cup}{%
  \ifmmode
    \expandafter\mathcup
  \else
    \expandafter\musixcup
  \fi
}

\begin{document}
  \noindent
  Musical note: \musixcup 0 \qquad \cup 0\\
  Math: $A \mathcup B = A \cup B$
\end{document}

Result

share|improve this answer

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.