如何調整圖形和表格標籤字體的大小?

如何調整圖形和表格標籤字體的大小?

我使用 \footnotesize 指令縮小標籤字體,但是標籤的「圖 2.1」部分不會調整大小。這意味著我最終會得到類似:「圖 2.1:」的小字體加上原始字體大小的描述。

我怎麼能把「圖Xi」部分也變成小字體?

答案1

一個簡單的解決方案是將文件類別變更為與您使用的文件類別相對應的 KOMA 腳本類別之一(book=scrbookreport=scrreprtarticle=scrartcl)。然後,您可以使用 KOMA-script 的內建指令來格式化字幕。

我在 MWE 中列出了 KOMA-script 的大部分字幕格式命令。我認為您最感興趣的兩個命令是

\addtokomafont{caption}{\footnotesize}
\addtokomafont{captionlabel}{\usekomafont{caption}}

第一行將屬性加入標題的文字部分 ( \caption{<text>}),IE。大括號內的文字。第二個將字體屬性加入標籤部分,( Figure 1, Tabell 1,ETC.) 指令\usekomafont{<fontset>}) 會將為文字部分設定的所有字體屬性複製到標籤。

如果您想從頭開始重設屬性,請使用\setkomafont{caption}{<attributes>}, instead of\addtokomafont`。例如,如果您希望標籤位於斜體,但不是文字部分,使用

\addtokomafont{captionlabel}{\usekomafont{caption}\itshape}

這是 MWE 和輸出:

在此輸入影像描述

\documentclass[UKenglish, demo]{scrartcl}
\usepackage{lmodern}
\usepackage{scrlayer-scrpage}
\usepackage[babel=true]{microtype}
\usepackage{babel}
\usepackage{graphicx}
\usepackage{booktabs, bigdelim, rotating}

\KOMAoptions{headings=small,%
            captions=tableheading,%
    }

% Section
\let\raggedsection\flushleft

% Caption and figures
\renewcommand*{\captionformat}{:\ }
\addtokomafont{caption}{\footnotesize}
\addtokomafont{captionlabel}{\usekomafont{caption}}
\setlength{\belowcaptionskip}{0.5\baselineskip}
\setlength{\abovecaptionskip}{0.5\baselineskip}
\setlength{\intextsep}{0.5\baselineskip}

\begin{document}
\title{Capital Asset Prices}
\author{W.\,T.\,F.\,Dull}
\maketitle

\section{Section}
\label{sec:intro}

\textsc{One of the problems} which has plagued the world is bad typesetting of figures and tables. Now we have KOMA-script to help us.

\begin{figure}[!h]
\centering
\includegraphics[width=0.5\columnwidth]{figure1.png}
\caption{A demo of figure captions\label{fig-1}}
\end{figure}

Even table captions look better with KOMA-script, but that is no surprise. The example is borrowed from another question posted at Stackexchange.com

\begin{table}[!htbp]
\caption{A demo of figure captions\label{fig-1}}
\centering

\begin{tabular}{llcc@{}}
\cmidrule[\heavyrulewidth](l){2-4}
& header1 & header 2 & header 3 \\
\cmidrule(l){2-4}
\ldelim\{{4}{4mm}[\parbox{4mm}{\rotatebox[origin=c]{90}{group1}}] & 1 & a & g \\
& 2 & b & h \\
& 3 & c & i \\
& 3 & c & i \\\addlinespace[0.75ex]
\ldelim\{{6}{4mm}[\parbox{4mm}{\rotatebox[origin=c]{90}{group2}}] & 4 & d & j \\
& 5 & e & k \\
& 6 & f & l \\
& 7 & g & m \\
& 8 & h & n \\
& 9 & i & o \\
\cmidrule[\heavyrulewidth](l){2-4}
\end{tabular}
\end{table}
\end{document}

相關內容