6

So I'm trying to work on a visual layout for a kind of Xmas card. The idea is to have a pictures in the upper left and lower right corners with the family name and date centered in the upper right quadrant. I can get the text centered horizontally, but it lines up with the bottom of the top left image (right above the bottom right image). If anyone could help me move it so the text is on a line going through the center of the top image that would be great:

\includegraphics[scale = 0.15]{Family.jpg} \hspace{\fill\textbf{\textsc{\Large{FamilyNameHere\\Date}}}\hspace*{\fill}
\newline
\hspace*{\fill}\includegraphics[scale = 0.05]{Family2.jpg}

3 Answers 3

5

Centred vertical alignment of graphics is easily obtained with the help of adjustbox, which provides the valign key-value option. Below is a minimal example showing its use in your case:

enter image description here

\documentclass{article}
\usepackage[export]{adjustbox}% adjustbox loads graphicx
\begin{document}

\noindent
\includegraphics[width=.5\linewidth,valign=c]{example-image-a}%
\hfill
{\Large\bfseries
\begin{tabular}{c}
  Family Name Here \\
  Date
\end{tabular}}\hspace*{\fill}

\hfill
\includegraphics[width=.5\linewidth]{example-image-b}

\end{document}

I've used a tabular to structure the family name and date, since the default vertical alignment is centred.

Loading adjustbox with the [export] option makes its keys available to the graphicx package.

3

Here is a tikz solution

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
  \node[inner sep=0pt,outer sep=0pt,text width=0.5\textwidth] (a)
       {\includegraphics[width=\linewidth]{example-image-a}};
  \node[outer sep=0pt,text width=0.5\textwidth,align=center,anchor=west]
        at (a.east) {Family Name Here \\
                             Date};
  \node[inner sep=0pt,outer sep=0pt,text width=0.5\textwidth,anchor=north west]
        at (a.south east) {\includegraphics[width=\linewidth]{example-image-b}};
\end{tikzpicture}

\end{document}

enter image description here

1

A simple solution without additional packages is split your card in four minipages. By default the minipages are centered vertically, so this work to center images and/or anything else.

\documentclass{article}
\usepackage{graphicx}
\def\Img#1{\includegraphics[width=\linewidth]{example-image-#1}}
\def\Family{\centering\Large\textsc{Family Name Here}\\[1em]\textit\today} 
\begin{document}
\parindent0pt
\begin{minipage}{.5\linewidth} \Img{a} \end{minipage}%
\begin{minipage}{.5\linewidth} \Family \end{minipage}\\[-1pt]
\begin{minipage}{.5\linewidth} ~ \end{minipage}%
\begin{minipage}{.5\linewidth} \Img{c} \end{minipage}\par
\end{document}

Obviously, the empty minipage in this case could be safely replaced by \raggedleft or anything else to align the last minipage to the right, but may be you want add here some text or decoration. MWE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .