1

I am using the command \usepackage[font=footnotesize]{caption} in order to change the font size of the caption of my figures. This works fine if the caption goes over only one line. But if a caption is very long and goes over two lines, the font size of the second line remains unchanged. How can I fix this?

\documentclass[11pt,letterpaper,colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{hyperref}
\usepackage{graphicx} 
\usepackage[font=footnotesize]{caption}
\begin{document}
\begin{equation} \label{a}
A
\end{equation}
\begin{table}   
\centering   
\begin{tabular}{|p{0.9\linewidth}|}     
\hline A \\     \hline  
\end{tabular}   
\caption{This text here is in footnotesize as required. Now comes a reference \hyperref[a]{(\ref*{a})}}. Why is this text and the reference \hyperref[a]{(\ref*{a})} large? And why does LaTeX make the linebreak before the dot?
\end{table} 
\end{document}
6
  • 1
    That should not happen. Can you provide a minimal working example which shows the problem. Sep 11, 2020 at 15:25
  • Short test for your claim: \documentclass{article} \usepackage[font=footnotesize]{caption} \usepackage{lipsum} \begin{document} \begin{table} \centering \begin{tabular}{|p{0.9\linewidth}|} \hline \lipsum[1]\\ \hline \end{tabular} \caption{\lipsum[11]}\label{tab:lipsum} \end{table} \end{document} . From it you will see, that while caption (5 lines long) has the same font size. Please provide similar test file, which reproduce your problem,
    – Zarko
    Sep 11, 2020 at 15:43
  • I know now what the problem is. The problem is that I am using something like \hyperref[test]{(\ref*{test})}} in the caption. If I delete this part, it would work fine.
    – mahu_83
    Sep 11, 2020 at 15:46
  • I can't confirm your claim that \hyperref[test]{(\ref*{test})}} change caption font size. It works as expected, however, depends on your hyperref package settings, it can draw red box around reference which can give impression, that the reference is bigger. Please provide MWE (Minimal Working Example) which reproduce your problem.
    – Zarko
    Sep 11, 2020 at 17:00
  • please always provide a small but complete example that shows the problem. Whatever is causing your issue it is code not mentioned in your question, which makes it very hard to answer. Sep 11, 2020 at 20:46

1 Answer 1

2

You compare caption content with document text, i.e. Your caption is finished immediately after command \hyperref[a]{(\ref*{a})}. Dot was already out of caption.

See:

\documentclass[11pt,letterpaper,
               colorlinks=true,linkcolor=blue,citecolor=blue,
               urlcolor=blue]{scrartcl}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[font=footnotesize]{caption}
\usepackage{hyperref}

\usepackage{lipsum}

\begin{document}
\begin{equation} \label{a}
A
\end{equation}

\begin{table}[h]
\centering
\begin{tabular}{|p{0.9\linewidth}|}
\hline A \\     \hline
\end{tabular}
\caption{This text here is in \texttt{footnotesize} as required. Now comes a reference \hyperref[a]{(\ref*{a})}% <--- here was end of caption!!!
. Why is this text and the reference large? Because this part of text was not included in caption!}
    \end{table}
\lipsum[66]
\end{document}

enter image description here

As you can see, \hyperref[a]{(\ref*{a})} doesn't change caption text font size.

2
  • Thanks, what a stupid mistake.
    – mahu_83
    Sep 11, 2020 at 22:01
  • @mahu_83, it happens. Anyway, you can up-vote and even accept answer (by clicking on up-pen and check mark at top left side od answer) :-)
    – Zarko
    Sep 11, 2020 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .