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.

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}
share|improve this question

1 Answer 1

up vote 3 down vote accepted

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}

enter image description here

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.

share|improve this answer
    
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

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.