2

I am new to LaTeX sorry if this is very naive, I have a school project and decided to use this as a chance to learn LaTeX.

enter image description here

After doing what some YouTube videos told me to, I somehow get a default "references" which I either want to change color or remove and have the citations under bibliography which is already blue

I did not find any related questions here, any way forward?

Here is the MWE

\documentclass[a4paper,16pt]{article}

\usepackage[utf8]{inputenc}

\usepackage{hyperref}

\hypersetup{colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red}}

\begin{document}

\section*{\color{blue}Bibliography}

~\cite{enwiki:1028348687}

\bibliographystyle{plain} \bibliography{wiki.bib}

\end{document}

Linkin
  • 125
  • 2
    The answer depends on how you set up your bibliography (there are several ways to do that in LaTeX) and a few other things. Please show us how you currently generate your bibliography in a small example document that reproduces the output you show in the question with as little unrelated code as possible (often called MWE: https://tex.meta.stackexchange.com/q/228/35864). – moewe Jun 16 '21 at 05:32
  • 1
    Welcome to TeX.SE. – Mico Jun 16 '21 at 05:33
  • 1
    @moewe sir/ma'am will my recent edit do? – Linkin Jun 16 '21 at 06:11
  • 1
    You could remove the \section*{\color{blue}Bibliography} and add \renewcommand*{\refname}{\color{blue}Bibliography} to your preamble. – moewe Jun 16 '21 at 06:20
  • 1
    @moewe I don't know how it worked but it worked! Could you copy-paste that as an answer? – Linkin Jun 16 '21 at 06:25

1 Answers1

3

In the article class the heading of the bibliography is saved in \refname. So you could remove the manual \section*{\color{blue}Bibliography} and tell LaTeX to typeset the heading as you like by redefining \refname with \renewcommand*{\refname}{\color{blue}Bibliography}.

\documentclass[a4paper,16pt]{article}

\usepackage[utf8]{inputenc}

\usepackage{hyperref}

\hypersetup{colorlinks,linkcolor={blue},citecolor={blue},urlcolor={red}}

\renewcommand*{\refname}{\color{blue}Bibliography}

\begin{document} \cite{enwiki:1028348687}

\bibliographystyle{plain} \bibliography{wiki} \end{document}

Note that you may need additional code when you use a localisation package like babel or polyglossia. See How to change the name of document elements like "Figure", "Contents", "Bibliography", "Appendix", etc.?.

Note that report- and book-based classes generally use \bibname where article-based classes usually use \refname.

moewe
  • 175,683