2

I'm creating a template for a photo book using minipage to insert a picture in each page.

The problem I have is that I cannot get consistent margin using the geometry package. My gut is that the minipage is adding some space and I get some warning that I think are related to the this issue:

Overfull \hbox (15.0pt too wide) in paragraph

I already checked other classes like photobook and pagelayout but I cannot do what I want that basically is what I designed withi the code below: an A4 book, 2 sided, 1 page = 1 photo (the can be horizontal or vertical), and an optional caption.

Thanks for any help and suggestions.

\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}
4
  • 1
    That's the paragraph indentation. But do you need the minipage?
    – egreg
    Sep 17 at 22:01
  • Thanks, but how can I change it? I'm not a LaTeX expert so I don't know why I need a minipage :) But it works. Can you suggest a better way to achieve a similar result? Sep 18 at 7:39
  • To not use the minipage, I'm trying with: ` \begin{figure}[t] \includegraphics[width=\textwidth]{6032x4032.png} \caption{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{figure} ` but they float in the center of the page, and I want the picture always aligned on top. Sep 18 at 7:46
  • You need neither minipage nor figure.
    – egreg
    Sep 18 at 7:51

1 Answer 1

1

You need neither minipage nor figure.

For this application I suggest parskip, instead.

\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}

enter image description here

enter image description here

3
  • Thanks! At the end I managed to achieve a similar result with the float package and this code: \begin{figure}[H] \includegraphics[width=\textwidth]{landscape.png} \caption{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{figure} The difference is that there is a bit of space more between figure and caption. Maybe it can be adjusted also in you suggestion. Thanks! Sep 18 at 14:38
  • There's no need for figure. Just define a suitable command for typesetting the caption and imposing the distance you like.
    – egreg
    Sep 18 at 15:08
  • You may be right, but I did some tests with your solution and had problems with floating content, for example if captions have different length they are on different pages. With figure+caption the image fits the layout. I hope to be explained. In any case, I am trying with different sets of pictures. As soon as I have a consolidated template I will update this question and share the final template in the hope that others will find it useful. Sep 18 at 19:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .