TransWikia.com

Change the color of footnote marker in LaTeX

TeX - LaTeX Asked by Gerry on April 19, 2021

I’m trying to do up a resume in LaTeX however I’m wanting to use a different color for the footnote markers so that it’s clear that they are not part of the normal text.

PHP, Java, Cfootnote{It has been many years since I've used this in a project}, Python

This results in the following, which ends up looking like C^1:
PHP, Java, C^1, Python

How do I change the font color of the “1” to a light grey so that it’s more obvious that it’s separate from the main body of text.

5 Answers

It all depends on exactly what do you want to colorize since there are three possible elements involved: 1) the mark used in the text to signal the footnote, 2) the mark used at the bottom of the page where the actual footnote text appears, and (possibly) 3) the mark used when cross-referencing the footnote. In the following examples I used the color red just to highlight the different results:

A redefinition of thefootnote (like some other answers suggest) will affect all these three elements:

documentclass{article}
usepackage[paperheight=3cm]{geometry}% just for the example
usepackage{xcolor}

renewcommandthefootnote{textcolor{red}{arabic{footnote}}}

begin{document}

PHP, Java, Cfootnote{label{a}It has been many years since I've used this in a project}, Python

As was mentioned in~ref{a}

end{document}

enter image description here

If one only wants to change color to elements 1) and 2) (the marks in the body and in the actual footnote text) but not to 3) (the number used in cross-references), then a redefinition of @makefnmark will be needed:

documentclass{article}
usepackage[paperheight=3cm]{geometry}% just for the example
usepackage{xcolor}

makeatletter
renewcommand@makefnmark{hbox{@textsuperscript{normalfontcolor{red}@thefnmark}}}
makeatother

begin{document}

PHP, Java, Cfootnote{label{a}It has been many years since I've used this in a project}, Python

As was mentioned in~ref{a}

end{document}

enter image description here

Finally, if the change of color must affect only the mark used in the body of the document without affecting the mark used in the footnote text or the number used in cross-references, then redefinitions of @makefnmark, and @makefntext will be needed:

documentclass{article}
usepackage[paperheight=3cm]{geometry}% just for the example
usepackage{xcolor}

makeatletter
renewcommand@makefnmark{hbox{@textsuperscript{normalfontcolor{red}@thefnmark}}}
renewcommand@makefntext[1]{%
  parindent 1emnoindent
            hb@[email protected]{%
                hss@textsuperscript{normalfont@thefnmark}}#1}
makeatother

begin{document}

PHP, Java, Cfootnote{label{a}It has been many years since I've used this in a project}, Python

As was mentioned in~ref{a}

end{document}

enter image description here

Correct answer by Gonzalo Medina on April 19, 2021

In preamble:

usepackage[usenames,dvipsnames]{color}

renewcommand{thefootnote}{textcolor{Gray}{arabic{footnote}}}

Answered by rkhayrov on April 19, 2021

Another possibility is:

C{color{Gray}footnote{TextOfTheFootnote}}

Answered by ashiaka on April 19, 2021

Using the enotez package this works for me.

documentclass[11pt]{article}
usepackage{xcolor}
usepackage[colorlinks]{hyperref}
usepackage{enotez}
letfootnoteendnote

renewcommand*enotezwritemark[1]{hypersetup{linkcolor=blue}textsuperscript{#1}hypersetup{linkcolor=red}}

begin{document}

begin{equation}
    x = 1
    label{eq1}
end{equation}

This is equation ref{eq1}

The color of a footnote should be differentfootnote{in fact it should be blue}.

printendnotes

end{document}

output

Answered by Joost Kruis on April 19, 2021

Try this:

usepackage{hyperref} % IN THE PREAMBLE
hypersetup{linkcolor = red}

Just don't forget to change linkcolor back if you don't want to leave as it is

hypersetup{linkcolor = black}

This also works with footnotemark color change.

Answered by Quaternion on April 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP