
[업데이트]
내 질문이 덜 명확하다면 죄송합니다. 내 말은 동일한 설정으로 이미지를 표시하기 위해 main.tex의 구문 작성을 단순화하는 방법입니다.
\begin{figure}[ht]
\centering
\includegraphics{Pictures/pic1.png}
\caption{Picture 1}
\label{fig:pic1}
\end{figure}
그냥 쓰시면 될 것 같아요.
\includegraphics[caption,label]{pic1.png}
[원래 질문]
나는 그래픽이 포함된 전자책을 쓰고 있습니다. 그 중 일부는 TikZ를 사용하여 코드로 생성되었습니다(예 pic1.tex
: . 별도의 파일로 저장하면 편집하기 더 쉬울 것 같아요. 모든 그래픽을 Pictures라는 폴더에 넣습니다. pic
pic2.png, pic3.jpg 등과 같이 동일한 접두사를 사용하여 모든 그래픽의 이름을 지정했습니다.
최소한의 코드로 이를 포함하는 방법은 다음과 같습니다.
\include{pic1.tex}
보다
\begin{figure}[h]
\centering
\includegraphics{Pictures/pic1.tex}
\caption{Picture 1}
\label{fig:pic1}
\end{figure}
답변1
최고의 실무자가 되고 싶다면 다음을 고려해보세요. 파일 및 폴더 계층 구조를 다음과 같이 설정하십시오.
main.tex
안에Project
.rules.jpg
에 있습니다SubDir
.behaviors.jpg
에 있습니다ParentSiblingDir
.
% main.tex
\documentclass{article}
\usepackage{graphicx}
\graphicspath{{SubDir/}{../ParentSiblingDir/}}
\newcommand\Insert[5][hbtp]{%
\begin{figure}[#1]
\centering
\includegraphics[#2]{#3}
\caption{#4}
\label{#5}
\end{figure}}
\begin{document}
\Insert{scale=.2}{behaviors}{Students' behaviors}{fig:behaviors}
\Insert{scale=.2}{rules}{Father's rules}{fig:rules}
\end{document}
비고:
\graphicspath
이미지를 포함하거나 가져올 폴더(디렉토리)를 등록하는 데 사용합니다 . 형식은 입니다\graphicspath{{<relative path1>}{<relative path2>}{<relative path...>}}
. 각 경로 뒤에는 가 와야 합니다/
.나머지 코드는 충분히 명확해야 합니다!