私は LaTeX を使用して、3 列構造のドキュメントを作成しています。レイアウトでは、最初の列はトピック用、2 番目の列には箇条書きのリストが含まれ、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}
私が直面している課題は、3 列目の画像を 2 列目の箇条書きに合わせることです。具体的には、次の 2 つのことを実現したいと考えています。
- 行内のすべての画像が箇条書きに対して垂直方向に中央に配置されていることを確認します。
- 各行の最初の画像が前の行の最初の画像の真下に配置され、2 番目の画像が 2 番目の画像の下に配置され、というように画像を配置します。
画像が箇条書きと期待どおりに揃っていません。
これらの調整を実現する方法についてのアドバイスや提案をいただければ幸いです。ご協力いただければ幸いです。
よろしくお願いいたします、
ダニエル
同じ質問を投稿しましたここ。
答え1
徹底的な調査を行った結果、文書内の画像のレイアウトと配置に関するソリューションを開発しました。
このソリューションの主な側面は次のとおりです。
水平方向の中央揃え: すべての画像は、中心点を基準に水平方向に中央揃えされます。各画像の中心は、箇条書きのリストとほぼ完全に一致します。
垂直配置: 上下に配置されている画像も中央に配置されます。各画像の中心点が互いの真下に揃うため、視覚的に一貫性のある垂直線が作成されます。
調整可能な間隔: 写真間の距離を個別に調整できます。この柔軟性により、間隔を正確に制御し、カスタマイズされた美しいレイアウトを実現できます。
これは LaTeX コードです:
\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}