0

How can I get get rid of the section pages while keeping the section text in the upper right corner? pic

Removing \section*{Figure A}% leads to pic

\documentclass[12pt,landscape,titlepage]{article}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[a4paper,left=1cm,right=1cm,top=3cm,bottom=3cm,headheight=3em]{geometry}%
\usepackage{xcolor}%
\usepackage{graphicx}%
\usepackage[english]{babel}%
\usepackage{blindtext}%
\usepackage{xpatch}%
\usepackage{floatrow}%
\usepackage{caption}%
\usepackage{fancyhdr}%
\usepackage{titlesec}%
%
\xpretocmd{\section}{\thispagestyle{plain}}{}{}%
\pagecolor{darkgray}%
\pagecolor{white}%
\color{darkgray}%
\pagestyle{fancy}%
\title{Jane Q}%
\author{Subtitle | 2022}%
\date{}%
\rhead{Jane Q}%
\fancyhf{}%
\fancyhead{}%
\renewcommand{\headrulewidth}{0pt}%
\fancyhead[RO]{{Jane Q}\\\vspace{0.5em}\underline{\leftmark}\\\vspace{0.05em}\rightmark}%
\renewcommand\sectionmark[1]{\markboth{#1}{\mysubtitle}}%
\titleclass{\section}{page}%
\assignpagestyle{\section}{empty}%
\titleformat{\section}[display]{\centering\Huge\bfseries}{\sectionname}{0pt}{\huge}[\clearpage]%
\newcommand{\subtitle}[1]{\gdef\mysubtitle{#1}\ignorespaces}%
%
\begin{document}%
\normalsize%
\maketitle%
\subtitle{2022}%
\section*{Figure A}%
\pagebreak%
\begin{figure}%
\includegraphics[width=\textwidth]{example-image-a}
}%
\end{figure}%
\pagebreak%
\begin{figure}%
    \floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,top},capbesidewidth=8cm}}]{figure}[\FBwidth]{\caption*{2022\\10 x 10 cm\\Pencil on paper\\~\\}}{\includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-a}}%
\end{figure}%
\pagebreak%
\subtitle{2022}%
\section*{Figure B}%
\pagebreak%
\begin{figure}%
  \includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-b}%
\end{figure}%
\pagebreak%
\begin{figure}%
  \floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,top},capbesidewidth=8cm}}]{figure}[\FBwidth]{\caption*{2022\\10 x 10 cm\\Pencil on paper\\~\\}}{\includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-b}}%
\end{figure}%
\pagebreak%
\end{document}

1 Answer 1

2

Replace the \section* with something (I called it \fakesection*) that just sets the \sectionmark. I also added a \clearpage, so that the figures will not be moved to the next \fakesection, but maybe you should change some or all \pagebreak commands to `\clearpage for this reason.

\documentclass[12pt,landscape,titlepage]{article}%
\usepackage[T1]{fontenc}%
\usepackage[utf8]{inputenc}%
\usepackage{lmodern}%
\usepackage{textcomp}%
\usepackage{lastpage}%
\usepackage[a4paper,left=1cm,right=1cm,top=3cm,bottom=3cm,headheight=3em]{geometry}%
\usepackage{xcolor}%
\usepackage{graphicx}%
\usepackage[english]{babel}%
\usepackage{blindtext}%
\usepackage{xpatch}%
\usepackage{floatrow}%
\usepackage{caption}%
\usepackage{fancyhdr}%
\usepackage{titlesec}%
%
\xpretocmd{\section}{\thispagestyle{plain}}{}{}%
\pagecolor{darkgray}%
\pagecolor{white}%
\color{darkgray}%
\pagestyle{fancy}%
\title{Jane Q}%
\author{Subtitle | 2022}%
\date{}%
\rhead{Jane Q}%
\fancyhf{}%
\fancyhead{}%
\renewcommand{\headrulewidth}{0pt}%
\fancyhead[RO]{{Jane Q}\\\vspace{0.5em}\underline{\leftmark}\\\vspace{0.05em}\rightmark}%
\renewcommand\sectionmark[1]{\markboth{#1}{\mysubtitle}}%
\titleclass{\section}{page}%
\assignpagestyle{\section}{empty}%
\titleformat{\section}[display]{\centering\Huge\bfseries}{\sectionname}{0pt}{\huge}[\clearpage]%
\newcommand{\subtitle}[1]{\gdef\mysubtitle{#1}\ignorespaces}%
%
\newcommand{\fakesection}[2]{\clearpage\sectionmark{#2}} % #1 is to absorb the *
\begin{document}%
\normalsize%
\maketitle%
\subtitle{2022}%
\fakesection*{Figure A}%
\pagebreak%
\begin{figure}%
\includegraphics[width=\textwidth]{example-image-a}
%}% <<<<<<<<<<<<< Spurious } removed
\end{figure}%
\pagebreak%
\begin{figure}%
    \floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,top},capbesidewidth=8cm}}]{figure}[\FBwidth]{\caption*{2022\\10 x 10 cm\\Pencil on paper\\~\\}}{\includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-a}}%
\end{figure}%
\pagebreak%
\subtitle{2022}%
\fakesection*{Figure B}%
\pagebreak%
\begin{figure}%
  \includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-b}%
\end{figure}%
\pagebreak%
\begin{figure}%
  \floatbox[{\capbeside\thisfloatsetup{capbesideposition={right,top},capbesidewidth=8cm}}]{figure}[\FBwidth]{\caption*{2022\\10 x 10 cm\\Pencil on paper\\~\\}}{\includegraphics[width=\linewidth,height=\textheight,keepaspectratio]{example-image-b}}%
\end{figure}%
\pagebreak%
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.