I'm using BibLaTeX with biber and the authortitle style and I want to omit the "p." when citing an entry in my .bib-file BUT ONLY for entries with a non-empty shorthand field. I managed to do so by changing the postnote bibmacro in the following way:
\renewbibmacro*{postnote}{%
\iffieldundef{postnote}
{}
{\setunit{\postnotedelim}%
\iffieldundef{shorthand}
{\printfield{postnote}}
{\DeclareFieldFormat{postnote}{##1}%
\printfield{postnote}}}}
This seems to work. But if I do it like this: \DeclareFieldFormat{postnote}{#1} I get an error message. Why is that the case? What is the difference between {#1} and {##1}?
Here is the MWE:
\documentclass{article}
\usepackage[style=authortitle,backend=biber, firstfull=true]{biblatex}
\renewbibmacro*{postnote}{%
\iffieldundef{postnote}
{}
{\setunit{\postnotedelim}%
\iffieldundef{shorthand}
{\printfield{postnote}}
{\DeclareFieldFormat{postnote}{##1}%
\printfield{postnote}}}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{A1,
Title = {Title1},
Author = {AuthorA},
Year = {1900},
Shorthand = {GuI}
}
@Book{B2,
Title = {Title2},
Author = {AuthorB},
Year = {1900}
}
@Book{C2,
Title = {Title2},
Author = {AuthorC},
Year = {1900}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
"Some citation of a shorthand title"\parencite[][34]{A1}
"Some citation of the same shorthand title in a footnote"\footcite[][34]{A1}
"Some citation of the same title from another page"\footcite[][70]{A1}
"Some citation of a non-shorthand title"\footcite[][12]{B2}
"Some citation of the same non-shorthand title from another page"\footcite[][15]{B2}
"Some citation of the same non-shorthand title from another author"\footcite[][15]{C2}
\printshorthands
\printbibliography
\end{document}
\DeclareFieldFormat{postnote}{#1}, but since this code is inside a macro definition (\renewbibmacro) you have to double the#. See http://tex.stackexchange.com/questions/42463/what-is-the-meaning-of-double-pound-symbol-1-in-an-argument – egreg Mar 15 '15 at 21:12##. ;-) – egreg Mar 15 '15 at 22:11