0

I have used \subfigure to align figure side by side. The figure is a graph and is in .tex file form. Thus instead of using \includegraphics, i have used \input. The problem is the graph is in different line as seen in attached picture using the following code. Can it be placed side by side? Do i have to convert tex file in pdf?

\begin{figure*}
  \begin{subfigure}[b] {-1\linewidth} 
    \input{fig1}
    \label{fig:1}
  \end{subfigure}
  \begin{subfigure}[b]{1\linewidth}
    \input{fig2}
    \label{fig:2}
  \end{subfigure}
  \caption{ABC}
\end{figure*}

UPDATE: The graph is created using gnuplot and converted to .tex file

This is the output

  • Welcome to TeX.SX! Do not use the full line width, but only a fraction (2 line widths do not fit into one). – TeXnician Aug 26 '18 at 17:25
1

Your syntax is wrong. You should use only a fraction of the line width as width of the individual subfigures.

Example:

\begin{figure*}
  \begin{subfigure}[b]{.45\linewidth} 
    \input{fig1}
    \label{fig:1}
  \end{subfigure}
  \begin{subfigure}[b]{.45\linewidth}
    \input{fig2}
    \label{fig:2}
  \end{subfigure}
  \caption{ABC}
\end{figure*}
  • Thank you very much. I tried with 0.4 but the figures were in different lines. So I went with a weird number as 1 and -1 to check what it happens. It works . It would be awesome if you can point me to the documentation or elaborate on use of linewidth. – Sohil Aug 26 '18 at 17:31
  • @Sohil There is no documentation that would describe any further use: subfigure takes a length as its argument. \linewidth is the length determining the width of the current line and a factor before that scales this length. – TeXnician Aug 26 '18 at 17:35

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.