3

I have 4 pdf figures which I would like to merge into one pdf figure (requirements of the journal).

I have the follwoing piece of code:

\documentclass[varwidth=true, border=100pt,preview]{standalone}
\usepackage{subfigure}
\usepackage{lastpage,fancyhdr,graphicx}
\usepackage{varwidth}

\begin{document}
\begin{varwidth}{\linewidth}

\begin{figure*}[!h]  %[ht]
\begin{center}
\begin{tabular}{cccc}
\subfigure[{dblp}]{
\includegraphics[scale=.4]{imgs/dblp_corr.pdf}
\label{fig:dblp_corr}
\hspace{-17ex}
}&
\subfigure[{adult}]{
\includegraphics[scale=.4]{imgs/adult_corr.pdf}
\label{fig:adult_core}
\hspace{-17ex}
}&
\subfigure[{census}]{
\includegraphics[scale=.4]{imgs/census_corr.pdf}
\label{fig:census_core}
\hspace{-17ex}
} 
&
\subfigure[{synthetic}]{
\includegraphics[scale=.4]{imgs/synth_corr.pdf}
\label{fig:synthetic}
} 
\end{tabular}
\end{center}
\caption{\label{fig:corr} The Cramer's V values for all pairs of features
for all datasets.}
\end{figure*}

\end{varwidth}
\end{document}

But the generated pdf is smaller than what I want and only have of the right figure will appear in the figure. If I use varwidth like:

\documentclass[varwidth=true, border=40pt,preview]{standalone}

the problem will be solved. However there will be margin all (left, right, top, bottom) of the figures. How can I solve this problem?

  • Welcome to TeX - LaTeX! – Cfun Jun 30 '16 at 22:28
  • compiling with \documentclass[varwidth=true, border=40pt,preview]{standalone} i get overlapped figures is that the way you want it (is that right) ? i dont know what size your figures are and if they have the same size or not i just used example-image – Cfun Jun 30 '16 at 22:57
5

You have to specify a bigger value for the line width (page 19 of the manual of standalone.

You don't need a full-fledged subfigure (by the way, this package is obsolete, use subfig or subcaption), nor you need figure that just makes a difficult life to varwidth.

\documentclass[border=10pt,varwidth=30cm]{standalone}
\usepackage{graphicx,capt-of}

\newcounter{subfloat}
\renewcommand{\thesubfloat}{\alph{subfloat}}
\newcommand{\image}[2]{%
  \stepcounter{subfloat}%
  \begin{tabular}[t]{@{}c@{}}
  #2 \\
  (\thesubfloat) #1
  \end{tabular}%
}

\begin{document}

\image{dblp}{%
  \includegraphics[scale=.4]{example-image}%
}\quad
\image{adult}{%
  \includegraphics[scale=.4]{example-image}%
}\quad
\image{census}{%
  \includegraphics[scale=.4]{example-image}%
}\quad
\image{synthetic}{%
  \includegraphics[scale=.4]{example-image}%
}

\captionof{figure}{The Cramer's V values for all pairs of features for all datasets.}

\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.