I would like to create a new command to easily insert 4 pictures that will be arranged in a matrix, but I don't know wich separator to use in the main file. I always get the latex error "unknow graphics extension .jpg;pix... I tryed it with comma and others as well. Or am I doing something else wrong?
MnWE:
\documentclass{book}
\usepackage{graphicx}
\usepackage{tikz} % Required for drawing custom shapes
\usetikzlibrary{positioning} %required for relative positioning of nodes
%-------------------
\newcommand\twoXtwo[4]{
\clearpage
\begin{tikzpicture}[remember picture,overlay]
\node [matrix] (matrix2x2) at (current page.center) {
\node {\includegraphics[width=0.5\textwidth]{#1}}; & \node{\includegraphics[width=0.5\textwidth]{#2}}; \\
\node {\includegraphics[width=0.5\textwidth]{#3}}; & \node{\includegraphics[width=0.5\textwidth]{#4}}; \\
};
\end{tikzpicture}
}
%-------------------
\begin{document}
\twoXtwo{pix1.jpg;pix2.jpg; pix3.jpg; pix4.jpg}
\end{document}

\documentclass{book} \usepackage{graphicx} \newcommand\twoXtwo[4]{ \clearpage \begin{tabular}{c@{}c} \includegraphics[width=0.5\textwidth]{#1} & \includegraphics[width=0.5\textwidth]{#2} \\ \includegraphics[width=0.5\textwidth]{#3} & \includegraphics[width=0.5\textwidth]{#4} \\ \end{tabular} } \begin{document} \twoXtwo{example-image}{example-image-a}{example-image-b}{example-image-duck} \end{document}– Feb 07 '19 at 16:37