# Replace default images in a document

I'm creating a template document which contains lots of default images. Someone without LaTeX knowlegde should be able to replace these images (the path / name) e.g. via drag and drop. Replacing all names takes too much time, since there really are lots of images.

I'm using TeXstudio which includes a drag and drop function for images. So a second possibility could probably be a drag and drop template, which inserts the images. As shown in the MWE there are always two of them inside a figure environment. This is a problem, because TeXstudio's drag and drop inserts each image inside it's own environment.

These were just my ideas. I've also been looking for a macro that could do the job but haven't found anything. Every other method would be as good as long as it enables the editor of 1. replacing default images by other images or 2. inserting the images as shown via drag and drop. I hope one can understand what I mean, otherwise I'll try to explain it better ... Thanks a lot for your help!

\documentclass[a4paper,pagesize]{scrartcl}
\usepackage{graphicx}

\begin{document}
\section{Image Test}
\begin{figure}[!ht]
\centering
\fbox{
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
}
\caption{Images}
\end{figure}

\begin{figure}[!ht]
\centering
\fbox{
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
}
\caption{Images}
\end{figure}

\begin{figure}[!ht]
\centering
\fbox{
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
\begin{minipage}{.48\textwidth}
\centering
\includegraphics[width=.99\textwidth]{example-image-golden}
\end{minipage}
}
\caption{Images}
\end{figure}
\end{document}

• Are settings all same i.e. {figure}[!ht], \fbox, minipage=.48\textwidth width=.99\textwidth? – touhami Sep 8 '15 at 13:06
• Yes, all settings are the same. Only the images and the captions will differ. – kanra Sep 8 '15 at 13:18
• you can configure texsudio to input only \includegraphics[width=.99\textwidth]{exampleimage} when you drag and drop. – touhami Sep 8 '15 at 14:26
• I've tried to do so but when I drop the image behind the \centering command a dialog pops up saying something like 'the code could not be interpreted, the command \fbox is not supported'. – kanra Sep 8 '15 at 15:19

I define a command \mtcommand[3]{....}

\documentclass[a4paper,pagesize]{scrartcl}
\usepackage{graphicx}
\newcommand{\mtcommand}[3]{%
\begin{figure}[!ht]
\centering
\fbox{
\begin{minipage}{.48\textwidth}
\centering
#1
\end{minipage}
\begin{minipage}{.48\textwidth}
\centering
#2
\end{minipage}
}
\caption{#3}
\end{figure}}
\begin{document}
\section{Image Test}

\mtcommand{
\includegraphics[width=0.7\linewidth]{example-image}
}
{
\includegraphics[width=0.7\linewidth]{example-image}
}
{images}
\end{document}

• I've tried your idea together with a drag and drop template for the image and it works well. Interesting how the fbox is no problem when mentioned in the newcommand. Thank you so much! – kanra Sep 8 '15 at 19:09