# Enabling dashed option in phys style

I'm new here, sorry for eventual formatting errors :)

I'm currently using this biblatex setting.

 \documentclass{article}
\usepackage[backend=bibtex,
citestyle=alphabetic,
bibstyle=phys,
natbib=true]{biblatex}

\bibliography{references.bib}

\usepackage{filecontents}

\begin{filecontents}{\references.bib}
@article{np30,
title={{China Sea Pilot, Vol. 1}},
author={{United Kingdom Hydrographic Office [UKHO]}},
journal={\textit{Admiralty Sailing Directions 30} 8th ed. (2010)},
}

@article{np31,
title={{China Sea Pilot, Vol. 2}},
author={{United Kingdom Hydrographic Office [UKHO]}},
journal={\textit{Admiralty Sailing Directions 31} 9th ed. (2010)},
}
\end{filecontents}

\begin{document}

\printbibliography
\nocite{*}

\end{document}


However, this style does not support the dashed option. Any idea how to solve the problem?

One could add the same code as in the ieee style:

\makeatletter
% Support for dashed author name replacement
\InitializeBibliographyStyle{\global\undef\bbx@lasthash}

\newbibmacro*{bbx:savehash}{\savefield{fullhash}{\bbx@lasthash}}

% Bibliography macros
\renewbibmacro*{author}{%
\ifboolexpr{
test \ifuseauthor
and
not test {\ifnameundef{author}}
}
{%
\iffieldequals{fullhash}{\bbx@lasthash}
{\printnames{author}}%
\usebibmacro{bbx:savehash}%
\iffieldundef{authortype}
{}
{%
\usebibmacro{authorstrg}%
}%
}
{\global\undef\bbx@lasthash}%
}
\makeatother


which will enable dashes.

• This isn't in the phys style as it's not used by the APS or AIP, and as they are numerical-based styles so removing author names doesn't really make sense. – Joseph Wright Nov 5 '16 at 19:10
• I know it does not make sense, but it's what I'm asked for! Anyway the code seems not working to me, several errors occurr, and I managed to solve only some of them – Jerack Nov 8 '16 at 13:06
• @Jerack The code I've posted works for me edited into your example after the \usepackage line, with only a typo to fix in your code (\references should be references). If you are seeing other issues, please edit the question to show them. – Joseph Wright Nov 8 '16 at 13:46
• I managed to solve the problem! The string conflicted with another personalised command, but I managed to edit! Thank you! :D – Jerack Nov 12 '16 at 19:46