
私は LaTeX のヘビーユーザーですが、Tex プログラミングがどのように行われるかについてはほとんど知りません。私は長い文書を書いているのですが、図番号を chaper.section.figure_number のようにしたいのです。たとえば、図 4.3.10 です。グーグルで調べた後、うまく機能するこの解決策を見つけました。
\makeatletter
\@addtoreset{equation}{section}
\@addtoreset{figure}{section}
\@addtoreset{table}{section}
\def\thefigure{\thesection.\@arabic\c@figure}
\def\thetable{\thesection.\@arabic\c@table}
\def\theequation{\thesection.\@arabic\c@equation}
\makeatother
ただし、理由はわかりません。ラベル付きのサブ図を使用すると、残念ながら次のような参照が表示されます: chaper.figure_nuber (例: 4.30(a))。しかし、必要なのは、chapter.section.figure_number.(a,,b,c..) (例: 4.2.10(a)) です。上記のような追加のコマンドを定義する必要があると思いますが、サブ図のドキュメントからは、どのコマンドをどのように定義すればよいかわかりません...
助けていただければ幸いです
答え1
次の設定は、あなたが求めているジョブを実行するためのものです。subcaption
古いパッケージではなく新しいパッケージを使用し、パッケージによって提供されるコマンドsubfig
を使用することに注意してください。\numberwithin
amsmath
\documentclass{book}
\usepackage{amsmath, % for \numberwithin and \eqref commands
subcaption} % for subfigure environment
\usepackage[demo]{graphicx} % remove 'demo' option for real document
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}
\begin{document}
\chapter{First Chapter}
\section{New ideas}
\begin{figure}[h]
\begin{subfigure}{0.45\textwidth}
\includegraphics[width=\columnwidth]{somegraph.pdf}
\caption{First subfig} \label{fig:1a}
\end{subfigure}
\hspace{\fill} % maximize horizontal separation of subfigs
\begin{subfigure}{0.45\textwidth}
\includegraphics[width=\columnwidth]{anothergraph.pdf}
\caption{First subfig} \label{fig:1b}
\end{subfigure}
\caption{The first figure}
\end{figure}
A display-style equation:
\begin{equation}\label{eq:1}
a^2+b^2=c^2
\end{equation}
And here are cross-references to subfigures \ref{fig:1a} and \ref{fig:1b}
as well as to equation~\eqref{eq:1}.
\end{document}