物事をどのように配置し、中央に配置するかという点を徹底的に理解しようとしています。
ここでは、非常に大きな PDF を 2 つ並べて配置しました。現在のサイズに縮小し、中央に配置してみました。
\documentclass{article}
\usepackage[margin=1in,showframe]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering
\begin{figure}
%
\centering
\begin{minipage}[c][1\totalheight][t]{0.45\textwidth}%
\begin{center}
{\includegraphics[scale=0.085]{diagrams/pdf/square.pdf}}
\end{center}
\caption{I sit hard up against the left margin}
\end{minipage}\hfill{}%
%
\begin{minipage}[c][1\totalheight][t]{0.45\textwidth}%
\begin{center}
{\includegraphics[scale=0.085]{diagrams/pdf/square.pdf}}
\end{center}
\caption{I hang over the edge of the right margin}
\end{minipage}\hfill{}%
%
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
一応は機能しますが、右余白からはみ出しているだけなので、完全に中央揃えにはなりません。さらに縮小すると、問題がなくなるポイントがありますが、0.085
% より小さくするのは現実的ではなく、次のように見えるようにしたいとします。
2 つの図の位置に関してページが完全に対称になっており、余分な部分が余白間で均等に分散されていることに注目してください。
これを実現するにはどうすればいいでしょうか? を使用すれば解決minipage
できると思っていましたが、そうではないようです。
答え1
使用方法は次のとおりですこの答え。
\documentclass{article}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering
\begin{figure}
%
\hspace{-0.025\textwidth}\makebox[1.05\textwidth][c]{
\noindent\begin{minipage}[t,outer sep=0]{0.45\textwidth}%
\begin{center}
{\includegraphics[width=\textwidth]{example-image-a}}
\end{center}
\caption{I sit hard up against the left margin}
\end{minipage}\hfill%
%
\begin{minipage}[t,outer sep=0]{0.45\textwidth}%
\begin{center}
{\includegraphics[width=\textwidth]{example-image-b}}
\end{center}
\caption{I hang over the edge of the right margin}
\end{minipage}}%
%
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
出力:
PS1: コマンドがボックスを作成すると、テキスト\makebox
幅の後に追加されます...したがって、半分に減らします1.05\textwidth
0.05\textwidth
\hspace{-0.025\textwidth}
PS2: ミニページには適切な幅を使用しますが、コマンドの幅全体を使用する場合は外側の sep に注意してください\makebox
。
編集: より良い方法:
\documentclass{article}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\centering
\begin{figure}
%
\noindent\makebox[\textwidth][c]{
\noindent\begin{minipage}[t,outer sep=0]{0.525\textwidth}%
\begin{center}
{\includegraphics[width=\textwidth]{example-image-a}}
\end{center}
\caption{I sit hard up against the left margin}
\end{minipage}\hspace{0.5cm}%
%
\begin{minipage}[t,outer sep=0]{0.525\textwidth}%
\begin{center}
{\includegraphics[width=\textwidth]{example-image-b}}
\end{center}
\caption{I hang over the edge of the right margin}
\end{minipage}}%
%
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}