[Tex/LaTex] Change font size of labels in figures to any font size

floatsfontsize

I want to change the font size of the label of a figure environment to any font size. It's possible to use the package caption with the argument font=Large for example. But I found no way to choose any font size, e.g. fontsize=28pt.

Here an example code:

\documentclass{standalone}
\usepackage{anyfontsize}

\usepackage[font=Large]{caption}
%\usepackage[fontsize=28pt]{caption} % not implemented


\begin{document}
\parbox[t]{20cm}{

\fontsize{28}{30} \selectfont

\begin{figure}
    %\includegraphics{figure.eps}
    \caption{\label{fig_req_osnr} \fontsize{28}{30} \selectfont My caption.}
\end{figure}

}

\end{document}

enter image description here

Do you have any ideas?

Best Answer

You can define a new value for font with \DeclareCaptionFont:

\documentclass{article}
\usepackage{anyfontsize}

\usepackage{caption}
\DeclareCaptionFont{xxviii}{\fontsize{28}{32}\selectfont}
\captionsetup{font=xxviii}


\begin{document}
\begin{figure}
\centering
\fbox{\rule{0pt}{4cm}\rule{4cm}{0pt}}
\caption{My caption}\label{fig_req_osnr}
\end{figure}

\end{document}

enter image description here