%20%E9%83%A8%E5%88%86%E3%81%AE%E7%9F%AD%E3%81%84%E3%82%BF%E3%82%A4%E3%83%88%E3%83%AB%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%82%88%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
私は、パートのタイトルが 2 行で表示されるゲーム ルール ブックを作成しています。最初の行は短縮タイトル (例\part[introduction]{introduction\\PARTIE PREMIÈRE}\label{\thepart}
) と同じで、上行/短縮タイトルのみをヘッダーに追加したいと考えています。次のコードで動作させることができました\fancyhead[CE]{\textsc{\nameref{\thepart}}}
が、titlesec パッケージを使用して をカスタマイズすると\part
、ヘッダーから消えてしまいます。"??" やエラーはなく、空のヘッダーだけです。(奇数ページのヘッダーには章の短縮名が表示され、スタイルをカスタマイズしたにもかかわらず問題なく動作します。)
コード全体は次のとおりです。
\documentclass[a4paper,twocolumn,openright,14pt]{memoir}
\usepackage[french]{babel}
\usepackage{blindtext}
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{titling}
\usepackage{nameref}
\usepackage{pdfpages}
\usepackage{pifont}
\usepackage[explicit]{titlesec}
\titleformat{\part}[display]
{\fontsize{21pt}{15pt}\scshape\centering}
{#1}
{1em}
{}
\titleformat{\chapter}[display]
{\fontsize{18pt}{15pt}\scshape\centering}
{#1\\\ligne}
{1em}
{}
\titlespacing{\chapter}{0pt}{0pt}{-40pt}
\newcommand{\chry}
{\ding{97}}
\newcommand{\ligne}
{\vspace{0.5cm}\fancybreak{
\begin{tikzpicture}\draw[line width=0.45mm](0,0)--(3.75,0);\end{tikzpicture}
}\vspace{0.5cm}}
\newcommand{\petiteligne}
{\vspace{0.5cm}\fancybreak{
\begin{tikzpicture}\draw[line width=0.45mm](0,0)--(1.875,0);\end{tikzpicture}
}\vspace{0.5cm}}
\renewcommand{\headrulewidth}
{0.45mm}
\fancyhf{}
\fancypagestyle{plain}
{\renewcommand{\headrulewidth}
{0pt}\fancyhf{}}
\begin{document}
%Titre
\begin{titlingpage}
\includepdf{titre}
\end{titlingpage}
%/Titre
\cleardoublepage
%Préface
\blindtext[5]
\thispagestyle{empty}
\pagestyle{fancy}
\fancyhead[CE,CO]{\textsc{préface}}
\fancyhead[LE,RO]{\thepage}
\pagenumbering{Roman}
%/Préface
\cleardoublepage
%Contenu
\fancyhead[CE]{\textsc{\nameref{\thepart}}}
\fancyhead[CO]{\textsc{\nameref{\thepart.\thechapter}}}
\pagenumbering{arabic}
\part[introduction]{introduction\\PARTIE PREMIÈRE}\label{\thepart}
\chapter[univers]{univers\\CHAPITRE PREMIER}\label{\thepart.\thechapter}
\blindtext[2]
\petiteligne
\blindtext[2]
%/Contenu
\end{document}
答え1
私はおかげでその方法を見つけました@マーティン・シャラー! ラベルなしのコードは次のとおりです:
\newcommand*\parttitle{}
\let\origpart\part
\renewcommand*{\part}[2][]{%
\ifx\\#1\\% optional argument not present?
\origpart{#2}%
\renewcommand*\parttitle{#2}%
\else
\origpart[#1]{#2}%
\renewcommand*\parttitle{#1}%
\fi
}