natbib 패키지와 fancyhdr 패키지를 함께 사용하는 방법

natbib 패키지와 fancyhdr 패키지를 함께 사용하는 방법

natbib 패키지와 함께 fancyhdr 패키지를 어떻게 사용할 수 있습니까? 내 문서에서 두 가지를 사용할 수 없는 경우가 발생합니다. 무엇이 문제일까요? 어떻게 바로잡을 수 있나요?

\documentclass[12pt, a4paper]{report}

\usepackage{titling}

\usepackage{natbib}
\bibliographystyle{apalike}

\usepackage{fancyhdr}
\fancyhead{} % This clears whatever was there before
\renewcommand{\headrulewidth}{0pt} % Set to 0 if you don't want a bar at the bottom.
\fancyhead[RE, RO]{\thepage} % Right even, right odd pages.
\fancyhead[LE, LO]{\textsc \rightmark} % Right even, right odd pages.
\setlength{\headheight}{15pt}

\fancyfoot{}
\renewcommand{\footrulewidth}{0pt} % Set to 0 if you don't want a bar at the bottom.
%\fancyfoot[C]{\thepage}
\pagestyle{fancy}

\begin{document}
\begin{large}

%\begin{figure}
    %\centering
%\includegraphics[scale=0.5]{UI.jpg}
%\end{figure}

\begin{titlepage}
\begin{center}

\Large{\textsc{By}} \\


\vfill




\Large{\sc{A project in the department of mathematics, submitted in partial fulfillment of the requirements for the award of bachelor of science (mathematics), \\ }}
\vfill
\Large{\textsc{April, 2023.}}
\end{center}
\end{titlepage}

\chapter*{\center \Huge \textbf{CERTIFICATION}}
We certify that this project was carried out by \textbf{}, in the Department of Mathematics, Faculty of Science,, under my supervision.

\vspace{5cm}

\begin{center}
\line(1,0){180}
\hspace{10cm}
(Supervisor)\\

\end{center}
\addcontentsline{toc}{chapter}{Certification}
\setcounter{page}{2}

\tableofcontents

\chapter{Introduction}
Ordinary differential equations (ODEs) are commonly employed to represent the behavior of dynamic systems in various fields of science and engineering. However, ODEs have certain limitations when it comes to describing dynamics that involve discontinuities, impulses, and uncertain behaviors. Consequently, ordinary differential inclusions (ODIs) have been successfully employed as a useful approach to model such systems.\\

The concept of differential inclusion was studied broadly by Jean-Pierre Aubin, a mathematician from France, during the early 1980s. Differential inclusion is a versatile mathematical tool that extends the scope of differential equations and is utilized to represent diverse phenomena in both physical and social sciences. ODIs have applications in many fields, including control theory, economics, and population dynamics, physics, etc.\\[5pt]
In recent times, ODIs have gained considerable attention, and researchers have increasingly shown interest in exploring the characteristics of the solution set of ODIs, such as their properties of boundedness, uniqueness, and existence.\\[5pt]
The objective of this study is to examine and review the set of solutions for ordinary differential inclusions (ODIs) and establish criteria for the existence of solutions.\\[5pt]
Additionally, we apply our findings to a diverse range of examples in fields such as control theory, economics, and biology.

\citep{Doe:1966}
\citep{key}
\bibliography{MyReferences}
%\bibliography{sample}
\nocite{*}
\addcontentsline{toc}{chapter}{References}

\end{large}

\end{document}

답변1

fancyhdr패키지를 함께 사용할 수 없다는 귀하의 추정은 natbib확실히 잘못된 것입니다. 많은 문서에서 두 패키지를 모두 사용하고 있습니다. 예를 들면 다음과 같습니다.

\begin{filecontents}[overwrite]{\jobname.bib}
@misc{pkg:fancyhdr,
  author={Pieter van Ostrum},
  title={{\textsc{fancyhdr}}---Extensive control of page headers and footers in {\LaTeXe}},
  year=2022,
  note={\url={https://ctan.org/pkg/fancyhdr}},
}
@misc{pkg:natbib,
  author={Patrick W. Daly},
  title={{\textsc{natbib}}---Flexible bibliography support},
  year=1993,
  note={\url{https://ctan.org/pkg/natbib}},
}
\end{filecontents}

\documentclass[twoside]{report}

\usepackage{natbib}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage[nottoc]{tocbibind}% bibliography entry (an others) to the ToC
%\usepackage{parskip}% Try this, if you want paragraph distance instead of first line indent.

\usepackage{mwe}% Useful for dummy text in minimal working examples.

\fancyhead[RE]{\scshape\nouppercase \leftmark}% makes sense only with class option twoside
\fancyhead[LO]{\scshape\nouppercase \rightmark}
\fancyhead[RO,LE]{\thepage}% LE makes sense only with class option twoside
\fancyfoot[C]{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}

\bibliographystyle{apalike}% simply an author-year-style but without any relation to APA

\begin{document}
\title{Demonstration of Package Combination}
\author{Cabohah}
\date{2024-01-13}
\maketitle
\tableofcontents

\chapter{Using packages \textsc{natbib} and \textsc{fancyhdr} together}
There isn't a real problem in using packages \textsc{natbib}
\citep{pkg:natbib} and \textsc{fancydr} \citep{pkg:fancyhdr} together. Indeed
these packages are independent and usually do not influence each other.

\section{Only a demonstration section}
\lipsum[1-5]

\bibliography{\jobname}

\clearpage
If there would be additional entries in the bibliography, so that it would
need more than one page, you would get the same page header on even
bibliography pages like on this page.
\clearpage
If there would be additional entries in the bibliography, so that it would
need more than two pages, you would get the same page header on odd
bibliography pages like on this page.

\end{document}

제목 페이지

페이지 2&3

페이지 4&5

페이지 6&7

그래서 귀하의 문제는 이러한 패키지의 조합이 아니라 다른 패키지의 조합인 것 같습니다. 그러나 불행히도 귀하의 질문은 문제나 예상 결과를 알려주지 않습니다. 따라서 이 답변이 두 패키지가 호환되지 않는다는 기본 가정이 정확하지 않다는 것 이상을 알려줄 것이라는 희망은 거의 없습니다.

관련 정보