
最近、TeXstudio で次のようなディレクティブを発見しました%!TEX root = ../main.tex
。このコンセプトは素晴らしいです。
写真をアップロードするフォルダーを指定するディレクティブを見つけようとしました。つまり、次のようなディレクティブがあるのでしょうか%!TEX picture folder = ../../picture
?
答え1
パッケージgraphicx
(いずれにせよロードする必要があります) に\graphicspath
は、 のようなフォルダーのリストを指定できるコマンドが用意されています\graphicspath{{../../picture}{folder2}}
。LaTeX はこれらのフォルダー内の画像を検索します。
\documentclass{article}
\usepackage{graphicx}
\graphicspath{{./img/}{./pictures/}}
\begin{document}
\includegraphics{one} %picture named one in directory img
\includegraphics{two} %picture named two in directory img
\includegraphics{three} %picture named three in directory pictures
\end{document}
このコマンドの利点は、どのエディタでも(Texstudioだけでなく)機能することです。cfrのおかげです。続きは(コマンドプロンプトから)graphicspath
で読むことができます。grfguide
textdoc grfguide
したがって、texstudio のようなコマンドの必要性は%!TEX picture folder=...
生じず、私の知る限りではそのようなコマンドは存在しません。