1

I want to align horizontally two images, but I am not able to this in this case:

\begin{figure}[!hbt]
    \centering
    \subfigure[][Areas used to evaluate the interpolant parameter function.]{
    \includegraphics[scale=1]{Imagens/Poly_Elem.pdf}}
    \label{fig.:PolyElem} \qquad
    \subfigure[][Triangulation on the reference polygon and integration points.]{
    \includegraphics[scale=1]{Imagens/Poly_Triang_Elem.pdf}}
    \label{Polygonal element shape function.} \qquad
    \caption{Polygonal element shape function.}
    \label{fig.:PolyElemData}
\end{figure}

I get the following result:

Wrong alignment

Does anyone know how I can get the alignment I want? I must use the subfigure, because of the document class I must use.

  • Please provide an example we can compile by completing your code to make a minimal document. What are you trying to align exactly? Those look aligned to me. Try putting an \fbox around them to check. – cfr Jul 17 '18 at 3:13
  • Please note that the subfigure package is deprecated and the linked CTAN page recommends the use of the subcaption package. Regarding your question: Since the two images are constructed with different bounding boxes (the first with $p_i$ at the bottom and the second with $s$ on top), the solution would be either to edit your raw images to get their center at the same height, or to manually adjust their heights when imported. – Ruixi Zhang Jul 17 '18 at 3:15
0

I'm taking a guess that you want the hexagons to align vertically; your figures already seem aligned horizontally. If this is the case, you may need to rephrase your question. Here is an answer using raisebox, as well as some minor changes to your code, and an MWE.

Note, I created the images by cutting the individual figures from your image to two new images, and called them n_one and n_two.

Applying raisebox to your second figure shifts it vertically. There is also some \hspace applied between the figures.

\documentclass[12pt,border=2cm]{article}
\usepackage{graphicx}
\usepackage{subfigure}
\begin{document}
\begin{figure}[]
    \centering
    \subfigure[Areas used to evaluate the interpolant parameter function.]
    {
        \label{fig.:PolyElem}\includegraphics{n_one.pdf}
    }\hspace{2cm}
    \subfigure[Triangulation on the reference polygon and integration points.]
    {
        \label{Polygonal element shape function.}\raisebox{2.2ex}{\includegraphics{n_two.pdf}}
    }
    \caption{Polygonal element shape function.}
    \label{fig.:PolyElemData}
\end{figure}
\end{document}

This gives: enter image description here

  • Thanks @Dunk the Lunk! I works, although I must find the distance used in \raiseboxby trial and error. – André Xavier Jul 17 '18 at 20:37
  • @AndréXavier, it's still fairly easy and quick to do, even though its manual. Another option is to use an identical white rectangle in the background for each figure in your drawing app. Then align your figures within their respective rectangles. When you export your separate figures (including the white background rectangle), they should be aligned with respect to that background rectangle. When you import them to latex they should be aligned as long as you don't resize individual figures. – Dunk the Lunk Jul 18 '18 at 3:11
  • I have tried that as well! But in some cases, the way you have shown is the easiest one. So, thanks for your help again! – André Xavier Jul 18 '18 at 12:22

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.