
나는 집필 중인 책의 헤더를 직접 만들려고 합니다. "왼쪽"과 "오른쪽"이라는 두 제목을 번갈아 사용하고 싶습니다. 내 문제는 다음을 사용할 때 왼쪽과 오른쪽이 인쇄되지 않는다는 것입니다 \markboth
.
코드는
\documentclass{book}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{graphics,color}
\usepackage[superscript]{cite}
\begin{document}
\pagestyle{myheadings}
\markboth{Right}{Left}
First page
\newpage
Second page
\newpage
Third page
\newpage
Fourth page
\end{document}
이는 다음을 제공합니다:
두 번째 페이지:
하지만 나는 다음과 같은 것을 원합니다(아래):
두 번째 페이지:
세 번째:
4번째:
답변1
원하는 출력을 게시하는 사진에는 헤더 아래에 규칙이 포함되고 여백이 줄어듭니다. 여백을 설정하려면 패키지를 사용하는 것이 가장 좋습니다 geometry
. 헤더의 경우 fancyhdr
패키지는 필요한 기능을 제공합니다. 구문(실제로는 Right
잘못된 Left
방식)을 사용하여 다음과 같이 작성할 수 있습니다.
\documentclass[a4paper,12pt]{book}
\usepackage[vmargin=0.2cm,hmargin=1cm,head=16pt,includeheadfoot]{geometry}
\usepackage{fancyhdr}
\fancyhead{}
\fancyfoot{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\slshape\rightmark}
\fancyhead[RE]{\slshape\leftmark}
\pagestyle{fancy}
\begin{document}
\markboth{Right}{Left}
\thispagestyle{empty}
First page
\newpage
Second page
\newpage
Third page
\newpage
Fourth page
\end{document}
\pagestyle{empty}
첫 번째 페이지(또는 명령이 실행되는 페이지)에 헤더가 없는지 확인합니다.
표준 방식을 사용하려면 \markboth
다음을 사용해야 합니다.
\documentclass[a4paper,12pt]{book}
\usepackage[vmargin=0.2cm,hmargin=1cm,head=16pt,includeheadfoot]{geometry}
\usepackage{fancyhdr}
\fancyhead{}
\fancyfoot{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[LO]{\slshape\leftmark}
\fancyhead[RE]{\slshape\rightmark}
\pagestyle{fancy}
\begin{document}
\markboth{Left}{Right}
\thispagestyle{empty}
First page
\newpage
Second page
\newpage
Third page
\newpage
Fourth page
\end{document}