3

I have some plots obtained through gnuplot with epslatex terminal. The output is in two files for each plot: (1) foo.eps and (2) foo.tex.

I want to put these plots side by side in a tex document. But with subfigure or minipage I got some problems...

I want to do something like this

\documentclass{toptesi}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}

\begin{figure}
\begin{subfigure}{0.5\textwidth}
\input{foo1.tex}
\caption{bla bla}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\input{foo2.tex}
\end{subfigure}
\end{figure}

\end{document}

but the images are not rescaled according to the subfigure width, even though caption is. How to do that?

3
  • I would insert the .eps files or set the tex-code in a minipage into the subfigure. (haven't tried that). If this does not work, we need to see such a picture I guess.
    – LaRiFaRi
    Jul 2, 2014 at 8:47
  • I couldn't put the eps because the eps output of gnuplot doesn't contain the labels that are in the tex file (this because epslatex works in this way). The minipage seems to have the same problem of subfigure... Jul 2, 2014 at 8:52
  • Well then I fear we will need such a .tex file. I have no idea what is inside of it. But the subfigure will need some info like bounding boxes in order to scale it. Just export some simple graph from gnuplot and add it to your post.
    – LaRiFaRi
    Jul 2, 2014 at 8:55

1 Answer 1

1

There is a workaround that I tried and it works. I have put the \input inside a resizebox like this

\resizebox{\textwidth}{!}{\input{foo.tex}}

where \textwidth is half a page width because is inside subfigure environment.

I don't know if there are better solutions but this works...

Edit:

The only problem is with the labels that - I don't know why - are out of the borders and is needed to adjust manually the sizes of subfigures and the hspace between them... Still searching for better solutions... :-)

1
  • The 0.5\textwidth is giving you the problem with spaces. It is essentially a minipage. Use something like 0.47\textwidth.
    – yannisl
    Aug 1, 2014 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .