\titleformat で章数を表示するにはどうすればよいですか?

\titleformat で章数を表示するにはどうすればよいですか?

私の MWE は次のとおりです:

\documentclass[twoside]{book}

\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,headheight=28pt,bindingoffset=6mm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}
\usepackage{fancyhdr}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{10pt}{\Huge}
\newpagestyle{mystyle}{
  \sethead[][][\chaptertitle]{\thesection~\sectiontitle}{}{\thepage}}

\begin{document}

\pagestyle{mystyle}
\chapter{A chapter}
\lipsum[1-40]

\end{document}

これにより、章のタイトルから「章」という単語が削除されます。ただし、章の数も含める必要があります。たとえば、「1. はじめに」などです。titlesec を使用してこれを行うにはどうすればよいでしょうか?

答え1

display章のラベルを章のタイトルと同じ行に表示したい場合は、 スタイルを使用しないでください。を中央揃えにしたい場合は、デフォルトのhangスタイル、または を使用してください。は必須ではないことに注意してください。これは クラスのデフォルトです。 また、 をオプションとともに使用したい場合はをロードしないでください。は をロードし、 と競合する可能性があります。blocktwosidebookfancyhdrtitlesecpagestylestitlepsfancyhdr

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

\documentclass{book}

\usepackage[a4paper, width=150mm, vmargin=25mm, headheight=28pt, bindingoffset=6mm]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}%
  {\normalfont\bfseries\Huge}{\thechapter.}{10pt}{}
\newpagestyle{mystyle}{
  \sethead[][\thechapter.\enspace\chaptertitle][]{}{\thesection~\sectiontitle}{}
\setfoot{}{\thepage}{}}

\begin{document}

\pagestyle{mystyle}
\chapter{A Chapter}
\lipsum[1-5]
\section{A First Section}
\lipsum[6-20]

\end{document} 

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

答え2

\thechapter.\quadタイトル設定の一部として含める:

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

\documentclass{book}

\usepackage{titlesec}

\titleformat{\chapter}[display]
  {\normalfont\bfseries}{}{10pt}{\Huge\thechapter.\quad}

\begin{document}

\chapter{A chapter}

\end{document}

関連情報