I have a tufte document with a shaded case study section that takes up a full page. I want to add a sidenote to the case study, but I can't get it to appear on the same page. It appears on the page before.
\documentclass[justified,twoside,symmetric,]{tufte-book}
% ams
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\makeatletter
\@ifpackageloaded{fontspec}{}{\usepackage{fontspec}}
\makeatother
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\makeatletter
\@ifpackageloaded{soul}{
\renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}}
\renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}}
}{}
\makeatother
\fi
% graphix
\usepackage{graphicx}
\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
% booktabs
\usepackage{booktabs}
% url
\usepackage{url}
% hyperref
\usepackage{hyperref}
% units.
\usepackage{units}
\setcounter{secnumdepth}{2}
% citations
\usepackage{natbib}
\bibliographystyle{apalike-etal}
% pandoc syntax highlighting
% longtable
\usepackage{longtable,booktabs}
% multiplecol
\usepackage{multicol}
% strikeout
\usepackage[normalem]{ulem}
% morefloats
\usepackage{morefloats}
% tightlist macro required by pandoc >= 1.14
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
% title / author / date
\title{Example}
\author{Author}
\date{2021-11-07}
\usepackage{booktabs}
\usepackage{mparhack} % https://tex.stackexchange.com/a/236380/30017
\usepackage{parskip}
% kableExtra specific
%\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
%\usepackage{xcolor}
% colors
\definecolor{ghr-blue}{cmyk}{0.846, 0.234, 0.00, 0.212}
\definecolor{ghr-orange}{cmyk}{0.0, 0.37, 0.757, 0.098}
\hypersetup{colorlinks,linkcolor=,urlcolor=ghr-orange}
% citations
\PassOptionsToPackage{round}{natbib}
\setcitestyle{super}
\renewcommand*{\citep}[1]{{\cite{#1}}}
\renewcommand*{\citet}[1]{{\cite{#1}}}
\usepackage[nottoc]{tocbibind}
%\renewcommand{\bibsection}{\chapter{References}}
% icons
\usepackage{fontawesome5}
% break with tufte on subsubsections
\let\subsubsection\subsection
% fonts
\usepackage{fontspec}
\setmainfont{LibreBaskerville-Regular}
\setsansfont{SourceSansPro-Regular}
\setmonofont{Inconsolata}
\setsidenotefont{\fontspec{SourceSansPro-ExtraLight}[Scale=0.8]}
\setcaptionfont{\fontspec{SourceSansPro-ExtraLight}[Scale=0.8]}
\setmarginnotefont{\fontspec{SourceSansPro-ExtraLight}[Scale=0.8]}
\setcitationfont{\fontspec{SourceSansPro-ExtraLight}[Scale=0.8]\color{ghr-orange}}
% headers
\usepackage{fancyhdr}
\setlength{\headheight}{15pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{ \markboth{#1}{} }
\renewcommand{\sectionmark}[1]{ \markright{#1} }
\fancyhf{}
\fancyhead[LE]{\thepage\space\space\space$\cdotp$\space\space\space\chaptername\space\thechapter}
\fancyhead[RO]{\leftmark\space\space\space$\cdotp$\space\space\space\thepage}
\fancypagestyle{plain}{ %
\fancyhf{} % remove everything
\renewcommand{\headrulewidth}{0pt} % remove lines as well
\renewcommand{\footrulewidth}{0pt}
}
% title page and level headings
\usepackage[svgnames]{xcolor}
\usepackage{titlesec}
\usepackage{xhfill}
\colorlet{rulecolor}{Gainsboro!40!Lavender}
\usepackage{lipsum}
\titleclass{\part}{top}
\titleformat{\part}[display]
{\huge\bfseries\sffamily\centering}{\partname~\thepart}{0pt}{}
\titlespacing*{\part}{0pt}{40pt}{40pt}
\titleformat{\chapter}[display]
{\filcenter}{\mbox{}\xrfill[0.4ex]{3pt}[rulecolor]\bfseries\sffamily{\large\enspace\chaptername\space\thechapter}\enspace\xrfill[0.4ex]{3pt}[rulecolor]\mbox{}}{0.3ex} {{\color{rulecolor}\titlerule[1pt]}\vskip3ex\huge\bfseries\sffamily}[\medskip{\color{rulecolor}\titlerule[1pt]}]
\usepackage{titling}
\pretitle{\begin{flushleft}\huge\bfseries\sffamily}
\posttitle{\par\end{flushleft}}
\preauthor{\begin{flushleft}\Large\bfseries\sffamily}
\postauthor{\par\end{flushleft}}
\predate{\begin{flushleft}\large\mdseries\sffamily}
\postdate{\par\end{flushleft}}
\titleformat*{\section}{\LARGE\bfseries\sffamily}
\titleformat*{\subsection}{\Large\bfseries\sffamily}
\usepackage[svgnames]{xcolor}
\let\cleardoublepage\clearpage
% table of contents
\usepackage{titletoc}
\contentsmargin[1cm]{0cm}
\titlecontents{part}[-1.9em]{\vskip6pt\LARGE\bfseries\sffamily}
{\thecontentslabel\enspace}
{\hspace{.5em}}
{ \hfill\contentspage}[\vskip 0pt]
\titlecontents{chapter}[0em]{\medskip\Large\bfseries\sffamily}
{\thecontentslabel\enspace}
{\hspace{1.05em}}
{ \hfill\contentspage}[\vskip 4pt]
\titlecontents{section}[1em]{\mdseries\sffamily}
{\thecontentslabel\enspace}
{}
{\titlerule*[1pc]{.}\quad\contentspage}[\vskip 4pt]
\titlecontents{subsection}[2.7em]{\mdseries\sffamily}
{\thecontentslabel\enspace}
{}
{\titlerule*[1pc]{.}\quad\contentspage}[\vskip 3pt]
\usepackage{etoolbox}
\pretocmd{\contentsname}{\sffamily}{}{}
% margins
% The default minimum amount of space between \marginnotes is 10 pt.
\setlength\marginparpush{15pt}
\AtBeginEnvironment{marginfigure}{\linespread{0.5}}
\AtBeginEnvironment{marginnote}{\linespread{0.5}}
\makeatletter
\renewcommand{\footnotelayout}{\@tufte@sidenote@font\@tufte@sidenote@justification\linespread{0.5}}
\makeatother
% https://tex.stackexchange.com/a/614005/30017
\makeatletter
\renewcommand\marginnote[2][0pt]{%
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command
}{}%
\gdef\@tufte@citations{}% clear out any old citations
\marginpar{\setstretch{0.5}\hbox{}\vspace*{#1}\@tufte@marginnote@font\@tufte@marginnote@justification\@tufte@margin@par\vspace*{-1\baselineskip}\noindent #2}%
\@tufte@print@citations% print any citations
\ifthenelse{\boolean{@tufte@loadnatbib}}{%
\let\cite\@tufte@normal@cite% go back to using normal in-text \cite command
}{}%
}
\makeatother
% marginnote alignment
% https://tex.stackexchange.com/a/193305/30017
\makeatletter
\catcode`\V=14 % `V' is a comment character unless [verbose]
\def\FloatBarrier{\begingroup \let\@elt\relax
V\edef\@tempa{\write\m@ne{Package placeins Info: Float barrier, from
V input line \the\inputlineno, processed on page \thepage, lands on
V page \noexpand\thepage. }}\@tempa
\edef\@tempa{\@fb@botlist\@deferlist\@dbldeferlist}%
\ifx\@tempa\@empty V\PackageInfo{placeins}{No floats held,}%
\else
\ifx\@fltovf\relax % my indicator of recursion
\if@firstcolumn V\PackageWarning{placeins}{Some floats are stuck,}%
\clearpage
\else V\PackageInfo{placeins}{Eject a column and check again:}%
\null\newpage\FloatBarrier
\fi
\else V\PackageInfo{placeins}{Must dump some floats}%
\newpage \let\@fltovf\relax V\PackageInfo{placeins}{Check again:}%
\FloatBarrier % recurse once only
\fi\fi \endgroup
\@fb@topbarrier }
\catcode`\V=11
\renewenvironment{@tufte@margin@float}[2][0pt]{%
\FloatBarrier% process all floats before this point so the figure/table numbers stay in order.
\begin{lrbox}{\@tufte@margin@floatbox}%
\begin{minipage}[t]{\marginparwidth}% top-aligned minipage
\@tufte@caption@font
\def\@captype{#2}%
\hbox{}\vspace*{#1}%
\@tufte@caption@justification
\@tufte@margin@par
\noindent
}{%
\end{minipage}%
\end{lrbox}%
\marginpar{\usebox{\@tufte@margin@floatbox}}%
}
%%
% Margin figure environment
\renewenvironment{marginfigure}[1][-7pt]%
{\begin{@tufte@margin@float}[#1]{figure}}
{\end{@tufte@margin@float}}
\makeatother
% quote
\usepackage[most]{tcolorbox}
\newtcolorbox{newquote}[1][]{%
colback=black!5,
colframe=black!5,
notitle,
sharp corners,
borderline west={2pt}{0pt}{ghr-blue!80!black},
enhanced,
breakable,
}
\renewcommand{\quote}{\newquote}
\renewcommand{\endquote}{\endnewquote}
% margin note
% blocks
\newtcolorbox{blackbox}{
colframe=ghr-blue,
colback=black!5,
coltext=black,
boxsep=20pt,
arc=4pt}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{array}
\usepackage{multirow}
\usepackage{wrapfig}
\usepackage{float}
\usepackage{colortbl}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage{makecell}
\usepackage{xcolor}
\begin{document}
\maketitle
\marginnote{\faIcon{youtube} Side note.\vspace{0.5cm}}
\begin{blackbox}
\begin{center}
\textbf{CASE STUDY: Developing the first malaria vaccine}
\end{center}
\vspace{.2cm}
In 2021, after more than 35 years of research, the World Health Organization recommended widespread use of a vaccine candidate called RTS,S/AS01, or Mosquirix™, to prevent \emph{P. falciparum} malaria in children.
\vspace{.2cm}
Development of RTS,S/AS01 began in 1984, and soon after, a promising vaccine candidate entered preclinical research. Researchers performed tests on nonhuman subjects to collect data on how well the vaccine worked (efficacy), how much damage it could do to an organism (toxicity), and how the body affected the vaccine (pharmacokinetics).
\vspace{.2cm}
Clinical research on humans began in 1992. Researchers conducted a Phase 1 safety and immunogenicity trial with 20 adults in The Gambia in 1997. Results suggested that the vaccine did not have any significant toxicity but did produce the expected antibodies.
\vspace{.2cm}
Several Phase 2 studies conducted over the next decade demonstrated the efficacy of the vaccine against several endpoints. A Phase 2b trial began in Mozambique in 2003 with more than 2,000 children. Each child was randomly assigned to receive 3 doses of RTS,S or a control vaccine. After 6 months, the prevalence of malaria was 37\% lower in the treatment group than in the control group. This Phase 2 trial was an important proof-of-concept study.
\vspace{.2cm}
The results of a large Phase 3 trial with more than 15,000 infants and young children in 7 African countries were published in 2015. Children who participated in the study were randomly assigned to 1 of 3 arms: (i) 3 doses of RTS,S and a booster dose at month 20, (ii) 3 doses of RTS,S and a booster dose of a comparator vaccine at month 20, or (iii) 4 doses of a comparator vaccine. RTS,S reduced clinical malaria cases by 28\% and 18\% among young children and infants, respectively, over a 3 to 4-year period. This Phase 3 trial demonstrated that the treatment was efficacious.
\vspace{.2cm}
On the basis of these results, the European Medicines Agency issued a favorable ``European scientific opinion''. This led the health ministries in Ghana, Kenya and Malawi to authorize a pilot study in 2019 to assess the feasibility of administering the required four doses of the vaccine as part of routine childhood immunization programs. After more than 800,000 children were immunized under this program, the WHO recommended that countries with moderate to high transmission adopt the vaccine.
\end{blackbox}
\end{document}