Background
I keep a personal journal in LaTeX and would like to simplify my document. I made a \partpage command to create my part pages:
Every part page has the same image. Only their titles are different.
Question:
Is it possible to just use the \part command, and have LaTeX add the image for me? I can then remove my custom command. I looked at this question but don't understand how to integrate it. My attempt has been commented in the MRE. It doesn't seem to do anything; I assume it's because I'm using the book document class.
How do I make this work?
\documentclass[11pt]{book}
\usepackage{graphicx}
\newcommand{\partpage}[1]{%
\part[#1]{%
#1
\begin{center}
\includegraphics[width=1in]{Triforce1.png}
\end{center}%
}
}
%
% My attempt at integrating https://tex.stackexchange.com/a/485938/118490
%
\makeatletter
\def\@partimage{}
\newcommand{\partimage}[2][]{\gdef\@partimage{\includegraphics[#1]{{#2}}}}
\newcommand{\printparttitle}[1]{\parttitlefon #1\vfil\@partimage\vfil\gdef \@partimage{}}
\makeatother
%
% End attempt
%
\setcounter{secnumdepth}{-2}
\begin{document}
\partimage[width=1in]{Triforce1.png}
\partpage{partpage}
\part[Part Title B]{Embedded \begin{center}\includegraphics[width=1in]{Triforce1.png}\end{center}}
\part{Part Cmd}
\end{document}
Using titlesec
I tried to use the titlesec package, which produced
this image. This is close; how do I move the image below the text?
\documentclass[11pt]{book}
\usepackage{graphicx, titlesec}
%
% \titleformat{〈command〉}[〈shape〉]{〈format〉}{〈label〉}{〈sep〉}{〈before-code〉}[〈after-code〉]
% command: \part
% shape:
% format: \centering
% label:
% sep: 0pt
% before-code: image stuff
% after-code: can't get to work?
%
\titleformat{\part}{\centering}{}{0pt}{
\begin{center}
\includegraphics[width=1in]{./Triforce1.png}
\end{center}
}
%
% Using after-code: THIS ERRORS
%
%\titleformat{\part}{\Huge\centering}{}{0pt}{}[
% \begin{center}
% \includegraphics[width=1in]{./Triforce1.png}
% \end{center}
%]
\setcounter{secnumdepth}{-2}
\begin{document}
\part{partpage}
\end{document}
\titleformat. Am I on the right track? – Mar 03 '20 at 05:18