1

I'm working with LaTeX to create a document that has a three-column structure. In my layout, the first column is for topics, the second column contains a list of bullet points, and the third column includes images of varying sizes.

My LaTeX code is as follows:

\documentclass[11pt,ngerman]{moderncv}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\usepackage[UKenglish]{babel}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=2.5cm,rmargin=2.5cm}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{graphicx}
\usepackage{fontawesome5}
\usepackage{verbatim}
\newcommand{\cmmnt}[1]{}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
\providecommand{\tabularnewline}{\\}
\usepackage[super]{nth}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\moderncvtheme[blue]{classic}
\usepackage{lastpage}
\firstname{firstName}
\familyname{lastName}
\title{topic}

\address{}

\usepackage{graphicx}
\newcommand{\Csharp}{%
    {\settoheight{\dimen0}{C}C\kern-.05em \resizebox{!}{\dimen0}{\raisebox{\depth}{\#}}}}

\makeatother
\usepackage{babel}
\usepackage{xpatch}

%\usepackage[absolute,overlay]{textpos}
\usepackage{textpos}
\usepackage{wrapfig}

\xpatchcmd{\cventry}{.\strut}{\strut}{}{}
\begin{document}
    \maketitle  
\vspace{-0.9cm}


\vspace{-0.3cm}
\section{Section}
\vspace{0.2cm}

\cventry{Topic}{
    \begin{minipage}[t]{0.6\textwidth}
        \begin{itemize} 
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}%
    \hspace{-5cm}
    \begin{minipage}[t]{0.3\textwidth}
        \raggedleft 
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.5cm]{example-image-a}}
        }
    \end{minipage}
}{}{}{}{}{}



\cventry{Topic}{
    \begin{minipage}[t]{0.6\textwidth}
        \begin{itemize} 
            \item {\normalfont Point1}
            \item {\normalfont Point2}
        \end{itemize}
    \end{minipage}%
    \hspace{-4.855cm}
    \begin{minipage}[t]{0.3\textwidth}
        \raggedleft 
        \raisebox{-0.5\height}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.6cm, width=1.8cm]{example-image-a}}
        }
    \end{minipage}
}{}{}{}{}{}


\cventry{Topic}{
    \begin{minipage}[t]{0.6\textwidth}
        \begin{itemize} 
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}%
    \hspace{-3.05cm}
    \begin{minipage}[t]{0.3\textwidth}
        \raggedleft 
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.5cm]{example-image-a}}
        }
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.5cm]{example-image-b}}
        }
    \end{minipage}
}{}{}{}{}{}

\cventry{Topic}{
    \begin{minipage}[t]{0.6\textwidth}
        \begin{itemize} 
            \item {\normalfont Point1}
            \item {\normalfont Point2}
        \end{itemize}
    \end{minipage}%
    \hspace{-3.05cm}
    \begin{minipage}[t]{0.3\textwidth}
        \raggedleft 
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.5cm]{example-image-a}}
        }
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.6cm, width=1.8cm]{example-image-b}}
        }
        \raisebox{-0.5\height - 0.3cm}{ 
            \href{https://www.google.com/}{\includegraphics[height=1.5cm]{example-image-c}}
        }
    \end{minipage}
}{}{}{}{}{}

\end{document}

enter image description here

The challenge I'm facing is aligning the images in the third column with the bullet points in the second column. Specifically, I want to achieve two things:

  1. Ensure that all images in a row are vertically centered with respect to the bullet points.
  2. Align images so that the first image in each row is directly below the first image in the previous row, the second image below the second, and so on.

The images are not aligning as expected with the bullet points.

In the end, the desired outcome should look like this: enter image description here

I would greatly appreciate any guidance or suggestions on how to accomplish these alignments. Your help would be greatly appreciated!

With best regards,
Daniel

I have posted the same question here.

9
  • Welcome to TeX.SE!
    – Mensch
    Dec 20, 2023 at 20:50
  • @Mensch Thank you!
    – Daniel
    Dec 20, 2023 at 21:04
  • 1
    If you cross-post the same question on multiple sites, you should include links to all other versions of the question in every question. X-posting without explicit links has the risk of wasting both the time of users who might put time and effort into answering a post, which already has an answer elsewhere, as well as the time of users who might have the same problem but can't find the solutions you might have gotten on one of the other sites you x-posted your question Jan 3 at 16:11
  • 1
    @Daniel Thanks! Just a suggestion for your question: maybe it would be more likely that you will get solutions, if you split the different problems (adding a link and arranging the images) into separate questions and boil your code down to just the minimum necessary to reproduce the problem. Jan 3 at 17:55

1 Answer 1

2

After thorough investigation, I have developed a solution for the layout and positioning of images in the document.

enter image description here

The key aspects of this solution are:

  1. Horizontal Centering: All pictures will be horizontally centered in relation to their center point. The center of each image aligns nearly perfectly with the listing of the bullet points.

  2. Vertical Alignment: Pictures that are positioned below each other will also be centered. The middle points of each image are aligned directly underneath one another, creating a visually coherent vertical line.

  3. Adjustable Spacing: The distance between the pictures can be adjusted individually. This flexibility allows for precise control over the spacing, enabling a tailored and aesthetically pleasing layout.

This is the latex code:

\section{Section}

\newlength{\tabularcolumnwidth}
\setlength{\tabularcolumnwidth}{7cm}

\newlength{\minipagewidth}
\setlength{\minipagewidth}{2cm}

\newlength{\midoffset}
\setlength{\midoffset}{-0.25cm}


\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic1}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.5cm, width=1.5cm]{example-image-a}}}
    \end{minipage}
\end{tabular}

