Eliminar la palabra clave "capítulo" del encabezado

Eliminar la palabra clave "capítulo" del encabezado

El código actual para mi documento de látex es este:

\documentclass[12pt,notitlepage]{report}

\usepackage{lipsum}  

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\nouppercase{\textit \leftmark}}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\thispagestyle{plain}

\newpage

\pagenumbering{arabic}
\chapter{One}
\lipsum[2-5]


\end{document}

Quiero eliminar el "Capítulo 1". palabra clave de mi encabezado "Capítulo 1. Uno" y la quiero así: "1-Uno". ¿Cómo hacerlo?

Respuesta1

Puedes redefinir \chaptermarkcomo en

\renewcommand\chaptermark[1]{\markboth{\thechapter\,--\,#1}{}}

Un ejemplo completo:

\documentclass[12pt,notitlepage]{report}
\usepackage{lipsum}     
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[C]{\nouppercase{\textit{\leftmark}}}
\renewcommand\chaptermark[1]{\markboth{\thechapter\,--\,#1}{}}

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}
\thispagestyle{plain}

\newpage

\pagenumbering{arabic}
\chapter{One}
\lipsum[2-5]

\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

Como alternativa fancyhdrpuedes utilizarscrlayer-scrpage:

\documentclass[12pt,notitlepage]{report}

\usepackage{lipsum}  

\usepackage[pagestyleset=KOMA-Script,headsepline,automark]{scrlayer-scrpage}
\setkomafont{pagehead}{\itshape}% use italic instead of slanted page header
\renewcommand*{\chaptermarkformat}{\thechapter--}% Use "1–" instead of "Chapter 1 " in the chapter mark
\begin{document}

\pagenumbering{roman}

\cleardoublepage
\addcontentsline{toc}{chapter}{Table of Contents}% Has to be at the begin of
                                % the first ToC page (before \tableofcontents)
\tableofcontents

\cleardoublepage% if twoside next odd page

\pagenumbering{arabic}
\chapter{One}
\lipsum[2-5]

\end{document}

Usando scrlayer-scrpage

Nota: También eliminé \thispagestyle{plain}comandos extraños y moví el \addcontentslinecomando. En su ejemplo, agregaría la última página de la tabla de contenido a la tabla de contenido, lo que no tendría sentido.

Como alternativa puedes usar el paquetetocbibind.

Sin embargo, recomendaría no agregar una entrada para la tabla de contenido en la tabla de contenido. Básicamente, esto no tiene ningún sentido.

Respuesta3

Una posibilidad sencilla es cargar titleps, que viene incluido titlesecpero se puede utilizar de forma independiente. No juegues con las marcas (a menos que quieras…). Sólo \chaptertitleC. \sectiontitle).

\documentclass[12pt,notitlepage]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{titleps}

\newpagestyle{mypagestyle}{%
\headrule
\sethead{}{\textit{\thechapter.\,–\,\chaptertitle}}{}
\setfoot{}{\thepage}{}
}%

\begin{document}

\pagenumbering{roman}

\thispagestyle{plain}
\tableofcontents
\addcontentsline{toc}{chapter}{Table of Contents}

\newpage

\pagestyle{mypagestyle}
\pagenumbering{arabic}
\chapter{One}
\lipsum

\end{document} 

ingrese la descripción de la imagen aquí

información relacionada