3

I want to have two references to the same footnote. My version has the problem that the reference to the footnote is represented with a uppercase number and I want it the same size as the footnote-number:

TextA~\footnote{TextFootnote\label{ftn:X}} 
TExtB~\ref{ftn:X}

Someone has a different solution?

whole document:

\documentclass[11pt, a4paper, oneside]{Thesis}
\usepackage[english,german]{babel} 
\usepackage[textsize=tiny]{todonotes}
\usepackage{doi}
\usepackage[square, numbers, comma, sort&compress]{natbib} 
\usepackage{enumitem}
\usepackage{acronym}  
\usepackage{booktabs}
\usepackage[version=4]{mhchem}
\usepackage{soul}
\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath}  
\setlist{nolistsep} 
\graphicspath{{Pictures/}{Figures/}}

\begin{document}
TextA~\footnote{TextFootnote\label{ftn:X}} \\
TextB~\textsuperscript{\ref{ftn:X}}
\end{document}
  • Have you tried using \textsuperscript{\ref{ftn:X}}? – Guilherme Zanotelli Dec 5 '16 at 13:20
  • it worked but the linkborder is smaller. – marsUbuntux Dec 5 '16 at 13:28
  • 1
    You're using hyperref then? Please post a minimal working example starting with \documentclass and ending with \end{document} which shows the problem. – Guilherme Zanotelli Dec 5 '16 at 13:30
  • added info in my question. – marsUbuntux Dec 5 '16 at 13:43
3

To get the footnote number as superscript use \textsuperscript{\ref{<label>}}. The link box provided by hyperref is not easy to tweak with, but in Adjust box around hyperref footnote links there is a solution to make all boxes fit the number tightly.

Resulting in:

enter image description here

MWE

\documentclass[11pt, a4paper, oneside]{article}
\usepackage{hyperref}

%% Code from https://tex.stackexchange.com/a/45656/81905
\usepackage{ltxcmds}
\makeatletter
\renewcommand{\footnote}[2][\empty]{%
  \nolinebreak%
  \addtocounter{footnote}{+1}%
  \xdef\sfootnote@number{\arabic{footnote}}%
  \ltx@ifpackageloaded{hyperref}{% hyperref loaded
    \ifHy@hyperfootnotes% option hyperfootnotes=true
      \addtocounter{Hfootnote}{+1}%
      % Code from the hyperref package
        \global\let\Hy@saved@currentHref\@currentHref%
        \hyper@makecurrent{Hfootnote}%
        \global\let\Hy@footnote@currentHref\@currentHref%
        \global\let\@currentHref\Hy@saved@currentHref%
      % End of code form the hyperref package
    \fi%
   }{% hyperref not loaded, nothing to be done here
   }%
  \xdef\sfootnote@opt{#1}% contains the optional argument
  \xdef\sfootnote@arabic{\arabic{footnote}}% is the Arabic footnotenumber
  \edef\sfootnote@formated{\thefootnote}% could also be * or dagger
  \ifx\sfootnote@opt\empty% i.e. no optional argument used
    \footnotetext{\label{fnr:\sfootnote@arabic}#2}%
  \else%
    \ltx@ifpackageloaded{hyperref}{% hyperref loaded
      \footnotetext[#1]{\phantomsection\label{fnr:\sfootnote@arabic}#2}%
     }{% hyperref not loaded
      \footnotetext[#1]{\label{fnr:\sfootnote@arabic}#2}%
     }%
  \fi%
  \ltx@ifpackageloaded{hyperref}{% hyperref package loaded
    \ifHy@hyperfootnotes% option hyperfootnotes=true
      \hbox {\@textsuperscript {\normalfont \ref{fnr:\sfootnote@arabic}}}%
    \else% option hyperfootnotes=false
      \hbox {\@textsuperscript {\normalfont \ref*{fnr:\sfootnote@arabic}}}%
    \fi%
  }{% hyperref package not loaded
    \hbox {\@textsuperscript {\normalfont \ref{fnr:\sfootnote@arabic}}}%
   }%
}
\makeatother
%% End of code

\begin{document}
\noindent Textoç~\footnote{TextFootnote\label{ftn:X}} \\
TextB~\textsuperscript{\ref{ftn:X}}
\end{document}
  • if i use this all my footnotes ~\footnote{blabla} become question marks. – marsUbuntux Dec 5 '16 at 14:18
  • Did you compile your code more than once? – Guilherme Zanotelli Dec 5 '16 at 14:19
  • Clear, I didn't. Now the right numbers appears with resized borders. But when i click: some bring me to the beginning of the document, some bring me to wrong footnotes and other bring me to the right place. – marsUbuntux Dec 5 '16 at 14:27
  • 1
    @marsUbuntux please, try deleting the document.aux and document.out files from your folder after you activate this tweak, and compile 3 times. Does the problem persist? – yo' Dec 5 '16 at 16:40
  • 1
    @marsUbuntux, of course posting your whole code wouldn't be a good idea. Though the process of making a MWE that can reprodruce the problem is something that needs to be done for us to troublehoot the problem. Maybe it's an incompatibility between packages... Did you load hyperreff as the last package? Try removing packages that mess with the footnotes or packages that could be related. – Guilherme Zanotelli Dec 6 '16 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.