LaTeX를 사용하여 3열 레이아웃에서 글머리 기호로 이미지 정렬

LaTeX를 사용하여 3열 레이아웃에서 글머리 기호로 이미지 정렬

저는 LaTeX를 사용하여 3열 구조의 문서를 만들고 있습니다. 내 레이아웃에서 첫 번째 열은 주제를 위한 것이고, 두 번째 열은 글머리 기호 목록을 포함하고, 세 번째 열은 다양한 크기의 이미지를 포함합니다.

내 LaTeX 코드는 다음과 같습니다.

\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}

여기에 이미지 설명을 입력하세요

제가 직면한 문제는 세 번째 열의 이미지를 두 번째 열의 중요 항목과 정렬하는 것입니다. 구체적으로 저는 다음 두 가지를 달성하고 싶습니다.

  1. 연속된 모든 이미지가 글머리 기호를 기준으로 수직 중앙에 위치하는지 확인하세요.
  2. 각 행의 첫 번째 이미지가 이전 행의 첫 번째 이미지 바로 아래에, 두 번째 이미지가 두 번째 이미지 바로 아래에 오도록 이미지를 정렬합니다.

이미지가 글머리 기호와 예상대로 정렬되지 않습니다.

결국 원하는 결과는 다음과 같아야 합니다. 여기에 이미지 설명을 입력하세요

이러한 조정을 수행하는 방법에 대한 지침이나 제안을 주시면 대단히 감사하겠습니다. 귀하의 도움에 크게 감사하겠습니다!

감사합니다,
다니엘

같은 질문을 올렸어요여기.

답변1

철저한 조사 끝에 문서의 이미지 레이아웃과 위치 지정을 위한 솔루션을 개발했습니다.

여기에 이미지 설명을 입력하세요

이 솔루션의 주요 측면은 다음과 같습니다.

  1. 수평 센터링: 모든 사진은 중심점을 기준으로 수평 중앙에 배치됩니다. 각 이미지의 중앙은 글머리 기호 목록과 거의 완벽하게 정렬됩니다.

  2. 수직 정렬: 서로 아래에 위치한 그림도 가운데에 맞춰집니다. 각 이미지의 중간 지점은 서로 바로 아래에 정렬되어 시각적으로 일관된 수직선을 만듭니다.

  3. 조정 가능한 간격: 사진 사이의 거리를 개별적으로 조정할 수 있습니다. 이러한 유연성을 통해 간격을 정밀하게 제어할 수 있어 미학적으로 만족스러운 맞춤형 레이아웃이 가능해집니다.

라텍스 코드는 다음과 같습니다.

\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}

표 내 이미지의 오른쪽 하단에 링크 아이콘을 삽입하려면 다음 코드 조각을 활용하세요.

\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}

여기에 이미지 설명을 입력하세요

물론 이 코드는 개선될 수 있지만 이는 확실한 시작입니다.

완전한 코드는 다음과 같습니다.

\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}

관련 정보