# Using overbrace in xymatrix

My TeX code is not compiling correctly (the overbrace is causing the error). How I can fix my file?

Here's what I have:

 \usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{stackrel}
\usepackage[all,cmtip]{xy}
\usepackage{multicol}
\usepackage{mathtools}

\begin{document}

$\xymatrix@-1pc{ \stackrel{1}{\bullet} \ar[rr] & & \bullet & \overbrace{\cdots}^{N} & \bullet \ar[rr] & & \stackrel{k}{\bullet} \\ }$

\end{document}

-

## 1 Answer

Use an extra pair of braces:

\documentclass{article}
\usepackage{stackrel}
\usepackage[all,cmtip]{xy}
\usepackage{mathtools}

\begin{document}

$\xymatrix@-1pc{ \stackrel{1}{\bullet} \ar[rr] & & \bullet & {\overbrace{\cdots}^{N}} & \bullet \ar[rr] & & \stackrel{k}{\bullet} \\ }$

\end{document}


In my example I didn't load packages that were not needed for the given code. Since you load mathtools, there's no need to load amsmath.

-
Thank you! It worked perfectly! –  user45285 Feb 2 at 19:10
Thank you. I don't know much about which packages are necessary when texing so for the time-being, I just include them all. And yes, this answer will be accepted as the answer. –  user45285 Feb 2 at 19:12
@user45285 Ah, I see. Thanks! –  Gonzalo Medina Feb 2 at 19:13