1

I have the following title with bad alignments.

\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm]{geometry}

\pagestyle{empty}

\begin{document}

\begin{minipage}[r]{0.19\textwidth}
  \rule{30mm}{30mm}
\end{minipage}%
\hfill
\begin{minipage}[c]{0.58\textwidth}
  \begin{center}
    {\Huge Title}
  \end{center}
\end{minipage}%
\hfill
\begin{minipage}[r]{0.19\textwidth}
  \rule{30mm}{30mm}
\end{minipage}%

\end{document}

enter image description here How can we make same the distances marked by red color?

  • What do you need the minipages for? – Skillmon May 29 '17 at 19:34
  • I am preparing a certificate of participation. Two different logos of the same size appear on the sides and a title in the middle. – bkarpuz May 29 '17 at 19:35
  • Why not use a table? I recommend you calculate the width of the logo using the calc package using \widthof{<argument>} and then use a newlength for it. – azetina May 29 '17 at 19:37
  • @azetina I won't recommend that. The placement can be done easier, I think. – Skillmon May 29 '17 at 19:38
  • Logos are 3cm by 3cm. – bkarpuz May 29 '17 at 19:38
3

Note that the reason why your example was not giving the desire result was because 0.19\textwidth was much larger than 30mm which \rule{30mm}{30mm} is.

enter image description here

Here is mwe:

\documentclass[a4paper,12pt]{article}
\usepackage[showframe,landscape,margin=10mm]{geometry}
\usepackage{calc}

\pagestyle{empty}
\newcommand{\logo}{\rule{30mm}{30mm}} % More than likely an \includegraphics here

\newlength\logowidth
\setlength{\logowidth}{\widthof{\logo}} % Place the logo declaration here

\begin{document}
\noindent
\begin{minipage}[c]{\logowidth}
  \logo
\end{minipage}\hfill
\begin{minipage}[c]{0.58\textwidth}
  \begin{center}
    {\Huge Title}
  \end{center}
\end{minipage}\hfill
\begin{minipage}[c]{\logowidth}
  \logo
\end{minipage}

\end{document}

enter image description here

Here is a version with graphics:

\documentclass[a4paper,12pt]{article}
\usepackage[showframe,landscape,margin=10mm]{geometry}
\usepackage{calc}
\usepackage{mwe} % For graphics purpose only.

\pagestyle{empty}
\newcommand{\logo}{\includegraphics[width=30mm]{example-image-a}}

\newlength\logowidth
\setlength{\logowidth}{\widthof{\logo}}

\begin{document}
\noindent
\begin{minipage}[c]{\logowidth}
  \logo
\end{minipage}\hfill
\begin{minipage}[c]{0.58\textwidth}
  \begin{center}
    {\Huge Title}
  \end{center}
\end{minipage}\hfill
\begin{minipage}[c]{\logowidth}
  \logo
\end{minipage}

\end{document}

enter image description here

3

I can propose a simple solution with tabularx:

\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm, showframe]{geometry}
\usepackage{tabularx}
\pagestyle{empty}

\begin{document}

{\renewcommand\tabularxcolumn[1]{>{\centering\huge\arraybackslash}m{#1}}
\noindent\begin{tabularx}{\linewidth}{@{\hspace{\parindent}}m{30mm}Xm{30mm}@{\hspace{\parindent}}}
  \rule{30mm}{30mm} & Title & \rule{30mm}{30mm}
\end{tabularx}}

\end{document} 

enter image description here

3

And a third possibility using no packages (except graphicx and geometry):

\documentclass[a4paper,12pt]{article}
\usepackage[landscape,margin=10mm]{geometry}
\usepackage{graphicx}

\pagestyle{empty}

\begin{document}
\hbox to \textwidth{%
\includegraphics[width=30mm, height=30mm]{example-image-a}%
\hfill%
\parbox[b][30mm][c]{0.58\textwidth}{\centering\Huge Title}% change the width of the parbox to your liking
\hfill%
\includegraphics[width=30mm, height=30mm]{example-image-b}%
}
\end{document}

enter image description here

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.