첫 번째 그림에서는 Latex Numberwithin이 작동하지 않습니다.

첫 번째 그림에서는 Latex Numberwithin이 작동하지 않습니다.

저는 대학 연구실을 위한 문서를 작성하려고 하는데 이것이 제 코드입니다.

\section{Impuls- und Spungantwort für die drei Tiefpässe}    


 \begin{figure} [h!]
\centering
\includegraphics[width = \textwidth]{../durchfuehrung/lc_puls_flach.png} 
\caption{Anregung des LC-Tiefpasses (flach) mit einem Puls}
\label{LC Flach Puls}
\numberwithin{figure}{section}
\end{figure}


\begin{figure} [h!]
\centering
\includegraphics[width = \textwidth]{../durchfuehrung/lc_puls_steil.png} 
 \caption{Anregung des LC-Tiefpasses (steil) mit einem Puls}
\label{LC Steil Puls}
\numberwithin{figure}{section}
 \end{figure} \newpage

제작된 PDF 파일에서 그림의 번호는 다음과 같습니다.

2.1

그리고

2.1.2

번호 매기기는 다음과 같아야합니다.2.1.1그리고2.1.2문제를 찾을 수 없습니다.

이것은 내 기본 tex 파일입니다.

\input{header}

\usepackage{chngcntr}
\usepackage{float}
\usepackage{color}
\usepackage{nameref}
\usepackage{graphicx}
\renewcommand{\chapterheadstartvskip}{\vspace{0pt}}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
pdfborder={0 0 0}
}
\numberwithin{figure} {section}

\begin{document}

\frontmatter
\include{kapitel/titelseite_Standard}
\tableofcontents

\mainmatter

\input{kapitel/vorbereitung}
\chapter{Durchführung und Auswertung}
\input{kapitel/LV_4_2_1}
\input{kapitel/LV_4_2_2}
\input{kapitel/LV_4_2_3}

%\include{kapitel/nuetzliches}
%\include{kapitel/blindtext}

%\bibliography{biblio/biblio}
\listoffigures
\bigskip
\begingroup
\let\clearpage\relax
\listoftables
\endgroup

답변1

숫자 카운터 작동 방식을 재설정하려면 \section다음 을 탭하세요 .\subsection

여기에 이미지 설명을 입력하세요

\documentclass{article}

\usepackage{chngcntr,lipsum}

\let\oldsection\section
\let\oldsubsection\subsection
\renewcommand{\section}{\counterwithin{figure}{section}\oldsection}
\renewcommand{\subsection}{\counterwithin{figure}{subsection}\oldsubsection}

\begin{document}

\listoffigures

\section{A section}\lipsum[1]
\begin{figure}\caption{A caption}\end{figure}% 1.1
\begin{figure}\caption{A caption}\end{figure}% 1.2
\subsection{A subsection}\lipsum[2]
\begin{figure}\caption{A caption}\end{figure}% 1.1.1
\begin{figure}\caption{A caption}\end{figure}% 1.1.2
\subsection{A subsection}\lipsum[3]
\begin{figure}\caption{A caption}\end{figure}% 1.2.1
\begin{figure}\caption{A caption}\end{figure}% 1.2.2

\section{A section}\lipsum[1]
\begin{figure}\caption{A caption}\end{figure}% 2.1
\begin{figure}\caption{A caption}\end{figure}% 2.2
\subsection{A subsection}\lipsum[2]
\begin{figure}\caption{A caption}\end{figure}% 2.1.1
\begin{figure}\caption{A caption}\end{figure}% 2.1.2
\subsection{A subsection}\lipsum[3]
\begin{figure}\caption{A caption}\end{figure}% 2.2.1
\begin{figure}\caption{A caption}\end{figure}% 2.2.2

\end{document}

답변2

\counterrwithin모든 그림에서 사용하는 대신 서문에서 사용하세요 .

\documentclass{article}
\usepackage{geometry}
\geometry{legalpaper, margin=2in}

\usepackage{float}
\usepackage{color}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{chngcntr}

\counterwithin{figure}{subsection}

\begin{document}

\input{file1.tex}
\section{section01}
\input{file1.tex}
\input{file1.tex}

\end{document}

그리고 file1.tex :

\subsection{Smiles}    

\begin{figure} [h!]
\centering
\includegraphics[width = 0.1\textwidth]{smile.png} 
\caption{Smile:)}
\label{smile01}
\end{figure}

\begin{figure} [h!]
\centering
\includegraphics[width = 0.1\textwidth]{smile.png} 
\caption{Another smile}
\label{smile02}
\end{figure} 

결과 수치는 0.1.1, 0.1.2, 1.1.1, 1.1.2, 1.2.1, 1.2.2로 번호가 매겨져 있습니다.

결과

[1]그림, 표 및 기타 문서 요소의 연속 대 장/섹션별 번호 매기기

관련 정보