1

I am trying to place two figures from .pgf file input side-by-side. I want them to have independent captions (so no subfigures). I have tried using the minipage way as follows:

\documentclass{article}
\usepackage{pgf}

\begin{document}

Some words..
\begin{figure}
    \begin{minipage}[t]{0.5\linewidth}
        \centering
        \input{figure1.pgf}
        \label{Figure1}
        \caption{This is caption for Figure 1.}
    \end{minipage}
\end{figure}
\begin{figure}
    \begin{minipage}[t]{0.5\linewidth}
        \centering
        \input{figure2.pgf}
        \label{Figure2}
        \caption{This is caption for Figure 2.}
    \end{minipage}
\end{figure}

\end{document}

But instead of getting them side by side, I get them one below the other, like the attached picture. Tried using \scalebox{0.6} before \input the pgf but still the same behavior.. I have tried many different combinations and I can't find a way to make this work...enter image description here

EDIT: This is not a duplicate. I am importing .pgf files. My latex code is identical to the above answer but it doesn't work. pgf files are here if someone needs to test.

Panos
  • 143
  • No it is not, my latex code is identical to that answer. I am also importing .pgf files, not image files. – Panos Feb 10 '19 at 05:17
  • 1
    You should give the full compileable code that starts with \documentclass and ends with \end{document}. As well as the code that generates the .pgf files – AndréC Feb 10 '19 at 05:20
  • 1
    (i) images can be side-by side, if they are small enough (ii) to put them in parallel, they should be in the same float environment. – Zarko Feb 10 '19 at 05:28
  • @ AndreC: here are all the files https://a.uguu.se/DPFft8cqVVmz_code.7z – Panos Feb 10 '19 at 05:55
  • @ Zarko: Tried to use \scalebox{0.3}{\input{figure1.pgf}} they become very small but still not in the same row. – Panos Feb 10 '19 at 06:01
  • do you put in the same float? there should not be empty spaces between \input. – Zarko Feb 10 '19 at 06:27
  • @bomberb17 Is your problem caused by the llncs class? Try using another class as the native article class. Likewise many packages are not necessary. Please provide a minimum complete example (MWE). Also, is it important that the images are .pgf extended? Does the problem arise with .png images? .eps? etc – AndréC Feb 10 '19 at 06:27
  • I need to use llncs. the problem is not caused by it however, I tried also with article and I get the same thing. I also deleted all packages except {pgf} and still the same thing, so the packages are not the problem. Yes I need to keep .pfg, do not want to use .png etc. – Panos Feb 10 '19 at 06:32
  • @Zarko yes I use the same float without empty spaces – Panos Feb 10 '19 at 06:34
  • that we can help you please provide complete small document (beginning with \documentclass{...} and ending with \end{document} and example of your pgf images (unfortunately i haven't any pgf image on my system). – Zarko Feb 10 '19 at 06:58
  • I have already provided these above in a reply to AndreC, please download them from the link.. – Panos Feb 10 '19 at 07:03
  • @AndreC: I edited the question. All I added were a couple of lines with the documentclass and the usepackage{pgf}, then nested this into begin..end document. I cannot post directly the pgf files in my question, they are in the link. However I suppose any "test" pgf file would do. – Panos Feb 10 '19 at 18:44
  • To all of you who marked as duplicate: please read my question, I explain in the bottom why the other question you linked is different with the one here. – Panos Feb 10 '19 at 18:47

1 Answers1

1

It turns out that I had to remove the two intermediate \end{figure} \begin{figure} and enclose everything into the same figure. So the code now looks:

\documentclass{article}
\usepackage{pgf}

\begin{document}

Some words..
\begin{figure}
    \begin{minipage}[t]{0.5\linewidth}
        \centering
        \scalebox{0.45}{\input{figure1.pgf}}
        \label{Figure1}
        \caption{This is caption for Figure 1.}
    \end{minipage}
    \begin{minipage}[t]{0.5\linewidth}
        \centering
        \scalebox{0.45}{\input{figure2.pgf}}
        \label{Figure2}
        \caption{This is caption for Figure 2.}
    \end{minipage}
\end{figure}

\end{document}

enter image description here Thanks also to Johannes_B and AndréC for helping!

Circumscribe
  • 10,856
Panos
  • 143