1

I am using Overleaf. If I click the blue-colored hyperlink for the footnote on the pdf file, it goes to the front page, not to the footnote as I intended. How should I fix this? I am using the following structure:

\documentclass[11pt,english]{extarticle}
\usepackage{listings}
\lstset{language=Matlab}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{float}
\usepackage{color}
\usepackage[title,titletoc,toc]{appendix}
\usepackage[nohead]{geometry}
\usepackage[bottom]{footmisc}
\usepackage{endnotes}
\usepackage{graphicx}
\usepackage[center,bf]{caption}
\usepackage{morefloats}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{enumerate}
\usepackage{bbm}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\numberwithin{equation}{section}
\usepackage{fancyhdr}
\setlength{\parindent}{24pt}
\setlength{\headheight}{0in}
\usepackage{longtable}
\usepackage{import}
\usepackage{natbib}
\setlength{\bibsep}{0pt plus 0.3ex}
\usepackage{microtype}

\usepackage{multirow} \usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This package makes you cross-reference across different tex files. \usepackage{xr-hyper} \usepackage[colorlinks=true,urlcolor=blue, linkcolor=blue, citecolor=blue]{hyperref} \hypersetup{ filecolor=black } \makeatletter \newcommand*{\addFileDependency}[1]{ \typeout{(#1)} @addtofilelist{#1} \IfFileExists{#1}{}{\typeout{No file #1.}} } \makeatother

\newcommand*{\myexternaldocument}[1]{ \externaldocument{#1} \addFileDependency{#1.tex} \addFileDependency{#1.aux} } %%% END HELPER CODE

\myexternaldocument{online_appendix} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{verbatim} \usepackage{setspace} \linespread{1.3} \usepackage{pdflscape} \usepackage{subcaption} \usetikzlibrary{arrows,calc} \usepackage{setspace} \usepackage{ragged2e}

%%%%%%%%%%% Suppress Warning \usepackage{silence} \WarningFilter{latex}{Text page} \WarningFilter{natbib}{Citation} \WarningFilter{natbib}{There}

\usepackage{changepage} \newlength{\wideitemsep} \setlength{\wideitemsep}{\itemsep} \addtolength{\wideitemsep}{5pt} \let\olditem\item \renewcommand{\item}{\setlength{\itemsep}{7pt}\olditem}

\newcommand{\sym}[1]{{#1}}

\long\def/#1/{}

%%%%%% % Make Title appear in the top of the page \usepackage{titling} %\setlength{\droptitle}{-4em} \setlength{\droptitle}{-2em} %%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Directly brought from Lyx %%%% \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{geometry} %\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm} \geometry{verbose,tmargin=2.7cm,bmargin=2.7cm,lmargin=2.5cm,rmargin=2.5cm} %\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=2.3cm,rmargin=2.3cm} \usepackage{amsthm} \usepackage{amssymb} %\usepackage{setspace} %\doublespacing

\makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands. \theoremstyle{plain} \newtheorem{thm}{\protect\theoremname} \theoremstyle{plain} \newtheorem{prop}[thm]{\protect\propositionname} \ifx\proof\undefined \newenvironment{proof}[1][\protect\proofname]{\par \normalfont\topsep6\p@@plus6\p@\relax \trivlist \itemindent\parindent \item[\hskip\labelsep\scshape #1]\ignorespaces }{% \endtrivlist@endpefalse } \providecommand{\proofname}{Proof} \fi \theoremstyle{plain} \newtheorem{cor}[thm]{\protect\corollaryname}

\makeatother

\usepackage{babel} \providecommand{\corollaryname}{Corollary} \providecommand{\propositionname}{Proposition} \providecommand{\theoremname}{Theorem}

\begin{document}

\title{\textbf{\large{}!!title}\thanks{!!acknowledgement}}

\date{{\normalsize{}!!date \endgraf \vspace{0.5mm} }} \maketitle %% Do not number title page \begingroup \let\clearpage\relax \let\cleardoublepage\relax \thispagestyle{empty}%<======= \endgroup

\newpage{} \setcounter{page}{1}

\section{Introduction} \label{section:introduction}

Words\footnote{hi}

\newpage{}

\begin{singlespacing} %\nocite{*} \bibliographystyle{aer} \bibliography{Reference} \end{singlespacing}

\end{document}

user1849133
  • 217
  • 2
  • 7
  • The first step is usually to start removing packages and superfluous code. If the problem goes away, then you know the caused it. – John Kormylo Sep 07 '22 at 04:07
  • 1
    Pretty sure the problem is that you're loading hyperref too early. Hyperref should usually be loaded after other packages. Try moving the lines loading xr-hyper, hyperref and hypersetup packages until almost right before \begin{document}. You may need to move the \myexternaldocument stuff till after that as well. – frabjous Sep 07 '22 at 04:11
  • 1
    Unrelated but you're also loading the geometry, amssymb and setspace packages twice. You should take one out. – frabjous Sep 07 '22 at 04:13
  • Does LaTeX really have such a huge number of packages? – wipet Sep 07 '22 at 06:02
  • 1
    The setspace package changes footnotes and should therefore be loaded before hyperref. And you are resetting the page number to 1. That will confuse links too. Give the title page a different numbering style. The \clearpage code is nonsense and I have some doubts that your document is really latin9 encoded. – Ulrike Fischer Sep 07 '22 at 07:45
  • @wipet CTAN currently hosts 6289 packages. Of course they are not all for LaTeX but most are. For me that points to a healthy ecosystem with lots of contributors, and a range of functionality beyond imagination :) – Marijn Sep 07 '22 at 13:18
  • @Marijn CTAN hosts my packages too but they surely are not LaTeX packages. And healthy ecosystem? There are users they insert huge \usepackage without understanding what the packages are doing and then the users put a desperate question "somethig is wrong" (like here). This doesn't confirm the opinion of "healthy" ecosystem :) – wipet Sep 07 '22 at 18:34
  • @frabjous It worked after putting hyperref after other packages. This same code has another problem though. I asked this question here. I will appreciate it if you could tell me how to fix this. https://tex.stackexchange.com/questions/660242/citation-links-on-pdf-are-being-created-on-both-author-list-and-year – user1849133 Oct 02 '22 at 05:10

0 Answers0