In a two-sided article, I wish to show the current subsection name on the odd pages, and the current section name on even pages. Therefore I wrote
\fancyhead[RO]{\rightmark}
\fancyhead[LE]{\leftmark}
\renewcommand*{\sectionmark}[1]{\markboth{\uppercase{#1}}{}}
\renewcommand*{\subsectionmark}[1]{\markright{\thesubsection~~#1}}
However, if \section and \subsection is on the same page, then the right mark disappear. I searched on this site and found the reason (in this answer):
\rightmark always use the first mark, so if you have to sections or subsections on a page, you will get the first.
Is there anyway to change this behavior, making the right mark always shows up?
Below is a MWE, as you can see, the right mark on the first page disappear.
\documentclass[twoside]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[RO]{\rightmark}
\fancyhead[LE]{\leftmark}
\renewcommand{\sectionmark}[1]{\markboth{\uppercase{#1}}{}}
\renewcommand{\subsectionmark}[1]{\markright{\thesubsection~~#1}}
\usepackage{blindtext}
\begin{document}
\blindtext
\section{Section One}
\subsection{Subsection One}
\blindtext[10]
\section{Section Two}
\blindtext[3]
\subsection{Subsection Two}
\blindtext[10]
\end{document}
