1

I wanted to get the title for each reference in italics, though apart from changing the style of references used (causes a lot of errors) I'm not sure of any other method. Also the first link of the first reference seems to extend beyond the margin (no other references with links shows the same behaviour). Here is my code:

\documentclass{article}
\usepackage{natbib}
\usepackage[utf8]{inputenc}
\usepackage[breaklinks,hidelinks]{hyperref}

\begin{filecontents}{references.bib}
@misc{ForwardReverseBias,
    title={Understanding the difference between P and N type semiconductors},
    author = {Power-and-beyond},
    howpublished={\url{https://www.power-and-beyond.com/understanding-the-difference-between-n-and-p-type-semiconductors-a-905805/}},
    year={2012}
}

@misc{Conductivity,
    title={Introduction to Inorganic Chemistry, Electronic Properties of Materials, Superconductors and Semiconductors},
    author={LibreTexts},
    howpublished={\url{https://chem.libretexts.org/Bookshelves/Inorganic_Chemistry/Book%3A_Introduction_to_Inorganic_Chemistry/10%3A_Electronic_Properties_of_Materials_-_Superconductors_and_Semiconductors/10.05%3A_Semiconductors-_Band_Gaps_Colors_Conductivity_and_Doping
    }}
}

@misc{Semiconductor,
    title={Semiconductor - Wikipedia},
    author={Wikipedia},
    howpublished = {\url{https://en.wikipedia.org/wiki/Semiconductor
    }}
}
\end{filecontents}

\title{A}
\author{Generic Account}
\date{August 2021}

\begin{document}

\maketitle

\section{Introduction}

a\cite{ForwardReverseBias} a\cite{Semiconductor} b\cite{Conductivity}

\bibliographystyle{unsrt}
\bibliography{references.bib}


\end{document}

Thanks!

1
  • When including .bib files, use filecontents please so that the code is all in one file as it is a lot easier to copy and paste. I do not know how to change the natbib format, hopefully someone else does, but to fix the first url extending beyond the margin put \usepackage[hyphens]{url} before hyperref and it forces the line break, courtesy of Heiko: tex.stackexchange.com/a/372007/245306
    – user245306
    Commented Aug 23, 2021 at 23:45

1 Answer 1

1

A preliminary observation: Since you're using the natbib citation management package, I would strongly recommend employing the unsrtnat rather than the older unsrt bibliography style.

To instruct the unsrtnat bibliography style file to render the contents of title fields in italics, I suggestion you proceed as follows.

  • Find the file unsrtnat.bst in your TeX distribution. May a copy of this file and call the copy, say, unsrtnat-ital.bst.

  • Open the file unsrtnat-ital.bst in a text editor. The editor you use to edit tex files will do fine.

  • In the .bst file, search for the function called format.title. In my copy of the file, the format.title function starts on line 299.

  • In this function, find the following line:

        { title "t" change.case$ }
    

    Change this line to:

        { title "t" change.case$ emphasize }
    
  • Save the file unsrtnat-ital.bst either in the directory that houses the main tex file or in a directory that's searched by BibTeX. If you choose the latter option, be sure to update the filename database of your TeX distribution suitably. (If you have no idea what the preceding sentence means, just choose the first options...)

  • In your main tex file, change the instruction

    \bibliographystyle{unsrt}
    

    to

    \bibliographystyle{unsrtnat-ital}
    

    and perform a full recompile cycle: LaTeX, BibTeX, and LaTeX twice more.


A full MWE (minimum working example) and its output:

enter image description here

\documentclass{article}
\begin{filecontents}[overwrite]{references.bib}
@misc{ForwardReverseBias,
    title={Understanding the difference between n- and p-type semiconductors},
    author = {Power-and-beyond},
    url={https://www.power-and-beyond.com/understanding-the-difference-between-n-and-p-type-semiconductors-a-905805/},
    year={2012}
}
@misc{Conductivity,
    title={Introduction to Inorganic Chemistry, Electronic Properties of Materials, Superconductors and Semiconductors},
    author={LibreTexts},
    url={https://chem.libretexts.org/Bookshelves/Inorganic_Chemistry/Book%3A_Introduction_to_Inorganic_Chemistry/10%3A_Electronic_Properties_of_Materials_-_Superconductors_and_Semiconductors/10.05%3A_Semiconductors-_Band_Gaps_Colors_Conductivity_and_Doping}
}
@misc{Semiconductor,
    title={Semiconductor},
    author={Wikipedia},
    url = {https://en.wikipedia.org/wiki/Semiconductor}
}
\end{filecontents}

\usepackage[T1]{fontenc}
\usepackage[numbers,compress]{natbib}
\bibliographystyle{unsrtnat-ital}
\usepackage{xurl} % <-- load 'xurl', not 'url', package
\usepackage[hidelinks]{hyperref}

\begin{document}
\cite{ForwardReverseBias,Conductivity,Semiconductor}
\bibliography{references}
\end{document}
4
  • Thanks for the informative response! I've got it set up now, though since I'm using overleaf, the italics part may have to be skipped Commented Aug 24, 2021 at 18:12
  • @GenericAccount - If you can't find unsrtnat.bst on Overleaf, you may always get it from the CTAN in the directory ctan.org/tex-archive/macros/latex/contrib/natbib.
    – Mico
    Commented Aug 24, 2021 at 18:24
  • Yup thanks for the link. I hope you don't mind me asking one last thing: is there a way to keep the capital letters in the titles? Commented Aug 24, 2021 at 18:33
  • @GenericAccount - Just enclose the contents of the title field in a second set of curly braces if you don't want BibTeX to apply so-called "sentence style" to any of the words in the title.
    – Mico
    Commented Aug 24, 2021 at 21:06

You must log in to answer this question.

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