
나는 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). 하지만 내가 원하는 것은 장.섹션.그림_번호.(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}