%20%EB%B6%80%EB%B6%84%EC%9D%98%20%EC%A7%A7%EC%9D%80%20%EC%A0%9C%EB%AA%A9%EC%9D%84%20%ED%91%9C%EC%8B%9C%ED%95%98%EB%A0%A4%EB%A9%B4%20%EC%96%B4%EB%96%BB%EA%B2%8C%20%ED%95%B4%EC%95%BC%20%ED%95%A9%EB%8B%88%EA%B9%8C%3F.png)
저는 부품 제목이 두 줄로 표시되는 게임 규칙서를 작성하고 있습니다. 첫 번째 줄은 짧은 제목(예: \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
}