図や表のラベルのフォントサイズを変更するにはどうすればいいですか?

図や表のラベルのフォントサイズを変更するにはどうすればいいですか?

\footnotesize コマンドを使用してラベルのフォントを縮小しましたが、ラベルの「図 2.1」部分はサイズ変更されません。つまり、小さいフォントの「図 2.1:」と元のフォント サイズの説明が表示されることになります。

「図Xi」の部分も小さいフォントで表示するにはどうすればよいですか?

答え1

簡単な解決策は、ドキュメント クラスを、使用しているドキュメント クラスに対応する KOMA-script クラスの 1 つに変更することです ( book=scrbookreport=scrreprtおよびarticle=scrartcl)。その後、KOMA-script の組み込みコマンドを使用してキャプションをフォーマットできます。

MWEにはKOMAスクリプトのキャプションフォーマットコマンドのほとんどをリストアップしました。皆さんにとって最も興味深いと思われる2つのコマンドは、

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

最初の行はキャプションのテキスト部分に属性を追加します(\caption{<text>})。つまり. 中括弧内のテキスト。2番目はラベル部分にフォント属性を追加します(Figure 1、、Tabell 1.) コマンド\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}

関連情報