そこで、クリスマス カードのようなビジュアル レイアウトに取り組もうとしています。アイデアとしては、写真を左上隅と右下隅に配置し、家族の名前と日付を右上の四分円の中央に配置することです。テキストを水平に中央に配置することはできますが、左上画像の下部 (右下画像の真上) と一列に並んでしまいます。テキストが上部画像の中央を通る線上にくるように移動できる方がいらっしゃれば、大変助かります。
\includegraphics[scale = 0.15]{Family.jpg} \hspace{\fill\textbf{\textsc{\Large{FamilyNameHere\\Date}}}\hspace*{\fill}
\newline
\hspace*{\fill}\includegraphics[scale = 0.05]{Family2.jpg}
答え1
グラフィックスの中央揃えは、次の方法で簡単に実現できます。adjustbox
は、valign
キーと値のオプションを提供します。以下は、あなたのケースでの使用法を示す最小限の例です。
\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}
tabular
デフォルトの垂直方向の配置は中央揃えなので、姓と日付の構造化には を使用しました。
adjustbox
オプションをロードすると[export]
、そのキーが利用可能になります。graphicx
パッケージ。
答え2
tikz
解決策はここにあります
\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}
答え3
追加パッケージを使用しない簡単な解決策は、カードを 4 つに分割することですminipage
。デフォルトでは、ミニページは垂直方向に中央揃えされるため、画像やその他のものを中央揃えにすることができます。
\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}
明らかに、この場合の空のミニページは、\raggedleft
最後のミニページを右揃えにするために、または他の何かに安全に置き換えることができますが、ここに何らかのテキストや装飾を追加したい場合もあります。