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.

When I run latex on the following file, it terminates successfully, and produces the expected result:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[fleqn,tbtags]{mathtools}
%% \usepackage{MnSymbol}
\begin{document}
$$ x \xhookrightarrow{\gamma} y $$
\end{document}

But if I uncomment the commented-out line, I get this error:

! Undefined control sequence.
<argument> \lhook
                  \joinrel \relbar
l.6 $$ x \xhookrightarrow{\gamma}
                                  y $$
? 

Is there any way to get around this? (Of course, the example above does not require MnSymbol, but I do need it, along with mathtools, for what I'm working on.)

FWIW, here are the versions I have of the packages mentioned in the example:

Package: amsmath 2000/07/18 v2.13 AMS math features
Package: mathtools 2011/02/12 v1.10 mathematical typesetting tools
Package: MnSymbol 2007/01/21 v1.4 support for the MnSymbol font

Thanks!

PS: ironically enough, the only reason I have for using MnSymbol is to use its arrow definitions, as in

$$
\begin{matrix}
X & & \xrightarrow{h} & & Y \\
  & {\scriptstyle f} \lhooksearrow & & \rhookswarrow {\scriptstyle g} & \\
  & & Z & & \\
\end{matrix}
$$

to produce commutative diagrams like:

results from latex code above

...whose layout I find just barely acceptable (the arrows are too short, and don't necessarily lie right on, and/or parallel to, the lines connecting their source and target symbols; the spacing between these symbols is not always the best; etc.). IOW, if there is a better way to produce diagrams like these, possibly without needing MnSymbol, please let me know. Thanks!

share|improve this question
3  
I would not create diagrams like that, use the xy package or use tikz (much better look) –  daleif Sep 16 '11 at 13:46
add comment

1 Answer

up vote 5 down vote accepted

As far as I can tell, MnSymbol undefines \lhook because it provides ready made "hooked arrows", while \lhook is used for building them from "normal arrows" in the default math fonts.

Just write, after loading MnSymbol,

\let\originallhook\lhook
\usepackage{MnSymbol}
\let\lhook\originallhook

but what's obtained with \xhookrightarrow won't be perfect. A bit better is

\let\originallhook\lhook
\usepackage{MnSymbol}
\newcommand{\lhook}{\mathrel{\raise.018ex\hbox{$\originallhook$}}}

On the other hand, you should look at the specialized package Xy-pic or at the more general TikZ for building diagrams.

share|improve this answer
    
After reading your reply, I commented out the offending line in MnSymbol (where it sets \lhook to undefined), and the program ran without any apparent problems. What would be the harm in commenting out this line? (I don't understand why MnSymbol includes this line in the first place; even if it provides alternatives to \lhook, going to the extent of actually removing \lhook seems gratuitous.) –  kjo Sep 16 '11 at 13:03
    
@kjo The reason is that the default hook just doesn't mix well with the provided arrows. Don't modify packages: in case of an update you'll lose your changes. Instead do as suggested in my edited answer. –  egreg Sep 16 '11 at 13:08
    
@kjo The reason is that the default hook just doesn't mix well with the provided arrows. Don't modify packages: in case of an update you'll lose your changes. Instead do as suggested in my edited answer. –  egreg Sep 16 '11 at 13:08
    
ok, but at least i'd like to report this as a bug in MnSymbol. i need to figure out how to do that... –  kjo Sep 16 '11 at 14:23
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.