I am trying to make a pdf figure comprised of several other figures arranged in a table manner. I am using the standalone documentclass. However the results I get are far from optimal. I am using Texstudio for Windows, PDFLatex command on Miktek 2.9: pdflatex.exe -synctex=1 -interaction=nonstopmode %.tex
When using the first two options for the standalone package (in the MWE) I obtain a pdf where the upper and lower sides are cropped but not on left and right sides. When using the varwidth option to true, I obtain the desired cropped edges but the caption titles ((a),(b),...) are all left justified and brackets are gone. Whenever I remove the preview=true option I am filled with errors.
I attach the MWE; in the original, figure (d) is twice as tall as this black box.
%\documentclass[border=2pt,crop=true,preview=true]{standalone} % works but spaces on sides
%\documentclass[border=2pt,preview=true]{standalone} % works but spaces on sides
%\documentclass[varwidth=true,preview=true]{standalone} % works reduces side spaces, but captions ragged left without brackets
\documentclass[varwidth=true]{standalone} % same
\usepackage[demo]{graphicx}
\usepackage{tabularx}
\usepackage{subcaption}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\begin{document}
\begin{figure}
\centering
\begin{tabularx}{0.75\textwidth}{X X} % @{}
\begin{tabular}{c}
\begin{subfigure}[]{0.99\linewidth}
\centering
\includegraphics[width=1\textwidth]{}
\caption{}
\label{a}
\end{subfigure} \\
\begin{subfigure}[]{0.99\linewidth}
\centering
\includegraphics[width=1\textwidth]{}
\caption{}
\label{b}
\end{subfigure} \\
\begin{subfigure}[]{0.99\linewidth}
\centering
\includegraphics[width=1\textwidth]{}
\caption{}
\label{c}
\end{subfigure}
\end{tabular}
&
\begin{tabular}{c}
\begin{subfigure}[]{0.99\linewidth}
\centering
\includegraphics[width=0.99\textwidth]{}
\caption{}
\label{d}
\end{subfigure}
\end{tabular}
\end{tabularx}
\end{figure}
\end{document}
I would appreciate your comments on what is going on here and what can be done to solve this problem.