0

When I refer to figure in text, it will not appear in the text like number but like question mark.

Na obrázku \ref{slm-princip} je vidět princip funkce zařízení SLM. Vysokovýkonný laser je zaměřován pomocí natáčecích zrcadel. Po dokončení tavení vrstvy sjede ...

\begin{figure}[h!]
\centering
\color{FigureColor}
\setlength\fboxsep{0pt}
\setlength\fboxrule{1.5pt}      
\captionbox{Princip výroby stroje SLM [12]}{%
    \fbox{\includegraphics[width=0.7\textwidth]{Obrazky/slm-princip.jpg}}
    \vspace{4pt}
    \label{slm-princip} }
 \end{figure}  

enter image description here

If you need more details, please let me know. Thank you

My packages are

\usepackage{inputenc}       
\usepackage{babel}     
\usepackage{fontenc}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{subfig} 
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color}
\usepackage{epstopdf}    
\usepackage{wrapfig}
\usepackage{multirow} 
\usepackage{longtable} 
\usepackage{placeins}
\usepackage{tabularx}
\usepackage{pdfpages}
\usepackage{fancyhdr}
\usepackage{enumitem}
\usepackage{indentfirst}            
\usepackage{caption}
\usepackage{float}
1

You need to put the \label in the first argument, along with the caption, not the second, with the image.

output of code

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{caption}
\begin{document}
Na obrázku \ref{slm-princip} je vidět princip funkce zařízení SLM. Vysokovýkonný laser je zaměřován pomocí natáčecích zrcadel. Po dokončení tavení vrstvy sjede ...

\begin{figure}[h!]
\centering
\color{blue}
\setlength\fboxsep{0pt}
\setlength\fboxrule{1.5pt}      
\captionbox{Princip výroby stroje SLM [12]\label{slm-princip}}{%
    \fbox{\includegraphics[width=0.7\textwidth]{example-image}}}
 \end{figure}  
\end{document}

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.