\leftmark 章名なしのヘッダー

\leftmark 章名なしのヘッダー

ドキュメントブックがありtwoside、偶数ページに章番号と章番号 (章を表す単語なし) のみを表示したいと考えています。次のように表示したいです: 6. ISO 27001 の標準とは何ですか?

ヘッダー図

私のコードは次のとおりです:

   \fancyhf{}

    \fancyhead[LE]{\textsl{\slshape{\leftmark}}}

    \fancyhead[RO]{\textsl{PROYECTO FIN DE MASTER}}

    \fancyfoot[LE,RO]{\thepage}

    \renewcommand{\headrulewidth}{0.4pt}

    \renewcommand{\footrulewidth}{0.4pt}

答え1

\chaptermark挿入されたものを削除するにはパッチを当てるだけです\@chapapp\:

ここに画像の説明を入力してください

\documentclass[twoside]{book}
\usepackage[spanish]{babel}
\usepackage{fancyhdr,lipsum}
\fancyhf{}
\fancyhead[LE]{\slshape \leftmark}
\fancyhead[RO]{\slshape PROYECTO FIN DE MASTER}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\pagestyle{fancy}

\usepackage{etoolbox}
\makeatletter
%\ patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\chaptermark}{\@chapapp\ }{}{}{}
\makeatother

\begin{document}

\chapter{A chapter}
\lipsum[1-50]

\end{document}

関連情報