# citation color bracket, \Cref{equation}, doi with url in reference list

\documentclass[5p]{elsarticle}

\begin{filecontents*}{mybibfile.bib}
@article{allik_hughes_1,
title   = "Finite element method for piezoelectric vibration",
journal = "Int J Numer Meth Engng",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
doi     = "10.1002/nme.1620020202",
author  = "{Allik H, Hughes TJR}"
}

@article{allik_hughes_2,
title   = {Vibrational response of sonar transducer using piezoelectric finite elements},
journal = "J Acoust Soc Am ;",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
doi     = "10.1121/1.1903513",
author  = "{Allik H, Kenneth MW, John TH}"
}

@article{Fish,
title   = "Modeling and simulation of piezocomposites",
journal = "Comput Meth Appl Mech and Engng",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
pages   = ":3211 -- 3232",
doi     = "10.1016/S0045-7825(03)00343-8",
author  = "{Fish J, Chen W }"
}
\end{filecontents*}

\usepackage{hyperref}
\hypersetup{colorlinks = true, allcolors = cyan}

\Crefformat{figure}{#2Fig.~#1#3}
\Crefmultiformat{figure}{Figs.~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3}

\usepackage{lineno}
\modulolinenumbers[5]

\journal{Journal of \LaTeX\ Templates}

\usepackage{subfig}
\usepackage{float}
\usepackage{graphicx}
\usepackage{color}
\usepackage{pgf,tikz}
\usepackage{multirow}

\usepackage{amsmath,amsfonts,amsthm,bm}
\bibliographystyle{elsarticle-num}

\begin{document}
\hypersetup{allcolors = cyan}

\captionsetup[figure]{labelfont={bf},labelformat={default},labelsep=period,name={Fig.}}%used to ref Figure 1: to Fig.1.

\section{Introduction}

In  \Cref{figure}, in ref \cite{allik_hughes_1,allik_hughes_2,Fish}, in \Cref{table}  and in equation Eq. \ref{equation}

\begin{align}
M=\frac{a{b}c}{2}. dE, \label{equation}
\end{align}

\begin{figure}[H]
\centering
\includegraphics[height=1.0 in, width=2.0 in]{bimorph.png}
\caption{Static deflection of the bimorph actuator: Accuracy analysis} \label{figure}.
\end{figure}

\begin{table}[H]
%\begin{table}[H]
\caption{Accuracy : Static } \label{table}
\centering
\begin{tabular}{c c c c c c}
\hline
\multirow{3}{*}{none} &\multicolumn{2}{c}{none}\\ \cline{2-3}&a($\mu$m)&relative error[\%]\\ \cline{2-3} \cline{4-5}
&b&b\\
\hline
1000&1000&100& \\
\hline
\end{tabular}
%\end{table}
\end{table}

\section*{References}
\bibliography{mybibfile}

\end{document}


I would like to get color brackets when I cite these reference.

Why doi does not appear in the Reference list. How can I include the URL of the doi?

Also, is it possible to use \Cref{equation}? I tried \Cref{equation}, but it did not work for me. Therefore I am using Eq.\ref{equation}.

• I get doi for your example. Can you include a screenshot of your result? – samcarter_is_at_topanswers.xyz Jan 10 '18 at 10:59
• As said yesterday, the syntax in your bib file is wrong. Multiple authors should be separated by and. There are also trailing punctuation marks in J Acoust Soc Am ; and :3211 -- 3232 which should not be there. – samcarter_is_at_topanswers.xyz Jan 10 '18 at 11:02

Concerning your question about \cref{equation}:

cleverref should be loaded last, in particular it has to be loaded after amsmath.

\documentclass[5p]{elsarticle}

\usepackage{amsmath,amsfonts,amsthm,bm}

\usepackage{hyperref}
\hypersetup{colorlinks = true, allcolors = cyan}

\begin{document}
\hypersetup{allcolors = cyan}

\Cref{nameequation}

\begin{align}
M=\frac{a{b}c}{2}. dE, \label{nameequation}
\end{align}

\end{document}


Colouring the citation bracket

Based on Biblatex square brackets color you could do:

\documentclass[5p]{elsarticle}

\usepackage{filecontents}
\begin{filecontents*}{mybibfile.bib}
@article{allik_hughes_1,
title   = "Finite element method for piezoelectric vibration",
journal = "Int J Numer Meth Engng",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
doi     = "10.1002/nme.1620020202",
author  = "{Allik, H and Hughes, T J R}"
}

@article{allik_hughes_2,
title   = {Vibrational response of sonar transducer using piezoelectric finite elements},
journal = "J Acoust Soc Am",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
doi     = "10.1121/1.1903513",
author  = "{Allik, H and Kenneth, M W and John, T H}"
}

@article{Fish,
title   = "Modeling and simulation of piezocomposites",
journal = "Comput Meth Appl Mech and Engng",
year="1970",
volume="2",
number="1--2",
pages   = "151--157",
pages   = "3211 -- 3232",
doi     = "10.1016/S0045-7825(03)00343-8",
author  = "{Fish, J and Chen, W}"
}
\end{filecontents*}

\usepackage{hyperref}
\hypersetup{colorlinks = true, allcolors = cyan}
\usepackage{color}
\bibliographystyle{elsarticle-num}

\bibpunct{\color{cyan}[}{\color{cyan}]}{,}{n}{}{;}

\begin{document}

\hypersetup{allcolors = cyan}

\cite{allik_hughes_1,allik_hughes_2,Fish},
\bibliography{mybibfile}

\end{document}


• Thank you very much for your kind reply and valuable answers. In the reference list, why volume and issue number appears first. I am looking for bib type as attached to the figure. could you please help me. Thank you again. – Prakash Jan 10 '18 at 11:45
• @Prakash Comments are not the best place to ask new questions – samcarter_is_at_topanswers.xyz Jan 10 '18 at 12:02
• ok. I will ask a new question. Thank you again – Prakash Jan 10 '18 at 12:04