LaTeX-Package-Repositories / LaTeX-Package-Repositories/doi

Formatting prefix and hyperlink

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
10
Forks
1
PR merge metrics
No merged PRs in 30d

Description

I'm struggling to make two changes to how the DOI is formatted by this package: 1) change the format of the prefix to use small caps; and 2) change the colour of the hyperlink.

  1. I tried to edit the \doitext command in doi.sty to:
    \newcommand{\doitext}{\textsc{doi: }}
    but when I compile my document I get an error associated with the .bbl file:
    Missing control sequence inserted. \newblock \doi{10.1002/andp.19053221004}
  2. I have set the options for the hyperref package to colour both links and citations blue but these options seem to be ignored by the doi package.

Does anyone have any suggestions? I've included my MWE file contents below. The doi.sty file is unchanged except for when I tried that one change described above.

Cheers!

Contents of my mwe.tex file:
\documentclass[a4paper]{article}

\usepackage{natbib}
\usepackage{hyperref}
\usepackage{doi}

\hypersetup{colorlinks=true, citecolor=blue, linkcolor=blue}

\begin{document}

	This is a test \citep{einstein}.

	\bibliographystyle{plainnat}
	\bibliography{mwe.bib}

\end{document}

Contents of my mwe.bib file:

@article{einstein,
	author =       "Albert Einstein",
	title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
	[{On} the electrodynamics of moving bodies]",
	journal =      "Annalen der Physik",
	volume =       "322",
	number =       "10",
	pages =        "891--921",
	year =         "1905",
	DOI =          "10.1002/andp.19053221004"
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with doi.sty and reproduce the included mwe.tex and mwe.bib example. Inspect how \doitext and DOI hyperlinks are defined, then verify that small-caps prefix formatting and hyperref link colors both work without the .bbl error.】【。

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.