I have a master document and for each chapter a separate file like:


% preamble etc.

% and so on


% Some figure with a label, tex code not shown, just the label
% Some figure with a label, tex code not shown, just the label

This two-legs animal is a chicken as shown in \cref{fig:chicken} % OK! Works within the same chapter! fig. 1


Here I like to refer to \ref{fig:monkey} % results in ??

Referring to a label in another chapter results in a double question mark (I did compile multiple times). LyX has the option to set a master document for each "included" tex-file. Document > Settings > Select default master document.

How can I do this in TeXstudio? I've already set main.tex as the master document but can't find a way to refer from its childs back to the master document like in LyX.


It's important to add the \label{} after or inside \caption{}


\usepackage[justification=RaggedRight, singlelinecheck=false]{caption} 





\chapter{Chapter 1}

 \caption{ Test}


\chapter{Chapter 2}

Here I like to refer to \cref{fig:chicken}


Here I like to refer to fig. 1.1
  • I discovered that the package cleveref should be included after hyperref and if used, amsmath, thanks to your example SLx64. Thanks a lot! – RisingSun May 25 '14 at 15:11
  • Yes you have to include the hyperref package bevor cleveref if you want to use it. If it works for you, please accept my answer. – SLx64 May 25 '14 at 15:24
  • I'd love too, needs reputation of 15 for that, it seems. – RisingSun May 25 '14 at 23:45
  • There is a check mark under the two arrows. :) – SLx64 May 26 '14 at 5:05
  • Oh, thanks! SLx64. Have a nice day. – RisingSun May 26 '14 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.