2

I've been having some trouble aligning multiple figures. The problem is present with png figures and tikz figures, so I guess I am missing something.

tikz figures not properly aligned: enter image description here

the particular bit of code:

\begin{figure}
    \centering
    \input{figs/grf_left_fb.tikz}
    \input{figs/grf_fb.tikz}   
    \input{figs/phase_fb.tikz}
    \input{figs/zap_fb.tikz}
    \caption{......}
    \label{fig:feedback}
\end{figure}

and with png figures (both vertical and horizontal alignment needed):

enter image description here

\begin{figure}
    \centering
    \includegraphics[scale=0.25]{figs/s1.eps}
    \includegraphics[scale=0.25]{figs/s2.eps}
    \includegraphics[scale=0.25]{figs/s3.eps}
    \includegraphics[scale=0.25]{figs/s11.eps}
    \includegraphics[scale=0.25]{figs/s28.eps}
    \caption{S..........}
    \label{fig:data_good_bad}
\end{figure}
  • 1
    Put \fbox{} around each figure to see where the bounding boxes are. Probably there are different amounts of white space being included. Otherwise, provide a complete Minimum Working Example people can actually compile to reproduce the problem. You can use images from the mwe package for this purpose. – cfr Sep 17 '14 at 20:49
  • I think the first problem can be solved with a right aligned tabular and the second one with two more tabulars (or tabularx), the second one with top aligned columns – Ignasi Sep 18 '14 at 06:52

2 Answers2

1

Your pictures are aligned exactly as you request: in centre of text width. I suspect, that you wish, that the right borders of them also be aligned. This you can accomplish with putting each picture in minipage (or equivalent parabox) where they are aligned to right, and than all mini pages to centre.

Edit: I replace my example with MWE which contain solution for first part of align problem and second part of align problem

\documentclass{article}
    \usepackage{tikz,graphicx,lipsum}

\begin{document}
\lipsum[7]
    \begin{figure}[h]\centering
\begin{minipage}{77mm}\raggedleft
    \tikz\node[draw,
               minimum width=55mm, minimum height=11mm] {picture 1};
\end{minipage}\medskip

\begin{minipage}{77mm}\raggedleft
    \tikz\node[draw,label=left:label,
               minimum width=55mm, minimum height=11mm] {picture 2};
\end{minipage}
    \caption{very important figures ...}
    \label{fig:data ...}
    \end{figure}
\lipsum[7]
    \begin{figure}[h]\centering
\begin{minipage}[b][22mm][t]{55mm}
    \tikz\node[draw,
               minimum width=44mm, minimum height=11mm] {picture 3};
\end{minipage}
    \hfil
\begin{minipage}[b][22mm][t]{55mm}
    \tikz\node[draw,label=below:label,
               minimum width=44mm, minimum height=11mm] {picture 4};
\end{minipage}
    \caption{another very important figures ...}
    \label{fig:data ...}
    \end{figure}
\end{document}

Environment minipage actually has three parameters.

\begin{minpage}[<position>][height][inner position]{<width>} 
    text: your image 
\end{minipage}

equivalent result will give \parbox with similar syntax:

\parbox[<position>][height][inner position]{<width>}{ text: your image }
Zarko
  • 296,517
1

A possible solution with tabulars

\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[export]{adjustbox}
\usepackage{mwe}

\begin{document}
\lipsum[1]
\begin{center}
\begin{tabular}{r}
\includegraphics[height=1cm,width=5cm]{example-image-a}\\
\includegraphics[height=1cm,width=5.5cm]{example-image-a}\\
\includegraphics[height=1cm,width=4cm]{example-image-a}\\
\includegraphics[height=1cm,width=5cm]{example-image-a}\\
\end{tabular}
\end{center}

\begin{center}
\begin{tabularx}{\linewidth}{XXX}
\includegraphics[height=1cm,width=3cm]{example-image-a} & 
\includegraphics[height=1cm,width=3cm]{example-image-a} &
\includegraphics[height=1cm,width=3cm]{example-image-a}\\
\end{tabularx}

\begin{tabularx}{\linewidth}{>{\raggedleft\arraybackslash}X>{\raggedright\arraybackslash}X}
\includegraphics[height=1cm,width=3cm,valign=t]{example-image-a} & 
\includegraphics[height=2cm,width=3cm,valign=t]{example-image-a}\\
\end{tabularx}
\end{center}
\end{document}

enter image description here

Ignasi
  • 136,588