Tell me more ×
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 am trying to reference a subsection using \label{sth} after subsection and \ref{sth} but it is not working. I thought that it was depth's counter fault so I used \setcounter{secnumdepth}{3} because I am writing a book. My MWE is

\documentclass[11pt,a4paper]{book}
\setcounter{secnumdepth}{3}

\begin{document}
\chapter{Chapter}
This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!This is my lovely chapter which describes nothing at all!
\section{Section}
\label{sec:section}
This is about sections...
\subsection{subsection}
\label{subsec:subsection}
This is about subsection
\chapter{Chapterino}
This is yet another lovely chapter. But the best part of this document is \ref{subsec:subsection}    
\end{document}

Any ideas why isn't that working?

edit: i also tried to reference a section just to check but it's not working either...

share|improve this question
2  
Works for me. Did you compile two times as required? – lockstep Oct 4 '12 at 7:42
Yes I did...I forgot to mention that I am using subfiles...So my reference point calls the subsection from another tex file...So actually this MWE is working for me too, but I am using the same code on my subfiles... – Thanos Oct 4 '12 at 8:45
@lockstep Thank you very much for your comment! I've figured it out!!! I just increased depth number to 4 and it worked... It doesn't make sence to me, since 1 is for chapter, 2 for section and 3 for subsection, but I'll take it!!! – Thanos Oct 4 '12 at 8:54

closed as too localized by lockstep, Stefan Kottwitz Oct 4 '12 at 9:54

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.