
가능한 중복:
머리글, 바닥글 및 글꼴 사용자 정의
나는 더 큰 프로젝트(책)에 글을 쓰고 있는데 이제 헤더에 대한 많은 가능성이 있습니다. 하지만 저는 초보자이고 어떤 것이 가장 좋은지 모르기 때문에 헤더를 어떻게 구현하는 것이 가장 좋은지 묻고 싶었습니다. 머리글에 페이지 번호와 섹션 제목을 표시하고 그 아래에 줄이 있어야 합니다. 이것을 구현하는 방법을 모르겠습니다. 이제 텍스트 아래에 있는 페이지 번호도 사라지고 헤더의 텍스트에는 색상이 있어야 하지만 페이지 번호는 검정색이어야 합니다. 선의 두께는 4포인트보다 조금 더 커야 합니다. 도와 주셔서 정말로 고맙습니다! 내 코드는 다음과 같습니다.
\documentclass{book}
\usepackage{geometry}
\geometry{left=4cm,right=3cm, top=2cm, bottom=2cm}
\usepackage{titlesec}
\titlespacing*{\chapter}{0pt}{-30pt}{20pt}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\usepackage[ngerman]{babel}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{wallpaper}
\usepackage{color}
\usepackage[final]{pdfpages}
%,bookmarksopenlevel={1}
%\usepackage[hidelinks,bookmarks=true,bookmarksopen=true,bookmarksnumbered=true,colorlinks=true,linkcolor=black,]{hyperref}
\usepackage[colorlinks,linkcolor=black,bookmarksopen=false,
hypertexnames=TRUE,pdfpagelabels=true]{hyperref}[2011/02/05]
\hypersetup{
pdftitle={},
% pdfauthor={},
pdfsubject={Statistics Book},
pdfkeywords={},
}
\usepackage{xcolor,bookmark}
\usepackage{scrextend}
\usepackage{titlepic}
\usepackage{shorttoc}
\usepackage{courier}
\usepackage{type1cm}
\usepackage{zref-abspage}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[bottom]{footmisc}
\usepackage{tocstyle}
\usetocstyle{allwithdot}
\usepackage{shadethm}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{marginnote}
\usepackage{wrapfig}
\usepackage{paralist}
\usepackage{amssymb}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{ulem}
\definecolor{shadethmcolor}{rgb}{.9,.9,.95}%
\newtheoremstyle{mystyle}
{\topsep}{\topsep}{}{}%
{\bfseries}{:}{.5em}{}%
\theoremstyle{mystyle}
\newmdtheoremenv[hidealllines=true,backgroundcolor=shadethmcolor,skipabove=\topsep,
skipbelow=\topsep]{example}{example}
\begin{document}
\frontmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength{\marginparwidth}{2.1cm}
\marginparsep = -4pt
\pagestyle{plain}
\pagenumbering{Roman}
\include{dedic}
\newpage\section*{}
\include{foreword}
\newpage\section*{}
\include{preface}
\newpage\section*{}
\include{acknow}
\newpage\section*{}
\include{acronym}
%
\shorttableofcontents{Inhalts\"ubersicht}{1}
\bookmark[page=15,rellevel=1,keeplevel,view={XYZ},color=red]{Inhalts\"ubersicht}
\bookmark[page=17,rellevel=1,keeplevel,view={XYZ},color=red]{Inhaltsverzeichnis}
\tableofcontents
\clearpage
\pagenumbering{arabic}
%
\mainmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{part1}
\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{part2}
\include{chapter4}
\include{chapter5}
\include{chapter6}
\backmatter
\appendix
\include{appendix}
\listoffigures
\newpage
\listoftables
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\include{glossary}
%\include{solutions}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{Index}
\printindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{\"Uber den Autor}
\includepdf{ueberautor}
\includepdf{back}
\end{document}
답변1
먼저 라인을 교체해야합니다
\usepackage{titlesec}
~와 함께
\usepackage[pagestyles]{titlesec}
명령을 \newpagestyle
사용할 수 있도록 합니다. 그런 다음 다음 구문을 사용하여 이 명령을 사용하여 자신만의 머리글 및 바닥글 스타일을 만들 수 있습니다 \newpagestyle{stylename}[global style options]{commands}
. "commands" 인수에는 \headrule
헤더 아래에 수평선을 포함하거나(원하는 대로) \sethead
헤더 내용을 사용자 정의하는 등의 다른 명령이 포함될 수 있습니다. 구문은 입니다 \sethead[even-left][even-center][even-right]{odd-left}{odd-center}{odd-right}
.
예를 들어, 다음 줄을 추가하여 "mystyle" 스타일을 만들 수 있습니다.
\newpagestyle{mystyle}{
\headrule \sethead[\thepage][][\color{red} \chaptertitlename\ \thechapter. \chaptertitle]
{\color{red} \thesection\ \sectiontitle}{}{\thepage}}
\pagestyle{mystyle}
장에는 관심이 없고 섹션 제목에만 관심이 있다면(비록 book 클래스를 사용하고 있지만) 시도해 볼 수 있습니다.
\newpagestyle{mystyle2}{
\headrule \sethead[\thepage][][\color{red} \thesection\ \sectiontitle]
{\color{red} \thesection\ \sectiontitle}{}{\thepage}}
\pagestyle{mystyle2}
이것은 당신이 기대하는 것과 같아야합니다.