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 have two packages I want to use in the same document. Specifically musixtex and tengwarscript.

However they do conflict. Both packages use some of the same commands, obviously for very different things. Is there a way to load both packages in the same document, but only load one of them temporarily or intermittently?

share|improve this question
3  
The mind boggles! Are you writing out the music to the Lord of the Rings?? –  Andrew Stacey May 18 '11 at 20:44
    
More seriously, is it just the odd command or is it a lot that are in conflict? –  Andrew Stacey May 18 '11 at 20:45
    
You got it Andrew! It's nothing serious, just some fun with and for friends :) As I ran into the problem, well.. i wanted to see how to fix it should something like it arise in the future. The feedback I get is: ! I can't find file `nur8' ! Emergency stop. mfput.log is completely empty. This happens if I try to compile a document, empty or not, so long as both packages are called in the preamble. –  Mr. V May 18 '11 at 20:54
2  
I just did a bit of a basic look and could only find one command in common: \Tten. tengwarscript looks pretty good at namespacing all its internal macros (with teng@). Musixtex doesn't use that for anything specific other than to define it, so I would load musixtex first, then tengwarscript and use \ttie for the musixtex version of \Tten (since \Tten is just \let to \ttie). Of course, I may be missing something else that conflicts ... –  Andrew Stacey May 18 '11 at 20:59
    
Could you add your code that doesn't work? It sounds like the problem is elsewhere as when I try a minimum document then I get no such errors (though I find that my suggestion in the previous comment doesn't work; you have to load tengwarscript first, save the definition of \Tten, and then restore it after loading \musixtex: \usepackage{tengwarscript}\let\origTten=\Tten\usepackage{musixtex}\let\Tten=\or‌​igTten). –  Andrew Stacey May 18 '11 at 21:02
show 5 more comments

2 Answers

up vote 11 down vote accepted

(Basically what was in my comment, but hopefully a bit clearer here.)

The only command that I can find which is defined in both tengwarscript and musixtex is \Tten. In tengwarscript it is defined with \newcommand which checks to see if it has already been defined (and throws an error if so). In \musixtex it is defined via a \let (which doesn't check), specifically \let\Tten=\ttie. Moreover, there is no other explicit use of \Tten in musixtex. So I would keep the tengwarscript definition of \Tten. For the musixtex version, you can use \ttie itself, or define another command to be equivalent to it, say \mTten. As tengwarscript explicitly checks to see if \Tten has been defined already but musixtex doesn't, the correct order to load them in is tengwarscript first and musixtex second. The following is a way to do this:

\documentclass{article}
\usepackage{tengwarscript}
\let\tengwarTten=\Tten
\usepackage{musixtex}
\let\mTten=\Tten
\let\Tten=\tengwarTten
\begin{document}
\end{document}

(Oh, and I'd like to see the final document ...)

share|improve this answer
    
@Mr. V: I recommend using the method that Gonzalo writes (and therefore also accepting his answer) since it is a little more robust and works independently of the order of the packages. You can always rename the saved symbol yet again using, say, \let\mTtex=\origTten if you so desire. –  Andrew Stacey May 19 '11 at 8:59
add comment

As Andrew has mentioned, the general procedure to prevent symbol names clashes when two packages define the same symbol name is to load the first package, rename the conflicting symbols, and then load the second package. The \savesymbol command from the savesym package can be used to this; \savesymbol{XXX} renames a symbol from \XXX to \origXXX:

\documentclass{article}
\usepackage{savesym}
\usepackage{musixtex}
\savesymbol{Tten}
\usepackage{tengwarscript}

\begin{document}
...
\end{document}
share|improve this answer
    
Does the savesym package correctly handle stuff defined by \newcommand? That is, when it saves a symbol, does it remove the fact that it is currently defined? This would be worth knowing about (and highlighting in your answer) as my strategy only works because one package doesn't use \newcommand. –  Andrew Stacey May 19 '11 at 6:49
    
Nevermind, I just looked at the code and saw that it does. –  Andrew Stacey May 19 '11 at 8:57
add comment

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.