我正在创建一个相册模板,使用 minipage 在每一页插入一张图片。
我遇到的问题是无法使用 geometry 包获得一致的边距。我的直觉是 minipage 正在添加一些空间,并且我收到一些警告,我认为这些警告与此问题有关:
Overfull \hbox (15.0pt too wide) in paragraph
我已经检查了其他类别,例如 photobook 和 pagelayout,但我无法做到我想要的,基本上就是我在下面代码中设计的:一本 A4 书,双面,1 页 = 1 张照片(可以是水平或垂直),以及一个可选标题。
感谢您的任何帮助和建议。
\documentclass[a4paper,twoside]{book}
\usepackage{geometry}
\geometry{
layout=a4paper,
ignoreall,
top=5em,
bottom=5em,
left=5em,
right=5em
}
\usepackage[utf8]{inputenc}
\usepackage[english, italian]{babel}
\usepackage{calc} % Package to calculate dimensions
\usepackage{layout}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage[sfdefault,book]{FiraSans} %% option 'sfdefault' activates Fira Sans as the default text font
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
\graphicspath{ {images/} }
% Hide page numbers
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}
% Inserts a blank page
\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}
\usepackage{titlesec} % Package to customize the style of chapter titles
% Set the style of chapter titles
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries\raggedleft}
{}
{0pt}
{\vfill\MakeUppercase} % Chapter are uppercase
[\vfill\thispagestyle{empty}] % Remove page number
% Begin of documennt
\begin{document}
% To print current layout
\frontmatter %First pages without page numbers
\title{My photobook}
\author{Author}
\date{September 2023}
\maketitle
\mainmatter %Main content with first chapter
% Page for dedicating the book to someone
\thispagestyle{empty} % Hide
\begin{flushright}
\vspace*{\stretch{1}} % Blank space that takes up all the rest of the page
\emph{Dedicated to anyone}\\
\emph{you want to dedicate this page.}
\vspace*{\stretch{2}} % Blank space to push text to the upper right.
\end{flushright}
% First chapter
\chapter*{Chapter Title}
\newpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{6032x4032.png}
1 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{4032x6032.png}
%1 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{6032x4032.png}
2 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{6032x4032.png}
2 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{4032x6032.png}
2 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{6032x4032.png}
2 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\chapter*{Another Chapter}
\newpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{4032x6032.png}
2 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\begin{minipage}[t][\textheight][t]{\textwidth}
\includegraphics[width=\textwidth]{6032x4032.png}
3 My beautiful caption that can probably span more lines, as it can be very very long because I don't know what I'm going to write here as it depends from my creativity and information I want to write here.
\end{minipage}
\clearpage
\chapter*{Layout}
\newpage
\layout
\end{document}
答案1
您既不需要,minipage
也不需要figure
。
对于这个应用程序parskip
,我建议改为。
\documentclass[a4paper,twoside]{book}
\usepackage{geometry}
\geometry{
layout=a4paper,
ignoreall,
top=5em,
bottom=5em,
left=5em,
right=5em
}
%\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[sfdefault,book]{FiraSans} %% option 'sfdefault' activates Fira Sans as the default text font
\usepackage[english, italian]{babel}
\usepackage{titlesec} % Package to customize the style of chapter titles
\usepackage{graphicx}
\usepackage{parskip}
\usepackage{layout}% just for debugging
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
% Hide page numbers (make plain style the same as empty)
\pagestyle{empty}
\ExpandArgs{cc}\RenewCommandCopy{ps@plain}{ps@empty}
% Set the style of chapter titles
\titleformat{\chapter}[display]
{\normalfont\Huge\bfseries\raggedleft}
{}
{0pt}
{\vfill\MakeUppercase} % Chapter are uppercase
\setcounter{secnumdepth}{-1} % chapters won't be numbered
\setcounter{tocdepth}{0} % chapters go in the TOC
\begin{document}
\frontmatter
\title{My photobook}
\author{Author}
\date{September 2023}
\maketitle
\mainmatter
% Page for dedicating the book to someone
\thispagestyle{empty} % Hide
\begin{flushright}
\vspace*{\stretch{1}} % Blank space that takes up all the rest of the page
\emph{Dedicated to anyone}\\
\emph{you want to dedicate this page.}
\vspace*{\stretch{2}} % Blank space to push text to the upper right.
\end{flushright}
% First chapter
\chapter{Chapter Title}
\clearpage
\includegraphics[width=\textwidth]{example-image}
1 My beautiful caption that can probably span more lines,
as it can be very very long because I don't know what I'm
going to write here as it depends from my creativity and
information I want to write here.
\clearpage
\includegraphics[width=\textwidth]{example-image-a}
My beautiful caption that can probably span more lines,
as it can be very very long because I don't know what I'm
going to write here as it depends from my creativity and
information I want to write here.
\clearpage
\includegraphics[width=\textwidth]{example-image-a}
My beautiful caption that can probably span more lines,
as it can be very very long because I don't know what I'm
going to write here as it depends from my creativity and
information I want to write here.
\chapter{Another Chapter}
\clearpage
\includegraphics[width=\textwidth]{example-image}
1 My beautiful caption that can probably span more lines,
as it can be very very long because I don't know what I'm
going to write here as it depends from my creativity and
information I want to write here.
\clearpage
\includegraphics[width=\textwidth]{example-image-a}
My beautiful caption that can probably span more lines,
as it can be very very long because I don't know what I'm
going to write here as it depends from my creativity and
information I want to write here.
\clearpage
\chapter{Layout}
\clearpage
\layout
\end{document}