3

I wonder if anyone can advise me as to what is wrong?

I have a LaTeX report where I reference the same footnote more than once on a page in the introduction:

documentclass[oneside,11pt]{report}

\usepackage[hang, flushmargin]{footmisc}
\usepackage[colorlinks=true]{hyperref}
\usepackage{footnotebackref}
%\usepackage{hyperref}
%\usepackage{footmisc}
\usepackage{graphics}
\usepackage{graphicx}

\begin{document}

    \begin{abstract}
        This report\ldots
    \end{abstract}

    \tableofcontents
    \listoffigures
    
    \pagenumbering{arabic} 
    
    \part{Introduction and opening remarks}
    \chapter{Introduction}
    
    \section{MySQL}
    MySQL\footnote{\url{http://mysql.com/}.} is a popular RDBMS supported by Oracle\footnote{\url{http://www.oracle.com/}\label{OracleURL}.}.

    \section{NetBeans}
    NetBeans\footnote{\url{https://netbeans.org/}.} is an integrated development environment (IDE) principally for Java, but which supports several other programming languages. and other languages. NetBeans is sponsored by Oracle\footref{OracleURL}.
    \section{Treemap}
    Treemaps are defined by Wikipedia \footnote{\url{http://en.wikipedia.org/wiki/Treemapping}.}.
    
    \chapter{Bakground}
    \chapter{Review} 
            
    \part{Case study one}
    \chapter{Apparatus}
    \chapter{Method} 
    \chapter{Experiment} 
    \chapter{Results}  
    
    \part{Case study two}
    \chapter{Apparatus}
    \chapter{Method}
    \chapter{Experiment}
    \chapter{Results}        
    
    \appendix
    
    \chapter{References}

\end{document}

This works correctly. But if I try to add the usepackage statements from this report to another, the second report fails to compile because of a

 LaTeX Warning: Command \@footnotetext  has changed.
           Check if current package is valid.

)

! LaTeX Error: Option clash for package hyperref.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.31 \usepackage
                {footnotebackref}
? 

Process has been terminated ...

And even if I reset the usepackage statements to:

\usepackage{hyperref}
\usepackage{footmisc}

The footnotes of the second report all take me to the report's front page.

Why?

The current second report can't be shown in its entirety but this is very close to what it is like:

\documentclass[oneside,11pt]{report} % Use twoside for alternate page headings.

% \usepackage{algcompatible}
\usepackage{algorithm}
\usepackage{algorithmic}
% \usepackage{algorithmicx}
% \usepackage{algpseudocode}
\usepackage{alltt}
\usepackage{anysize}
\usepackage{appendix}
\usepackage{array}
\usepackage{bookmark}
\usepackage{booktabs}
\usepackage{changepage}
\usepackage{cite}
\usepackage{color}
\usepackage{enumerate}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage{fixltx2e}
% \usepackage[hang, flushmargin]{footmisc}
% \usepackage[colorlinks=true]{hyperref}
% \usepackage{footnotebackref}
\usepackage{footmisc}
\usepackage{hyperref}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{longtable}
% \usepackage{minitoc}
\usepackage{pdflscape}
\usepackage{ragged2e}
\usepackage{setspace}
% \usepackage{soul}

\marginsize{2.54cm}{2.54cm}{2.54cm}{2.54cm}

% Tables.
\newcolumntype{R}[1]{>{\RaggedLeft\arraybackslash}p{#1}}

% ALGORITHMS. -------------------------------------------------------------------------------------

\makeatletter
\newcommand\fs@algorithmunruled{\def\@fs@cfont{}\let\@fs@capt\floatc@plain% Caption style.
    \def\@fs@pre{\kern8pt}
    % \def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}% Line at top of algorithm and 2pt gap.
    \def\@fs@post{}
    % \def\@fs@post{\kern2pt\hrule\relax}% Remove line below `\caption`.
    \def\@fs@mid{\kern8pt}% Line at bottom of algorithm.
    % \def\@fs@mid{}
    \let\@fs@iftopcapt\iffalse}% Place caption under algorithm.
\makeatother
\floatstyle{algorithmunruled}
\restylefloat{algorithm}

\renewcommand{\algorithmicforall}{\textbf{for each}}
\renewcommand{\thealgorithm}{\thechapter.\arabic{algorithm}}
\makeatletter
\@addtoreset{algorithm}{chapter}
\makeatother

% GLOSSARY. ---------------------------------------------------------------------------------------

\usepackage[acronym,footnote,nonumberlist]{glossaries} % Makes a list of abbreviations.
\usepackage{glossary-mcols}
% \makeglossaries % This must be run from the command-line: e.g. 'makeglossaries file'
                  % where `file` is the name of the main LaTeX file.
\renewcommand{\glossarypreamble}{Some text\ldots.}

\include{Glossary}
%\renewcommand{\glsnamefont}[1]{\textbf{#1}}

\makeglossaries
\glossarystyle{mcolindex}

% ADD TEXT TO PART PAGE. --------------------------------------------------------------------------

\makeatletter

\let\LaTeXStandardPart\part%
\newcommand{\unstarredpart@@noopt}[1]{%
    \unstarredpart@@opt[#1]{#1}%
}

\newcommand{\unstarredpart@@opt}[2][]{%
    \cleardoublepage% (For clearing content before.)
    \begingroup%
    \let\newpage\relax%
    \LaTeXStandardPart[#1]{#2}%
    \endgroup%
}

\newcommand{\starredpart}[1]{%
    \LaTeXStandardPart*{#1}%
}

\newcommand{\unstarredpart}{%
    \@ifnextchar[{\unstarredpart@@opt}{\unstarredpart@@noopt}%
}

\renewcommand{\part}{%
  \@ifstar{\starredpart}{\unstarredpart}%
}

\begin{document}

    \pagenumbering{roman}

    % Title page.
    \title{\textcolor{red}{** WORKING DRAFT **}}
    \author{Author}

    \begin{abstract}
        This report\ldots
    \end{abstract}

    \tableofcontents

    % Print glossary.
    \glsaddall
    \printglossary[type=acronym,title={List of Abbreviations}]
    %\printglossaries%[title={List of abbreviations}]

    % Print algorithms.
    \listofalgorithms
    \setcounter{chapter}{0}

    \listoffigures
    \listoftables

    \pagenumbering{arabic}

    \part{Introduction and opening remarks}
    \chapter{Introduction}

    \section{MySQL}
    MySQL\footnote{\url{http://mysql.com/}.} is a popular RDBMS supported by Oracle\footnote{\url{http://www.oracle.com/}\label{OracleURL}.}.

    \section{NetBeans}
    NetBeans\footnote{\url{https://netbeans.org/}.} is an integrated development environment (IDE) principally for Java, but which supports several other programming languages. and other languages. NetBeans is sponsored by Oracle\footref{OracleURL}.
    \section{Treemap}
    Treemaps are defined by Wikipedia \footnote{\url{http://en.wikipedia.org/wiki/Treemapping}.}.

    \chapter{Bakground}
    \chapter{Review}

    \part{Case study one}
    \chapter{Apparatus}
    \chapter{Method}
    \chapter{Experiment}
    \chapter{Results}

    \part{Case study two}
    \chapter{Apparatus}
    \chapter{Method}
    \chapter{Experiment}
    \chapter{Results}

    \appendix

    \chapter{References}

\end{document}
12
  • We can't know what's in the “other” report, can we?
    – egreg
    Commented Sep 27, 2014 at 13:45
  • I've added something like the second report but it has a lot of other code to do various things.
    – Mr Morgan
    Commented Sep 27, 2014 at 14:01
  • 1
    It is really not wise to load packages alphabetically, as much as you might like to do so. Load packages in a conceptually logical order, and note that hyperref is a package that should be among the last loaded. (For what it's worth, I tend to group packages into categories like: fonts, (physical) page setup, sectional divisions, language & bibliography, lists & tables, colours & graphics, misc., personal packages, hyperref & bookmarks.) See also the pkgloader package.
    – jon
    Commented Sep 27, 2014 at 19:36
  • Even if I remove hyperref, the footnotes still point at the first page. It is irksome. But I take the point about order.
    – Mr Morgan
    Commented Sep 27, 2014 at 19:42
  • Please clarify 'remove': in the second .tex file, you have % \usepackage[colorlinks=true]{hyperref} then \usepackage{hyperref} 3 lines later. That can be the cause of the Option clash error you report above(?!) that file if you try to load the package twice. There are also other loading errors. bookmark loads hyperref, too, which can clash with other packages, such as the graphics-related ones. (Also: don't load graphics and graphicx -- just the latter should be fine.) Really, if you think about and reorganize your preamble, you'll be in better shape overall.
    – jon
    Commented Sep 27, 2014 at 20:49

2 Answers 2

1

For the option clash warning, the package bookmark loads the hyperref package with the default set of hyperref package options if it isn't there already. Your bigger footnote problem is the result of setspace changing the definition of \footnote after hyperref has done its work. If you put \usepackage[colorlinks=true]{hyperref} after setspace but before bookmarks:

\documentclass[11pt]{report}
\usepackage{setspace}
\usepackage[hang, flushmargin]{footmisc}

\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{alltt}
\usepackage{anysize}
\usepackage{appendix}
\usepackage{array}
\usepackage{booktabs}
\usepackage{changepage}
\usepackage{cite}
\usepackage{color}
\usepackage{enumerate}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage{fixltx2e}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{ragged2e}


\usepackage[colorlinks=true]{hyperref}
\usepackage{bookmark}

\marginsize{2.54cm}{2.54cm}{2.54cm}{2.54cm}

% Tables.
\newcolumntype{R}[1]{>{\RaggedLeft\arraybackslash}p{#1}}

% ALGORITHMS. -------------------------------------------------------------------------------------

\makeatletter
\newcommand\fs@algorithmunruled{\def\@fs@cfont{}\let\@fs@capt\floatc@plain% Caption style.
    \def\@fs@pre{\kern8pt}
    % \def\@fs@pre{\hrule height.8pt depth0pt \kern2pt}% Line at top of algorithm and 2pt gap.
    \def\@fs@post{}
    % \def\@fs@post{\kern2pt\hrule\relax}% Remove line below `\caption`.
    \def\@fs@mid{\kern8pt}% Line at bottom of algorithm.
    % \def\@fs@mid{}
    \let\@fs@iftopcapt\iffalse}% Place caption under algorithm.
\makeatother
\floatstyle{algorithmunruled}
\restylefloat{algorithm}

\renewcommand{\algorithmicforall}{\textbf{for each}}
\renewcommand{\thealgorithm}{\thechapter.\arabic{algorithm}}
\makeatletter
\@addtoreset{algorithm}{chapter}
\makeatother

% GLOSSARY. ---------------------------------------------------------------------------------------

\usepackage[acronym,footnote,nonumberlist]{glossaries} % Makes a list of abbreviations.
\usepackage{glossary-mcols}
% \makeglossaries % This must be run from the command-line: e.g. 'makeglossaries file'
                  % where `file` is the name of the main LaTeX file.
\renewcommand{\glossarypreamble}{Some text\ldots.}

\include{Glossary}
%\renewcommand{\glsnamefont}[1]{\textbf{#1}}

\makeglossaries
\glossarystyle{mcolindex}

% ADD TEXT TO PART PAGE. --------------------------------------------------------------------------

\makeatletter

\let\LaTeXStandardPart\part%
\newcommand{\unstarredpart@@noopt}[1]{%
    \unstarredpart@@opt[#1]{#1}%
}

\newcommand{\unstarredpart@@opt}[2][]{%
    \cleardoublepage% (For clearing content before.)
    \begingroup%
    \let\newpage\relax%
    \LaTeXStandardPart[#1]{#2}%
    \endgroup%
}

\newcommand{\starredpart}[1]{%
    \LaTeXStandardPart*{#1}%
}

\newcommand{\unstarredpart}{%
    \@ifnextchar[{\unstarredpart@@opt}{\unstarredpart@@noopt}%
}

\renewcommand{\part}{%
  \@ifstar{\starredpart}{\unstarredpart}%
}
\begin{document}\pagenumbering{roman}
   \begin{abstract}
        This report\ldots
    \end{abstract}

    \tableofcontents
  \pagenumbering{arabic}

    \part{Introduction and opening remarks}
    \chapter{Introduction}

    \section{MySQL}

    MySQL\footnote{\url{http://mysql.com/}.} is a popular RDBMS supported by Oracle\footnote{\url{http://www.oracle.com/}\label{OracleURL}.}.

    \section{NetBeans}
    NetBeans\footnote{\url{https://netbeans.org/}.} is an integrated development environment (IDE) principally for Java, but which supports several other programming languages. and other languages. NetBeans is sponsored by Oracle\footref{OracleURL}.
    \section{Treemap}
    Treemaps are defined by Wikipedia.\footnote{\url{http://en.wikipedia.org/wiki/Treemapping}.}


\end{document}

your report looks like it compiles fine for me.

5
  • Thanks but I've tried this in both reports and neither works properly.
    – Mr Morgan
    Commented Sep 27, 2014 at 19:33
  • @MrMorgan Ack. I'm sorry, I must have been reading too hastily. I've updated my answer to one I hope will be more helpful.
    – Trold
    Commented Sep 27, 2014 at 20:23
  • Even if I do change this though, the problem appears unresolved. Everything but the footnotes work.
    – Mr Morgan
    Commented Sep 27, 2014 at 20:31
  • That's because I somehow managed to change the order of package uses from the working example on my computer to this answer. I've edited the answer again, this time just copy/pasting the fixed version of your 2nd report into the answer. Hopefully I've not made any more foolish mistakes this time.
    – Trold
    Commented Sep 27, 2014 at 20:43
  • @MrMorgan try to reorder the packages in a more logical order such as Jon suggested you before.
    – Aradnix
    Commented Sep 27, 2014 at 20:47
0

There can be very good reasons to load hyperref early. The following coding works for me.

\makeatletter
 \let\HYP@footnotetext\@footnotetext
\makeatother
\usepackage{footmisc}
\makeatletter
 \let\FN@footnotetext\@footnotetext
 \let\H@@footnotetext\FN@footnotetext
 \let\@footnotetext\HYP@footnotetext
\makeatother

It works by recreating the expansion of \@footnotetext that would occur if footmisc were loaded first.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .