使用十进制值作为图形标题(浮点数)

使用十进制值作为图形标题(浮点数)

给定一个图和一个部分,我需要以某种方式标记该部分中的图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}

在此处输入图片描述

相关内容