Place three different Sized Logo horizontally

graphicshorizontal alignmentpositioningtablestabularx

I am trying to create a simple cover page, which will have 3 logos at the top. The left one flush with left margin, the right one flush with right and the centre one at the centre. It has proven to be very hard. The following figure shows roughly what I want.
This is what I want
I have tried subcaption/subfigure method, tabular/tabularx method. But none of them works as desired.

'''

\documentclass{article}
\usepackage{tabularx}
\usepackage{geometry} %for customizing page layout
    \newgeometry{tmargin=2.5cm,bmargin=2.5cm,lmargin=3cm,rmargin=3cm}
\usepackage{booktabs}
\usepackage{graphicx}



\begin{document}

\begin{tabularx}{1\linewidth}{|*{3}{X|}}
\centering
\includegraphics[height=1cm]{images/logo1.jpg} &
\includegraphics[height=1.2cm]{images/logo2.png}&
\includegraphics[height=1.2cm]{images/logo3.png}&
\end{tabularx}
\vspace{2cm}

\end{document}  
    

'''
After the code one can type some gibberish, to see the margins of the text (as shown in the figure that shows the result of my code).
my result

I shall also provide the three logo files for image size and applicability of code. I hope this is in accordance to the community posting guidelines. I am quite new to latex. Thanks in advance.

logo1

logo2

logo3

All three logos should have a similar height (despite having different aspect ratios, their width can be different though). I have used 1.2cm, 1.2cm and 1 cm respectively.

NOTE: UPDATE: I would like top place the centre image with equal whitespace with the other ones. However, it would be great if the method suggested has some flexibility to add a bit of hspace.

Best Answer

If you're sure that your images don't overlap, you can just do

\noindent
\makebox[\textwidth][s]{%
  % first image flush left
  \makebox[0pt][l]{\includegraphics[height=1cm]{images/logo1.jpg}}%
  \hfil
  % second image centered
  \includegraphics[height=1.2cm]{images/logo2.png}%
  \hfil
  % third image flush right
  \makebox[0pt][r]{\includegraphics[height=1.2cm]{images/logo3.png}}%
}

I add here a full example using geometry to increase the width.

\documentclass{article}
\usepackage[a4paper,margin=2cm,showframe]{geometry}
\usepackage{graphicx}

\begin{document}

\noindent
\makebox[\textwidth][s]{%
  % first image flush left
  \makebox[0pt][l]{\includegraphics[height=1cm]{images/logo1.jpg}}%
  % a possible correction to move the center image a bit to the right
  \hspace{0pt}% here 0pt because there's no overlap
  \hfil
  % second image centered
  \includegraphics[height=1.2cm]{images/logo2.png}%
  \hfil
  % third image flush right
  \makebox[0pt][r]{\includegraphics[height=1.2cm]{images/logo3.png}}%
}

\vspace{2cm}

\begin{center}
\Huge Title
\end{center}

\end{document}

The showframe option is used to show the alignment with respect to the page margin.

enter image description here

You might choose instead to move the external logos a bit outside the page margin.

\documentclass[a4paper]{article}
\usepackage[pass,showframe]{geometry}
\usepackage{graphicx}

\begin{document}

\noindent
\makebox[\textwidth][s]{%
  % first image flush left but moved somewhat outside the margin
  \hspace{-4em}%
  \makebox[0pt][l]{\includegraphics[height=1cm]{images/logo1.jpg}}%
  \hfil
  % second image centered
  \includegraphics[height=1.2cm]{images/logo2.png}%
  \hfil
  % third image flush right but moved somewhat outside the margin
  \makebox[0pt][r]{\includegraphics[height=1.2cm]{images/logo3.png}}%
  \hspace{-4em}%
}

\vspace{2cm}

\begin{center}
\Huge Title
\end{center}

\end{document}

Here geometry does not act on the default page dimensions, it is just loaded for the showframe option.

enter image description here

Related Question