¿Encabezado con título de sección mientras la numeración está en el pie de página?

¿Encabezado con título de sección mientras la numeración está en el pie de página?

¿Cómo puedo poner el título y el número de la sección/subsección en el encabezado mientras tengo la numeración en el pie de página?

\pagestyle{...} no permite esta combinación.

Respuesta1

Aquí hay una manera que resuelve algunos problemas (como agregar secciones y subsecciones destacadas también en los encabezados -o incluso en TOC si se modifican-)

\documentclass[twoside]{article}
\usepackage{lipsum}
\usepackage{fancyhdr}
%\fancyhead[CO,CE]{}
\fancyhead[LO,RE]{\scshape\leftmark}
\fancyhead[RO,LE]{\itshape\rightmark}
\let\oldsection\section
\let\oldsubsection\subsection
\makeatletter
\def\section{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}      
\def\@StarredWith[#1]#2{%
\oldsection*{#2}%
\renewcommand\leftmark{#1}%
}
\def\@StarredWithout#1{
\oldsection*{#1}%
\renewcommand\leftmark{#1}
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldsection[#1]{#2}%
\renewcommand\leftmark{\thesection~#1}%
}
\def\@nonStarredWithout#1{%
\oldsection{#1}%
\renewcommand\leftmark{\thesection~#1}%
}

\def\subsection{%
\@ifstar{\@StarredS}{\@nonStarredS}%
}
\def\@StarredS{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to use them for the hearder}\@StarredSWith}%
{\@StarredSWithout}%
}      
\def\@StarredSWith[#1]#2{%
\oldsubsection*{#2}%
\renewcommand\rightmark{#1}%
}
\def\@StarredSWithout#1{
\oldsubsection*{#1}%
\renewcommand\rightmark{#1}
}
\def\@nonStarredS{%
\@ifnextchar[%
{\@nonStarredSWith}%
{\@nonStarredSWithout}%
}
\def\@nonStarredSWith[#1]#2{%
\oldsubsection[#1]{#2}%
\renewcommand\rightmark{\thesubsection~#1}%
}
\def\@nonStarredSWithout#1{%
\oldsubsection{#1}%
\renewcommand\rightmark{\thesubsection~#1}%
}
\makeatother

\pagestyle{fancy}

\title{Test redefined sections}

\author{Kostis Leledakis}

\begin{document}
\maketitle
\tableofcontents
\clearpage

\section{A section}
\lipsum[1-8]
\subsection{A subsection}
\lipsum[1-6]
\subsection*{A starred subsection}
\lipsum[1-8]
\subsection{Another numbered  subsection}
\lipsum[1-6]
\subsection*{Another starred subsection}
\lipsum[1-8]
\subsection[Short title of subection \thesubsection]{Another numbered  subsection with short title}
\lipsum[1-6]
\section{Another section}
\lipsum[1-6]
\section*{A starred section}
\lipsum[1-8]
\subsection{A subsection}
\lipsum[1-6]
\subsection*{A starred subsection}
\lipsum[1-8]
\subsection{Another numbered  subsection}
\lipsum[1-6]
\subsection*{Another starred subsection}
\lipsum[1-8]
\subsection[Short title of subection \thesubsection]{Another numbered  subsection with short title}
\lipsum[1-6]
\section{Another numbered  section}
\lipsum[1-6]
\section*{Another starred section}
\lipsum[1-8]
\section[Short title of section \thesection]{Another numbered  section with short title}
\lipsum[1-6]
\section*[Short title of starred section]{Another starred  section with short title}
\lipsum[1-8]
\end{document}

PD: esesterespuesta modificada.

información relacionada