%3A%20%5Csetcounter%7Bfigure%7D%7B1.14%7D.png)
setcounter コマンド内で整数以外の数値をどのように記述すればよいか知りたいです。レポートを書いているのですが、図の数字は 1、2、3 ではなく、1.1、1.2、1.3 (第 1 章) です。
コマンドを試しました\setcounter{figure}{1.14}
が、数値が整数ではないため LaTeX では処理できないようです。この問題を克服するにはどうすればよいでしょうか?
\renewcommand{\thefigure}{\arabic{figure}}
setcounter の後、次のように定義されているコマンドを使用しました\renewcommand{\figurename}{Figura}
。
答え1
LaTeXでは、価値カウンターのmycounter
値は整数でなければなりません。このカウンターのタイプセットはマクロによって制御されます\themycounter
。このマクロには、カウンターの数値表現に関する情報 (デフォルトでは、アラビア数字 ( 1
、2
など)、大文字と小文字のローマ数字 ( I
、II
など)、大文字と小文字のアルファベット文字 ( a
、b
など) から選択できます) と、このカウンターの前に章番号などの他の項目を付けるかどうかに関する情報を含めることができます。
ここに、少し不自然ではありますが、実用的な例を示します。
\documentclass{report}
\usepackage[italian]{babel}
% reset the 'figure' counter each time 'chapter' counter is changed:
\counterwithin{figure}{chapter} % (that's actually the default)
% going slightly overbord:
\renewcommand{\thefigure}{\Roman{chapter}.\alph{figure}}
\begin{document}
\setcounter{chapter}{5}
\setcounter{figure}{14}
Numeric value of \texttt{chapter} counter: \arabic{chapter}
Numeric value of \texttt{figure} counter: \arabic{figure}
\begin{figure}[ht] \caption{AAA} \end{figure}
\begin{figure}[hh] \caption{BBB} \end{figure}
\begin{figure}[hh] \caption{CCC} \end{figure}
\end{document}