[Tex/LaTex] Pdf+Tex – figures side by side with minipage

minipagesidebyside

This is a working example of putting two pdf-figures side by side with minipage:

\begin{figure}[htbp]
\begin{center}

\begin{minipage}[t]{0.44 \textwidth}
   \includegraphics[scale=0.55]{1.pdf} 
\end{minipage}

\begin{minipage}[t]{0.47\textwidth}
   \includegraphics[scale=0.55]{2.pdf}
\end{minipage}

\end{center}
\end{figure}

However, using instead pdf+tex pictures I can't use the option "scale" anymore, since only the pdf-file becomes smaller, but not the text in the tex-file.
Instead I am using the command resizebox, but I am not able to put two pdf+tex figures next to each other (side by side) with minipage.

In this example one pdf+tex figure is below the other one:

\begin{figure}[htbp]
\begin{center}

\begin{minipage}[h]{0.47 \textwidth}
  \def\svgwidth{3.8in}
  \resizebox{!}{0.3\paperheight}{\input{picture1.tex}}
     \label{fig:pic1}
\end{minipage}

\begin{minipage}[h]{0.47 \textwidth}
  \def\svgwidth{2.3in}
  \resizebox{!}{0.3\paperheight}{\input{picture2.tex}}
     \label{fig:pic2}
\end{minipage}

\end{center}
\end{figure}   

No effect had the change of textwidth to linewidth.

Best Answer

First of all: Your initial example shouldn't work - there must not be an empty line between two minipage environments when you want them to be put next to each other. But leaving that out, this works fine:

\documentclass{article}
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.44 \textwidth}
   \includegraphics[scale=0.55]{1.pdf} 
\end{minipage}
\hfill
\begin{minipage}[t]{0.47\textwidth}
   \includegraphics[scale=0.55]{2.pdf}
\end{minipage}
\end{figure}
\end{document}

enter image description here

To your actual question: When going from \includegraphics to \input (e.g. when having a SVG exported with Inkscape to PDF+TeX), you have three options:

  1. \scalebox{0.55}{\input{mypicture.tex}} to scale the image by some factor (this is closest to what you were doing above).
  2. \resizebox{0.44\textwidth}{!}{\input{mypicture.tex}} to resize the picture to some fixed width.
  3. \resizebox{!}{0.3\textheight}{\input{mypicture.tex}} to resize the picture to some fixed height.

I would always suggest to use option 2, i.e. to specify the width of the inputed part, because you can easily synchronize that with the width of your minipage environments. Actually, \textwidth inside a minipage will always be the full size of the minipage. Example (without \input but the principle of resizebox is the same):

\documentclass{article}
\usepackage{graphicx}

\begin{document}
\begin{figure}[htbp]
\centering
\begin{minipage}[t]{0.44\textwidth}
    \resizebox{\textwidth}{!}{\includegraphics{example-image-a}}
\end{minipage}
\hfill
\begin{minipage}[t]{0.47\textwidth}
    \resizebox{\textwidth}{!}{\includegraphics{example-image-b}}
\end{minipage}
\end{figure}
\end{document}

enter image description here