
[アップデート]
質問が明確でなかったら申し訳ありません。つまり、同じ設定で画像を表示するためにmain.texの構文の記述を簡素化する方法です。
\begin{figure}[ht]
\centering
\includegraphics{Pictures/pic1.png}
\caption{Picture 1}
\label{fig:pic1}
\end{figure}
書くだけで、多分、
\includegraphics[caption,label]{pic1.png}
[元の質問]
私はいくつかのグラフィックを含む電子書籍を書いています。それらのいくつかは、たとえば、コードによって生成されます (TikZ を使用) 。それらを別のファイルに保存すると編集が簡単になると思います。すべてのグラフィックを Pictures という名前のフォルダーに保存します。すべてのグラフィックに、pic2.png、pic3.jpg などのpic1.tex
同じプレフィックスを付けて名前を付けます。pic
最小限のコードでこれらを含める方法は、次のようになります。
\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...>}}
。各パスの後に が続く必要があります/
。残りのコードは十分に明確なはずです。