[Tex/LaTex] Directive for picture in TeXStudio

texstudio

I recently discover directive in TeXStudio like %!TEX root = ../main.tex, this is fantastic.

I tried to find the directive saying the folder where picture should be upload. I mean, is there a directive able to say something like: %!TEX picture folder = ../../picture ?

Best Answer

The graphicx package (which you should be loading anyway) offers \graphicspath command where you can provide a list of folders like \graphicspath{{../../picture}{folder2}}. LaTeX will search for images in these folders.

\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}

An advantage of this command is that it will work in any editor (not only texstudio), thanks to cfr for reminding. You can read on graphicspath in grfguide (textdoc grfguide from command prompt)

Hence the need for a command like %!TEX picture folder=... in texstudio doesn't arise and there is none to the best of my knowledge.

Related Question