図のキャプションに小数値を使用する(浮動小数点数)

図のキャプションに小数値を使用する(浮動小数点数)

図とセクションが与えられている場合、そのセクションの図にラベルを付ける必要があるsection.counter。例:最初の図、セクション3は図3.1である必要があります。使用できるのは\documentclass{article}

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage{caption}
\usepackage[paper=A4,pagesize]{typearea}
\usepackage[driver=pdftex, margin=2.54cm]{geometry}
%Preamble

\begin{document}

\date{}
\bibliography{Biblio}
\bibliographystyle{harvard}
\author{Aiden Strydom\\201103578}
\title{Artificial Intelligence\\Deliverable One: Agent Design}

%New page
\maketitle
\tableofcontents
\newpage

\section{Background}
\section{Section 1}
\section{Section 2}
\section{Section 3}
    \begin{figure}[ht]
        \centering
        \resizebox{0.8\hsize}{!}{\includegraphics[angle=90,origin=c]    {AeroponicsUCDportrait.pdf}}
        %\caption{Figure 3.1 Aeroponics \textit{Use Cases}} 
        \caption[(3.1)]{A figure without list entry.}
    \end{figure}
\end{document}

答え1

パッケージが必要ですchngcntr。例を最小限に削減しました。

\documentclass[12pt]{article}
\usepackage[demo]{graphicx} % the demo option is just for the example

\usepackage{chngcntr}
% number figures within sections
\counterwithin{figure}{section}

\begin{document}

\author{Aiden Strydom\\201103578}
\title{Artificial Intelligence\\Deliverable One: Agent Design}

\maketitle
\tableofcontents
\newpage

\section{Section 1}

Some text

\section{Section 2}

Some text

\section{Section 3}

Some text

\begin{figure}[htp]
\centering

\includegraphics[angle=90,origin=c]{AeroponicsUCDportrait.pdf}

\caption{Aeroponics \textit{Use Cases}} 
\end{figure}
\end{document}

ここに画像の説明を入力してください

関連情報