\vspace{1.5cm}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic2}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1cm, width=2cm]{example-image-a}}}
    \end{minipage} 
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=2cm, width=1cm]{example-image-b}}}
    \end{minipage}
\end{tabular}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic3}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
            \item {\normalfont Point4}
            \item {\normalfont Point5}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.5cm, width=1.3cm]{example-image-a}}}
    \end{minipage} 
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1cm, width=2cm]{example-image-b}}}
    \end{minipage}
& 
    \hspace{1cm}
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=3cm, width=1.8cm]{example-image-c}}}
    \end{minipage}
\end{tabular}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic4}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-a}}}
    \end{minipage} 
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \hspace{2cm}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-b}}}
    \end{minipage}
& 
    \hspace{1cm}
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-c}}}
    \end{minipage}
\end{tabular}

To insert the link icon at the bottom-right corner of an image within a table, utilize the following code snippets.

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic1}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \href{https://www.google.com/}{
            \begin{overpic}[width=1.5cm, height=1.5cm]{example-image-a}
                \put(1.5cm-0.5cm,0.0cm){\href{https://www.google.com/}{\includegraphics[height=0.5cm, width=0.5cm]{icon_symbol.png}}}
            \end{overpic}
        }
    \end{minipage}

\end{tabular}

enter image description here

Of course, this code can be improved, but it is a solid start.

This is the complete code:

\documentclass[11pt,ngerman]{moderncv}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage[UKenglish]{babel}
\geometry{verbose,tmargin=1cm,bmargin=1cm,lmargin=2.5cm,rmargin=2.5cm}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[percent]{overpic}
\usepackage{fontawesome5}
\usepackage{verbatim}
\newcommand{\cmmnt}[1]{}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
\providecommand{\tabularnewline}{\\}
\usepackage[super]{nth}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\moderncvtheme[blue]{classic}
\usepackage{lastpage}
\firstname{firstName}
\familyname{lastName}
\title{topic}

\address{}

\usepackage{graphicx}
\newcommand{\Csharp}{%
    {\settoheight{\dimen0}{C}C\kern-.05em \resizebox{!}{\dimen0}{\raisebox{\depth}{\#}}}}

\makeatother
\usepackage{babel}
\usepackage{xpatch}

%\usepackage[absolute,overlay]{textpos}
\usepackage{textpos}
\usepackage{wrapfig}

\xpatchcmd{\cventry}{.\strut}{\strut}{}{}
\begin{document}
    \maketitle  

\section{Section}
\vspace{0.2cm}

\newlength{\tabularcolumnwidth}
\setlength{\tabularcolumnwidth}{7cm}

\newlength{\minipagewidth}
\setlength{\minipagewidth}{2cm}

\newlength{\midoffset}
\setlength{\midoffset}{-0.25cm}


\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic1}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \href{https://www.google.com/}{
            \begin{overpic}[width=1.5cm, height=1.5cm]{example-image-a}
                \put(1.5cm-0.5cm,0.0cm){\href{https://www.google.com/}{\includegraphics[height=0.5cm, width=0.5cm]{example-image}}}% icon_symbol.png replaced to make the example work everywhere
            \end{overpic}
        }
    \end{minipage}

\end{tabular}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic2}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \begin{overpic}[height=1cm, width=2cm]{example-image-a}
            \put(2cm-0.5cm,0.0cm){\href{https://www.google.com/}{\includegraphics[height=0.5cm, width=0.5cm]{example-image}}}% icon_symbol.png replaced to make the example work everywhere
        \end{overpic}
    \end{minipage}
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=2cm, width=1cm]{example-image-b}}}
    \end{minipage}
\end{tabular}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic3}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
            \item {\normalfont Point4}
            \item {\normalfont Point5}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.5cm, width=1.3cm]{example-image-a}}}
    \end{minipage} 
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1cm, width=2cm]{example-image-b}}}
    \end{minipage}
& 
    \hspace{1cm}
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=3cm, width=1.8cm]{example-image-c}}}
    \end{minipage}
\end{tabular}

\begin{tabular}{p{\tabularcolumnwidth}ccc}
\cventry{Topic4}{
    \begin{minipage}[t]{0.5\textwidth}
        \begin{itemize}
            \item {\normalfont Point1}
            \item {\normalfont Point2}
            \item {\normalfont Point3}
        \end{itemize}
    \end{minipage}
}{}{}{}
&
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-a}}}
    \end{minipage} 
& 
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \hspace{2cm}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-b}}}
    \end{minipage}
& 
    \hspace{1cm}
    \begin{minipage}{\minipagewidth}
        \centering
        \vspace{\midoffset}
        \raisebox{-.5\height}{\href{https://www.google.com/}{\includegraphics[height=1.8cm, width=1.8cm]{example-image-c}}}
    \end{minipage}
\end{tabular}

\end{document}
4
  • 1
    Maybe this is a good answer. Unfortunately I cannot test it, because there isn't complete code and therefore I don't know which class and packages I would need to embed it into a document. So can you please complete the code with a document preamble usually starting with \documentclass and a document environment? Usually it helps a lot, if users can simply copy the whole thing to get a test file.
    – cabohah
    Jan 8 at 17:41
  • 1
    great suggestion! I will do that!
    – Daniel
    Jan 8 at 17:43
  • 1
    Thanks. I've also removed \usepackage[latin9]{inputenc}, because it would be wrong for TeX.SX and is not needed. And I've replaced the icon_symbol.png to make the example work everywhere (as long as mwe is installed).
    – cabohah
    Jan 9 at 8:30
  • @cabohah Thank you!
    – Daniel
    Jan 9 at 11:30

You must log in to answer this question.

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