나는 isodate
이후로 패키지를 사용하고 있습니다
- 사용자는 다음 예와 같은 형식으로 장 제목으로 날짜를 삽입해야 합니다.
31/12/1987
- 장의 제목은
31st Dec 1987
,
여기에 몇 가지 게시물을 따라 도착했습니다.
\documentclass{book}
\usepackage[orig,british]{isodate}
\usepackage{blindtext}
\makeatletter
\def\short@month@english{\ifcase\month\or
Jan\or Feb\or Mar\or Apr\or May\or Jun\or
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}
\newcommand{\printshortdate}[1]{{%
\let\month@english\short@month@english% Update English month lookup (locally)
\printdate{#1}}}% Call traditional \printdate
\newcommand{\printsupdate}[1]{{
\let\day@english\supday@english
\printdate{#1}
}}
\makeatother
\newcommand{\chaplab}[1]{\label{chap:#1}}
\begin{document}
\chapter{\printshortdate{31/12/1987}}
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext
\blindtext
\end{document}
그러나 명령을 \markboth
제거하여 \blindtext
문서가 한 페이지만 되어도 문제가 없습니다. 텍스트를 추가하는 동안 오류가 발생하고 헤더의 장 이름이 엉망이 되기 때문입니다. 나는 정확히 헤더로 갖고 싶습니다31st Dec 1987
메모가 추가됨
동일한 문서에서 동일한 날짜가 필요 isodate
하지만 다른 형식이 필요하므로 사용자로서 한 번만 삽입하고 싶습니다.
답변1
모바일 인수로 이동하려면 명령이 강력해야 합니다.
트릭은 newcommand
다음으로 대체됩니다.DeclareRobustCommand
코드는 다음과 같습니다.
\documentclass{book}
\usepackage[orig,british]{isodate}
\usepackage{lipsum}
\makeatletter
\def\short@month@english{\ifcase\month\or
Jan\or Feb\or Mar\or Apr\or May\or Jun\or
Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}
\DeclareRobustCommand{\printshortdate}[1]{%
\let\month@english\short@month@english% Update English month lookup (locally)
\printdate{#1}%
}% Call traditional \printdate
\makeatother
\begin{document}
\chapter{\printshortdate{31/12/1987}}
\lipsum[4-12]
\end{document}
출력 포함(2페이지):
{
(정의에서 newcommand
) 몇 가지 추가 항목을 삭제했다는 사실을 명심하세요.
답변2
한 챕터에만 필요한 경우
\chapter*{\printshortdate{31/12/1987}}
TOC에 표시되어서는 안되는 경우 또는
\chapter{\protect\printshortdate{31/12/1987}}
물론 다른 답변의 해결책과 동일합니다.