Я пытаюсь разобраться, как располагать и центрировать вещи.
Здесь я разместил два очень больших PDF-файла рядом. Я уменьшил их до текущего размера и попытался отцентрировать:
\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
%, и вы просто хотите, чтобы это выглядело примерно так:
Обратите внимание, что страница идеально симметрична относительно положения двух рисунков, а излишки равномерно распределены между полями?
Как мне этого добиться? Я думал, что мое использование 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: используйте соответствующую ширину для мини-страниц, но не забывайте о внешнем разделителе на случай, если вы будете использовать всю ширину команды \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}