1

MWE:

\documentclass[12pt,openany]{book}
\usepackage{stackengine}
\usepackage{lipsum}
\usepackage{graphicx}

\def\asterism{\par\vspace{1.6em}{\centering\scalebox{2.00}{%
  \stackon[-0.5pt]{\bfseries*~*}{\bfseries*}}\par}\vspace{.5em}\par}

\begin{document}
\large

\chapter*{CHAPTER 1.}
\thispagestyle{empty}
\lipsum[3]
\begin{figure*}[b]
  \asterism
\end{figure*}

\chapter*{CHAPTER 2.}
\lipsum[3-4]
\begin{figure*}[b]
  \asterism
\end{figure*}
\end{document}

which produces:

enter image description here

which is fine. But, also---

enter image description here

(which is not fine)

QUESTION: How may I place a figure (such as the asterism shown) at the bottom of the last page of each chapter (only if there's room)? So, in the case of the MWE, I would only want to display the figure (asterism) at the end of the first chapter only.

Thank you.

7
  • 1
    Will the same figure content be used for all chapters? If so, the check for size could simply trigger the graphic, so the same single command could finish up every chapter. Commented Jan 21 at 3:04
  • Instead of using a float, just ovelap the bottom of the page. Commented Jan 21 at 4:12
  • @barbarabeeton Yes; it is intended that the same figure be used for all chapters. Commented Jan 21 at 13:59
  • @JohnKormylo Thank you for your comment, but I'm not sure that I understand it. Are you suggesting that I increase the length of the page when needed to accommodate the fitting of the figure? I was hoping not to do that. Perhaps you might consider posting an answer so I may see what you mean more clearly. Commented Jan 21 at 14:03
  • @barbarabeeton Regarding, "check for size", do you mean to adjust the size of the figure when it does not fit at the end of the page? How might a single command do that? Perhaps you might consider posting it as an answer. Many thanks. Commented Jan 21 at 14:07

1 Answer 1

6

You could probably use hooks instead of \chapterend.

\documentclass[12pt,openany]{book}
\usepackage{stackengine}
\usepackage{lipsum}
\usepackage{graphicx}
%\usepackage{showframe}

\newsavebox{\asterism}
\savebox\asterism{\parbox[b]{\textwidth}{\vspace{1.6em}\centering\scalebox{2.00}{%
  \stackon[-0.5pt]{\bfseries*~*}{\bfseries*}}\vspace{.5em}}}

\newlength{\freespace}
\newcommand{\chapterend}{\par
  \setlength{\freespace}{\dimexpr \pagegoal-\pagetotal}%
  \ifdim\freespace > \dimexpr\ht\asterism+\textfloatsep\relax
    \begin{figure}[b]\usebox\asterism\end{figure}%
  \fi}
    
\begin{document}
\large

\chapter*{CHAPTER 1.}
\thispagestyle{empty}
\lipsum[3]
\footnote{This is a test}
%\footnote{\lipsum[2]}
\chapterend

\chapter*{CHAPTER 2.}
\lipsum[3-4]
\chapterend
\end{document}
1
  • Pretty cool! :-)
    – gusbrs
    Commented Jan 22 at 3:16

You must log in to answer this question.

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