Author(year) style mixed up with shortand usage












1














For my thesis I have to write a literature review. Within the review I must use "shorthand" names for cited works like "S001" and "S002" for the first and the second work that will be cited.



In later chapters the Author(year) style has to be used. Unfortunately the two styles will be mixed-up. I did not find a proper solution, anyone that can help?



Result of the "minimal" code example



    begin{filecontents}{myfilea.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "ElseShort",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}


usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}


% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfilea.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

end{document}


EDIT:



This is what I want to reach:



enter image description here



I add now a new code example:



begin{filecontents}{myfile.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "S003",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}
usepackage{longtable} %needed for longtab
LTchunksize=8 %% Row count for simplify pagebreak for longtabu environment

%% Needed for labelling longtabu!
usepackage{caption}
DeclareCaptionLabelSeparator{tableNewline}{par}
captionsetup{
justification=centering,
labelsep=quad,
}
captionsetup[longtable]{
justification=centering,
labelsep=quad,
}

usepackage{tabu}
usepackage{hhline} % Needed for longtabu when two hlines (==) should be drawn.

usepackage{tabularx}
usepackage{booktabs} %Professionelle Tabellen

usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

usepackage[%
% Standard options
final=true,%
pageanchor=true,%
pagebackref=false,%
hyperindex=true,%
hyperfootnotes=true,%
linktocpage=false,%
breaklinks=false,%
colorlinks=true,%
% PDF options
bookmarks=true,
bookmarksopen=true,%
bookmarksopenlevel=1,%
pdfhighlight=/N,%
allbordercolors={0.85 0.85 1},
citebordercolor={1 1 1},
urlbordercolor={1 1 1},%
% PDF entries
pdftitle={mydoctitle},%
pdfauthor={myname},%
pdfsubject={mysubject},%
pdfcreator={Thomas Salzmann},%
pdfproducer={LaTeX},%
pdfkeywords={mykeywords},%
% PDF misc settings
pdfstartpage=1,% Start PDF Viewer on Page 1
pdfduplex=Simplex,%
pdfpagelabels=true,%
pdfprintscaling=None,%
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=black,%
]{hyperref}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}

newcommand{citeNotAsShorthand}[2][blue]{textcolor{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}

% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfile.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

What I want is this version: citeNotAsShorthand{borges2018}


begin{longtabu} to textwidth {| l | X[1.5,l] %aligned left, twice as wide as second column
| X[1,l] |} %aligned left

% Table header on first page of table
caption{Table of excluded studies during title- and abstract analysis} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
%toprule
endfirsthead

% Table header on every other page of table
caption{Table of excluded studies during title- and abstract analysis (continued)} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
endhead
% End of header

% SCOPUS-search new:
cite{else2015} & citetitle{else2015} (citeyear{else2015}) & Primary focus is not on product management. Focus is on side effects of programs from coding perspective. tabularnewline
cite{borges2018} & citetitle{borges2018} (citeyear{borges2018}) & Grey literature (article in press). tabularnewline
end{longtabu}

printbiblist[title={List of relevant studies found during literature review},notkeyword=LRexcluded]{shorthand}

printbibliography[segment=3,heading=subbibliography]

end{document}









share|improve this question
























  • The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
    – moewe
    Jan 2 at 23:41










  • Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
    – moewe
    Jan 2 at 23:42










  • How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
    – moewe
    Jan 3 at 20:59
















1














For my thesis I have to write a literature review. Within the review I must use "shorthand" names for cited works like "S001" and "S002" for the first and the second work that will be cited.



In later chapters the Author(year) style has to be used. Unfortunately the two styles will be mixed-up. I did not find a proper solution, anyone that can help?



Result of the "minimal" code example



    begin{filecontents}{myfilea.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "ElseShort",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}


usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}


% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfilea.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

end{document}


EDIT:



This is what I want to reach:



enter image description here



I add now a new code example:



begin{filecontents}{myfile.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "S003",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}
usepackage{longtable} %needed for longtab
LTchunksize=8 %% Row count for simplify pagebreak for longtabu environment

%% Needed for labelling longtabu!
usepackage{caption}
DeclareCaptionLabelSeparator{tableNewline}{par}
captionsetup{
justification=centering,
labelsep=quad,
}
captionsetup[longtable]{
justification=centering,
labelsep=quad,
}

usepackage{tabu}
usepackage{hhline} % Needed for longtabu when two hlines (==) should be drawn.

usepackage{tabularx}
usepackage{booktabs} %Professionelle Tabellen

usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

usepackage[%
% Standard options
final=true,%
pageanchor=true,%
pagebackref=false,%
hyperindex=true,%
hyperfootnotes=true,%
linktocpage=false,%
breaklinks=false,%
colorlinks=true,%
% PDF options
bookmarks=true,
bookmarksopen=true,%
bookmarksopenlevel=1,%
pdfhighlight=/N,%
allbordercolors={0.85 0.85 1},
citebordercolor={1 1 1},
urlbordercolor={1 1 1},%
% PDF entries
pdftitle={mydoctitle},%
pdfauthor={myname},%
pdfsubject={mysubject},%
pdfcreator={Thomas Salzmann},%
pdfproducer={LaTeX},%
pdfkeywords={mykeywords},%
% PDF misc settings
pdfstartpage=1,% Start PDF Viewer on Page 1
pdfduplex=Simplex,%
pdfpagelabels=true,%
pdfprintscaling=None,%
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=black,%
]{hyperref}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}

newcommand{citeNotAsShorthand}[2][blue]{textcolor{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}

% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfile.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

What I want is this version: citeNotAsShorthand{borges2018}


begin{longtabu} to textwidth {| l | X[1.5,l] %aligned left, twice as wide as second column
| X[1,l] |} %aligned left

% Table header on first page of table
caption{Table of excluded studies during title- and abstract analysis} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
%toprule
endfirsthead

% Table header on every other page of table
caption{Table of excluded studies during title- and abstract analysis (continued)} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
endhead
% End of header

% SCOPUS-search new:
cite{else2015} & citetitle{else2015} (citeyear{else2015}) & Primary focus is not on product management. Focus is on side effects of programs from coding perspective. tabularnewline
cite{borges2018} & citetitle{borges2018} (citeyear{borges2018}) & Grey literature (article in press). tabularnewline
end{longtabu}

printbiblist[title={List of relevant studies found during literature review},notkeyword=LRexcluded]{shorthand}

printbibliography[segment=3,heading=subbibliography]

end{document}









share|improve this question
























  • The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
    – moewe
    Jan 2 at 23:41










  • Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
    – moewe
    Jan 2 at 23:42










  • How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
    – moewe
    Jan 3 at 20:59














1












1








1







For my thesis I have to write a literature review. Within the review I must use "shorthand" names for cited works like "S001" and "S002" for the first and the second work that will be cited.



In later chapters the Author(year) style has to be used. Unfortunately the two styles will be mixed-up. I did not find a proper solution, anyone that can help?



Result of the "minimal" code example



    begin{filecontents}{myfilea.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "ElseShort",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}


usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}


% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfilea.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

end{document}


EDIT:



This is what I want to reach:



enter image description here



I add now a new code example:



begin{filecontents}{myfile.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "S003",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}
usepackage{longtable} %needed for longtab
LTchunksize=8 %% Row count for simplify pagebreak for longtabu environment

%% Needed for labelling longtabu!
usepackage{caption}
DeclareCaptionLabelSeparator{tableNewline}{par}
captionsetup{
justification=centering,
labelsep=quad,
}
captionsetup[longtable]{
justification=centering,
labelsep=quad,
}

usepackage{tabu}
usepackage{hhline} % Needed for longtabu when two hlines (==) should be drawn.

usepackage{tabularx}
usepackage{booktabs} %Professionelle Tabellen

usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

usepackage[%
% Standard options
final=true,%
pageanchor=true,%
pagebackref=false,%
hyperindex=true,%
hyperfootnotes=true,%
linktocpage=false,%
breaklinks=false,%
colorlinks=true,%
% PDF options
bookmarks=true,
bookmarksopen=true,%
bookmarksopenlevel=1,%
pdfhighlight=/N,%
allbordercolors={0.85 0.85 1},
citebordercolor={1 1 1},
urlbordercolor={1 1 1},%
% PDF entries
pdftitle={mydoctitle},%
pdfauthor={myname},%
pdfsubject={mysubject},%
pdfcreator={Thomas Salzmann},%
pdfproducer={LaTeX},%
pdfkeywords={mykeywords},%
% PDF misc settings
pdfstartpage=1,% Start PDF Viewer on Page 1
pdfduplex=Simplex,%
pdfpagelabels=true,%
pdfprintscaling=None,%
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=black,%
]{hyperref}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}

newcommand{citeNotAsShorthand}[2][blue]{textcolor{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}

% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfile.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

What I want is this version: citeNotAsShorthand{borges2018}


begin{longtabu} to textwidth {| l | X[1.5,l] %aligned left, twice as wide as second column
| X[1,l] |} %aligned left

% Table header on first page of table
caption{Table of excluded studies during title- and abstract analysis} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
%toprule
endfirsthead

% Table header on every other page of table
caption{Table of excluded studies during title- and abstract analysis (continued)} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
endhead
% End of header

% SCOPUS-search new:
cite{else2015} & citetitle{else2015} (citeyear{else2015}) & Primary focus is not on product management. Focus is on side effects of programs from coding perspective. tabularnewline
cite{borges2018} & citetitle{borges2018} (citeyear{borges2018}) & Grey literature (article in press). tabularnewline
end{longtabu}

printbiblist[title={List of relevant studies found during literature review},notkeyword=LRexcluded]{shorthand}

printbibliography[segment=3,heading=subbibliography]

end{document}









share|improve this question















For my thesis I have to write a literature review. Within the review I must use "shorthand" names for cited works like "S001" and "S002" for the first and the second work that will be cited.



In later chapters the Author(year) style has to be used. Unfortunately the two styles will be mixed-up. I did not find a proper solution, anyone that can help?



Result of the "minimal" code example



    begin{filecontents}{myfilea.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "ElseShort",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}


usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}


% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfilea.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

end{document}


EDIT:



This is what I want to reach:



enter image description here



I add now a new code example:



begin{filecontents}{myfile.bib}
@book{goossens93,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The LaTeX Companion",
year = "1993",
% shorthand = "GMS"
}

@book{else2015,
author = "Someone Else",
title = "Interesting thing.",
year = "2015",
shorthand = "S003",
}

@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver: A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
uuid = {52D09357-6BA8-4CB1-91B8-8C4CDD7E351B},
volume = {95},
pages = {346-365},
shorthand = {S002},
year = {2018},
}
end{filecontents}

documentclass{article}

usepackage[automark, draft=false]{scrlayer-scrpage}
setcounter{secnumdepth}{3}
setcounter{tocdepth}{3}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage{mathptmx}
usepackage{courier}
usepackage[protrusion,factor=900]{microtype}
usepackage{setspace}
usepackage{printlen}
usepackage{longtable} %needed for longtab
LTchunksize=8 %% Row count for simplify pagebreak for longtabu environment

%% Needed for labelling longtabu!
usepackage{caption}
DeclareCaptionLabelSeparator{tableNewline}{par}
captionsetup{
justification=centering,
labelsep=quad,
}
captionsetup[longtable]{
justification=centering,
labelsep=quad,
}

usepackage{tabu}
usepackage{hhline} % Needed for longtabu when two hlines (==) should be drawn.

usepackage{tabularx}
usepackage{booktabs} %Professionelle Tabellen

usepackage[backend=biber, %% Hilfsprogramm "biber" (statt "biblatex" oder "bibtex")
style=authoryear, %% Zitierstil: Authorennamen lang [Jahr]
bibencoding=utf8,
natbib=true, %% Bereitstellen von natbib-kompatiblen Zitierkommandos
backref=true, %% Seiten anzeigen, auf denen die Referenz vorkommt
ibidtracker=context, %% EBENDA-Anzeige bei mehrfachen Zitierungen der selben Quelle auf einer Seite
block=space, %% kleiner horizontaler Platz zwischen den Feldern
isbn=false, %% ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern
url=false, %% Url-Feld wird ausgeblendet. Ausnahme: Online-Typ
pagetracker=true, %% ebd. bei wiederholten Angaben (false=ausgeschaltet, page=Seite, spread=Doppelseite, true=automatisch)
citetracker=true, % Wird benötigt für kapitelweise Referenzen?
sorting=nyt, % To get an sorted bibliography
]{biblatex}

usepackage[%
% Standard options
final=true,%
pageanchor=true,%
pagebackref=false,%
hyperindex=true,%
hyperfootnotes=true,%
linktocpage=false,%
breaklinks=false,%
colorlinks=true,%
% PDF options
bookmarks=true,
bookmarksopen=true,%
bookmarksopenlevel=1,%
pdfhighlight=/N,%
allbordercolors={0.85 0.85 1},
citebordercolor={1 1 1},
urlbordercolor={1 1 1},%
% PDF entries
pdftitle={mydoctitle},%
pdfauthor={myname},%
pdfsubject={mysubject},%
pdfcreator={Thomas Salzmann},%
pdfproducer={LaTeX},%
pdfkeywords={mykeywords},%
% PDF misc settings
pdfstartpage=1,% Start PDF Viewer on Page 1
pdfduplex=Simplex,%
pdfpagelabels=true,%
pdfprintscaling=None,%
citecolor=blue,%
filecolor=blue,%
linkcolor=blue,%
urlcolor=black,%
]{hyperref}

% "notoccite" prevents cites in captions from misnumbering of references
usepackage{notoccite}

newcommand{citeNotAsShorthand}[2][blue]{textcolor{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}

% ibidem: Wenn Fußnoten mehrfach auf der selben Seite zur selben Quelle führen, so schreibe "ibidem" (=ebenda).
providecommand*{mkibid}[1]{#1}
DeclareCiteCommand{footpartcite}[mkbibfootnote]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
ifthenelse{ifciteibidANDNOTiffirstonpage}
{printtext[bibhyperref]{bibstring[mkibid]{ibidem}}}
{printtext[brackets]{usebibmacro{cite}}%
setunit{addnbspace}%
printnames{labelname}%
setunit{labelnamepunct}%
printfield[citetitle]{title}%
newunit
printfield{year}}}
{multicitedelim}
{usebibmacro{postnote}}


%usepackage[backend=biber,citestyle=authoryear]{biblatex}
addbibresource{myfile.bib}

begin{document}

In my case I want to use the author (year) citation style: citet{goossens93}.

But something went wrong: When I use shorthand within a bib element, shorthand and the authoryear will be mixed up: citet{else2015}

This is only the "shorthand"-style which I need also within my work: cite{borges2018}.

And this is the the Author (year) combination -- unfortunately it wrotes the shorthand into the year part!: citet{borges2018}.

What I want is this version: citeNotAsShorthand{borges2018}


begin{longtabu} to textwidth {| l | X[1.5,l] %aligned left, twice as wide as second column
| X[1,l] |} %aligned left

% Table header on first page of table
caption{Table of excluded studies during title- and abstract analysis} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
%toprule
endfirsthead

% Table header on every other page of table
caption{Table of excluded studies during title- and abstract analysis (continued)} tabularnewline
hline %toprule
thead{Study}& thead{Title of excluded study (year)} & thead{reason for exclusion} tabularnewline
hhline{===}
endhead
% End of header

% SCOPUS-search new:
cite{else2015} & citetitle{else2015} (citeyear{else2015}) & Primary focus is not on product management. Focus is on side effects of programs from coding perspective. tabularnewline
cite{borges2018} & citetitle{borges2018} (citeyear{borges2018}) & Grey literature (article in press). tabularnewline
end{longtabu}

printbiblist[title={List of relevant studies found during literature review},notkeyword=LRexcluded]{shorthand}

printbibliography[segment=3,heading=subbibliography]

end{document}






biblatex






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 23:07









Kurt

35.8k847161




35.8k847161










asked Jan 2 at 21:33









Thomas S.Thomas S.

313




313












  • The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
    – moewe
    Jan 2 at 23:41










  • Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
    – moewe
    Jan 2 at 23:42










  • How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
    – moewe
    Jan 3 at 20:59


















  • The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
    – moewe
    Jan 2 at 23:41










  • Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
    – moewe
    Jan 2 at 23:42










  • How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
    – moewe
    Jan 3 at 20:59
















The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
– moewe
Jan 2 at 23:41




The "Name (Shorthand)" output from textcite/citet is expected and not totally absurd if you recall that textcite is intended to replace the author name as subject of a sentence. So as shown by textcite{sigfridsson} would produce "as shown by Sigfridsson and Ryde (1998)". This also explains the slightly unusual placement of the pre- and postnore arguments. See also github.com/plk/biblatex/issues/569.
– moewe
Jan 2 at 23:41












Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
– moewe
Jan 2 at 23:42




Can you explain the expected output in more detail? How should biblatex tell whether you want the shorthand or the normal citation? Are the shorthands really shorthands in the usual biblatex sense or are they supposed to be just numeric labels counting up from 1 to n?
– moewe
Jan 2 at 23:42












How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
– moewe
Jan 3 at 20:59




How is the 'study ID' assigned? Do you want to give it manually in the .bib file or is there a rule that could be automated?
– moewe
Jan 3 at 20:59










2 Answers
2






active

oldest

votes


















3














As mentioned in https://github.com/plk/biblatex/issues/569 textcite/citet is more than just cite with parentheses around the year. You will see different behaviour as well if you use pre- and postnotes, compare cite[cf.][380]{sigfridsson} and textcite[cf.][380]{sigfridsson}.



cf. Sigfridsson and Ryde 1998, p. 380//Sigfridsson and Ryde (cf. 1998, p. 381)



The idea is that textcite is used as the subject of the sentence for cases like Textcite{sigfridsson} found that .... To make sure that the grammatical structure is the same for all textcites, it will show Authors (shorthand) if the shorthand field is given.



If you want the usual behaviour of cite just with parentheses around the year, I suggest you try biblatex-ext and its cite delimiter feature (§5.3 Delimiters for citation commands of the biblatex-ext documentation).



DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}


should give you what you want.



Furthermore, I think that study IDs are best dealt with via a dedicated field and not with shorthand. So in the example below I created a new field studyid. If there is an algorithmic way to assign the study ID this could be further automated (this could make for a nice follow-up question), at the moment you have to assign the field value manually in the .bib. studyid is declared a label field so that we can use printbiblist easily.



We define two cite macros citewid and citeonlyid. citewid shows the citation and together with the study ID. citeonlyid shows only the study ID.



Finally we set up everything needed for printbiblist.



documentclass{article}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}

usepackage{filecontents}
begin{filecontents*}{studyid.dbx}
DeclareDatamodelFields[type=field,datatype=literal,label=true]{studyid}
DeclareDatamodelEntryfields{studyid}
end{filecontents*}

usepackage[backend=biber, style=ext-authoryear, datamodel=studyid]{biblatex}

% cite should give author (year)
DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}

% define citewid: author (year) [study-id]
RegisterCiteDelims{outer}{citewid}
RegisterCiteDelims{inner}{citewid}
DeclareInnerCiteDelimsAlias{citewid}{cite}
DeclareFieldAlias{extblx@innercitewiddelims}{extblx@innercitedelims}

DeclareFieldFormat{citestudyid}{mkbibbrackets{S#1}}

newbibmacro*{citewid}{%
usebibmacro{cite}%
setunit{addspace}%
printfield[citestudyid]{studyid}}

DeclareCiteCommand{citewid}[mkoutercitewiddelims]
{usebibmacro{prenote}}
{usebibmacro{citeindex}%
usebibmacro{citewid}}
{multicitedelim}
{usebibmacro{postnote}}

% define citeonlyid: [study-id]
RegisterCiteDelims{outer}{citeonlyid}
DeclareOuterCiteDelims{citeonlyid}{bibopenbracket}{bibclosebracket}
DeclareCiteCommand{citeonlyid}[mkouterciteonlyiddelims]
{usebibmacro{prenote}}
{iffieldundef{studyid}
{PackageWarning{biblatex}{%
No 'studyid' in entry 'thefield{entrykey}'.MessageBreak
Add the 'studyid' fieldMessageBreak
or don't cite this entry withMessageBreak
'stringciteonlyid'}}
{printfield[studyidwidth]{studyid}}}
{multicitedelim}
{usebibmacro{postnote}}

% printbiblist similar to shorthand definitions
DeclareBibliographyDriver{studyid}{%
usedriver
{}
{thefield{entrytype}}%
finentry}

DeclareFieldFormat{studyidwidth}{S#1}
defbibenvironment{studyid}
{list
{printfield[studyidwidth]{studyid}}
{setlength{labelwidth}{studyidwidth}%
setlength{leftmargin}{labelwidth}%
setlength{labelsep}{biblabelsep}%
addtolength{leftmargin}{labelsep}%
setlength{itemsep}{bibitemsep}%
setlength{parsep}{bibparsep}%
renewcommand*{makelabel}[1]{##1hss}}}
{endlist}
{item}

DeclareSortingTemplate{studyid}{
sort{
field{studyid}
}
}

begin{filecontents}{jobname.bib}
@article{borges2018,
author = {Borges, M. and Barros, E. and Maia, P. H.},
title = {Cloud restriction solver:
A refactoring-based approach to migrate applications to the cloud},
journal = {Information and Software Technology},
volume = {95},
pages = {346-365},
year = {2018},
studyid = {002},
}
@article{licht2009,
author = {Licht, Carmilla M. M. and de Geus, Eco J. C.
and van Dyck, Richard and Penninx, Brenda W. J. H.},
title = {Association between anxiety disorders and
heart rate variability in {The} {Netherlands} {Study} of
{Depression} and {Anxiety} ({NESDA})},
journal = {Psychosomatic medicine},
volume = {71},
number = {5},
pages = {508--518},
doi = {10.1097/PSY.0b013e3181a292a6},
date = {2009},
studyid = {001},
}
end{filecontents}

addbibresource{jobname.bib}
addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson}

cite{borges2018}

citewid{borges2018}

citeonlyid{borges2018,licht2009}

printbiblist[title=List of studies]{studyid}

printbibliography
end{document}


The citations read "Sigfridsson and Ryde (1998)", "Borges, Barros, and Maia (2018)", "Borges, Barros, and Maia (2018) [S002]", "[S002; S001]". The MWE also contains a list of studies with numbers in the 'label' position and a normal bibliography.






share|improve this answer































    0














    Thank you for that hint.



    I have added now two commands:



    newcommand{citeNotAsShorthand}[1]{{citeauthor{#1} (citeyear{#1})}}%

    newcommand{citeNotAsShorthanda}[2][blue]{color{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}


    When I use:
    citet{IWSPM2016:Linaker2016} then "Linåker and Wnuk (S030)" will be printed.



    When I use
    citeNotAsShorthand{IWSPM2016:Linaker2016}
    then "Linåker and Wnuk (2016)" will be printed - which is quite good.



    And
    citeNotAsShorthanda{IWSPM2016:Linaker2016}
    prints "Linåker and Wnuk (2016) [S030]".



    Great!






    share|improve this answer





















    • I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
      – moewe
      Jan 3 at 12:38










    • Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
      – Thomas S.
      Jan 3 at 12:47










    • I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
      – moewe
      Jan 3 at 12:50










    • Please see above my second answer...
      – Thomas S.
      Jan 3 at 20:30










    • I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
      – Thomas S.
      Jan 3 at 20:38











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468323%2fauthoryear-style-mixed-up-with-shortand-usage%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    As mentioned in https://github.com/plk/biblatex/issues/569 textcite/citet is more than just cite with parentheses around the year. You will see different behaviour as well if you use pre- and postnotes, compare cite[cf.][380]{sigfridsson} and textcite[cf.][380]{sigfridsson}.



    cf. Sigfridsson and Ryde 1998, p. 380//Sigfridsson and Ryde (cf. 1998, p. 381)



    The idea is that textcite is used as the subject of the sentence for cases like Textcite{sigfridsson} found that .... To make sure that the grammatical structure is the same for all textcites, it will show Authors (shorthand) if the shorthand field is given.



    If you want the usual behaviour of cite just with parentheses around the year, I suggest you try biblatex-ext and its cite delimiter feature (§5.3 Delimiters for citation commands of the biblatex-ext documentation).



    DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}


    should give you what you want.



    Furthermore, I think that study IDs are best dealt with via a dedicated field and not with shorthand. So in the example below I created a new field studyid. If there is an algorithmic way to assign the study ID this could be further automated (this could make for a nice follow-up question), at the moment you have to assign the field value manually in the .bib. studyid is declared a label field so that we can use printbiblist easily.



    We define two cite macros citewid and citeonlyid. citewid shows the citation and together with the study ID. citeonlyid shows only the study ID.



    Finally we set up everything needed for printbiblist.



    documentclass{article}
    usepackage[utf8]{inputenc}
    usepackage[T1]{fontenc}
    usepackage{lmodern}

    usepackage{filecontents}
    begin{filecontents*}{studyid.dbx}
    DeclareDatamodelFields[type=field,datatype=literal,label=true]{studyid}
    DeclareDatamodelEntryfields{studyid}
    end{filecontents*}

    usepackage[backend=biber, style=ext-authoryear, datamodel=studyid]{biblatex}

    % cite should give author (year)
    DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}

    % define citewid: author (year) [study-id]
    RegisterCiteDelims{outer}{citewid}
    RegisterCiteDelims{inner}{citewid}
    DeclareInnerCiteDelimsAlias{citewid}{cite}
    DeclareFieldAlias{extblx@innercitewiddelims}{extblx@innercitedelims}

    DeclareFieldFormat{citestudyid}{mkbibbrackets{S#1}}

    newbibmacro*{citewid}{%
    usebibmacro{cite}%
    setunit{addspace}%
    printfield[citestudyid]{studyid}}

    DeclareCiteCommand{citewid}[mkoutercitewiddelims]
    {usebibmacro{prenote}}
    {usebibmacro{citeindex}%
    usebibmacro{citewid}}
    {multicitedelim}
    {usebibmacro{postnote}}

    % define citeonlyid: [study-id]
    RegisterCiteDelims{outer}{citeonlyid}
    DeclareOuterCiteDelims{citeonlyid}{bibopenbracket}{bibclosebracket}
    DeclareCiteCommand{citeonlyid}[mkouterciteonlyiddelims]
    {usebibmacro{prenote}}
    {iffieldundef{studyid}
    {PackageWarning{biblatex}{%
    No 'studyid' in entry 'thefield{entrykey}'.MessageBreak
    Add the 'studyid' fieldMessageBreak
    or don't cite this entry withMessageBreak
    'stringciteonlyid'}}
    {printfield[studyidwidth]{studyid}}}
    {multicitedelim}
    {usebibmacro{postnote}}

    % printbiblist similar to shorthand definitions
    DeclareBibliographyDriver{studyid}{%
    usedriver
    {}
    {thefield{entrytype}}%
    finentry}

    DeclareFieldFormat{studyidwidth}{S#1}
    defbibenvironment{studyid}
    {list
    {printfield[studyidwidth]{studyid}}
    {setlength{labelwidth}{studyidwidth}%
    setlength{leftmargin}{labelwidth}%
    setlength{labelsep}{biblabelsep}%
    addtolength{leftmargin}{labelsep}%
    setlength{itemsep}{bibitemsep}%
    setlength{parsep}{bibparsep}%
    renewcommand*{makelabel}[1]{##1hss}}}
    {endlist}
    {item}

    DeclareSortingTemplate{studyid}{
    sort{
    field{studyid}
    }
    }

    begin{filecontents}{jobname.bib}
    @article{borges2018,
    author = {Borges, M. and Barros, E. and Maia, P. H.},
    title = {Cloud restriction solver:
    A refactoring-based approach to migrate applications to the cloud},
    journal = {Information and Software Technology},
    volume = {95},
    pages = {346-365},
    year = {2018},
    studyid = {002},
    }
    @article{licht2009,
    author = {Licht, Carmilla M. M. and de Geus, Eco J. C.
    and van Dyck, Richard and Penninx, Brenda W. J. H.},
    title = {Association between anxiety disorders and
    heart rate variability in {The} {Netherlands} {Study} of
    {Depression} and {Anxiety} ({NESDA})},
    journal = {Psychosomatic medicine},
    volume = {71},
    number = {5},
    pages = {508--518},
    doi = {10.1097/PSY.0b013e3181a292a6},
    date = {2009},
    studyid = {001},
    }
    end{filecontents}

    addbibresource{jobname.bib}
    addbibresource{biblatex-examples.bib}

    begin{document}
    cite{sigfridsson}

    cite{borges2018}

    citewid{borges2018}

    citeonlyid{borges2018,licht2009}

    printbiblist[title=List of studies]{studyid}

    printbibliography
    end{document}


    The citations read "Sigfridsson and Ryde (1998)", "Borges, Barros, and Maia (2018)", "Borges, Barros, and Maia (2018) [S002]", "[S002; S001]". The MWE also contains a list of studies with numbers in the 'label' position and a normal bibliography.






    share|improve this answer




























      3














      As mentioned in https://github.com/plk/biblatex/issues/569 textcite/citet is more than just cite with parentheses around the year. You will see different behaviour as well if you use pre- and postnotes, compare cite[cf.][380]{sigfridsson} and textcite[cf.][380]{sigfridsson}.



      cf. Sigfridsson and Ryde 1998, p. 380//Sigfridsson and Ryde (cf. 1998, p. 381)



      The idea is that textcite is used as the subject of the sentence for cases like Textcite{sigfridsson} found that .... To make sure that the grammatical structure is the same for all textcites, it will show Authors (shorthand) if the shorthand field is given.



      If you want the usual behaviour of cite just with parentheses around the year, I suggest you try biblatex-ext and its cite delimiter feature (§5.3 Delimiters for citation commands of the biblatex-ext documentation).



      DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}


      should give you what you want.



      Furthermore, I think that study IDs are best dealt with via a dedicated field and not with shorthand. So in the example below I created a new field studyid. If there is an algorithmic way to assign the study ID this could be further automated (this could make for a nice follow-up question), at the moment you have to assign the field value manually in the .bib. studyid is declared a label field so that we can use printbiblist easily.



      We define two cite macros citewid and citeonlyid. citewid shows the citation and together with the study ID. citeonlyid shows only the study ID.



      Finally we set up everything needed for printbiblist.



      documentclass{article}
      usepackage[utf8]{inputenc}
      usepackage[T1]{fontenc}
      usepackage{lmodern}

      usepackage{filecontents}
      begin{filecontents*}{studyid.dbx}
      DeclareDatamodelFields[type=field,datatype=literal,label=true]{studyid}
      DeclareDatamodelEntryfields{studyid}
      end{filecontents*}

      usepackage[backend=biber, style=ext-authoryear, datamodel=studyid]{biblatex}

      % cite should give author (year)
      DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}

      % define citewid: author (year) [study-id]
      RegisterCiteDelims{outer}{citewid}
      RegisterCiteDelims{inner}{citewid}
      DeclareInnerCiteDelimsAlias{citewid}{cite}
      DeclareFieldAlias{extblx@innercitewiddelims}{extblx@innercitedelims}

      DeclareFieldFormat{citestudyid}{mkbibbrackets{S#1}}

      newbibmacro*{citewid}{%
      usebibmacro{cite}%
      setunit{addspace}%
      printfield[citestudyid]{studyid}}

      DeclareCiteCommand{citewid}[mkoutercitewiddelims]
      {usebibmacro{prenote}}
      {usebibmacro{citeindex}%
      usebibmacro{citewid}}
      {multicitedelim}
      {usebibmacro{postnote}}

      % define citeonlyid: [study-id]
      RegisterCiteDelims{outer}{citeonlyid}
      DeclareOuterCiteDelims{citeonlyid}{bibopenbracket}{bibclosebracket}
      DeclareCiteCommand{citeonlyid}[mkouterciteonlyiddelims]
      {usebibmacro{prenote}}
      {iffieldundef{studyid}
      {PackageWarning{biblatex}{%
      No 'studyid' in entry 'thefield{entrykey}'.MessageBreak
      Add the 'studyid' fieldMessageBreak
      or don't cite this entry withMessageBreak
      'stringciteonlyid'}}
      {printfield[studyidwidth]{studyid}}}
      {multicitedelim}
      {usebibmacro{postnote}}

      % printbiblist similar to shorthand definitions
      DeclareBibliographyDriver{studyid}{%
      usedriver
      {}
      {thefield{entrytype}}%
      finentry}

      DeclareFieldFormat{studyidwidth}{S#1}
      defbibenvironment{studyid}
      {list
      {printfield[studyidwidth]{studyid}}
      {setlength{labelwidth}{studyidwidth}%
      setlength{leftmargin}{labelwidth}%
      setlength{labelsep}{biblabelsep}%
      addtolength{leftmargin}{labelsep}%
      setlength{itemsep}{bibitemsep}%
      setlength{parsep}{bibparsep}%
      renewcommand*{makelabel}[1]{##1hss}}}
      {endlist}
      {item}

      DeclareSortingTemplate{studyid}{
      sort{
      field{studyid}
      }
      }

      begin{filecontents}{jobname.bib}
      @article{borges2018,
      author = {Borges, M. and Barros, E. and Maia, P. H.},
      title = {Cloud restriction solver:
      A refactoring-based approach to migrate applications to the cloud},
      journal = {Information and Software Technology},
      volume = {95},
      pages = {346-365},
      year = {2018},
      studyid = {002},
      }
      @article{licht2009,
      author = {Licht, Carmilla M. M. and de Geus, Eco J. C.
      and van Dyck, Richard and Penninx, Brenda W. J. H.},
      title = {Association between anxiety disorders and
      heart rate variability in {The} {Netherlands} {Study} of
      {Depression} and {Anxiety} ({NESDA})},
      journal = {Psychosomatic medicine},
      volume = {71},
      number = {5},
      pages = {508--518},
      doi = {10.1097/PSY.0b013e3181a292a6},
      date = {2009},
      studyid = {001},
      }
      end{filecontents}

      addbibresource{jobname.bib}
      addbibresource{biblatex-examples.bib}

      begin{document}
      cite{sigfridsson}

      cite{borges2018}

      citewid{borges2018}

      citeonlyid{borges2018,licht2009}

      printbiblist[title=List of studies]{studyid}

      printbibliography
      end{document}


      The citations read "Sigfridsson and Ryde (1998)", "Borges, Barros, and Maia (2018)", "Borges, Barros, and Maia (2018) [S002]", "[S002; S001]". The MWE also contains a list of studies with numbers in the 'label' position and a normal bibliography.






      share|improve this answer


























        3












        3








        3






        As mentioned in https://github.com/plk/biblatex/issues/569 textcite/citet is more than just cite with parentheses around the year. You will see different behaviour as well if you use pre- and postnotes, compare cite[cf.][380]{sigfridsson} and textcite[cf.][380]{sigfridsson}.



        cf. Sigfridsson and Ryde 1998, p. 380//Sigfridsson and Ryde (cf. 1998, p. 381)



        The idea is that textcite is used as the subject of the sentence for cases like Textcite{sigfridsson} found that .... To make sure that the grammatical structure is the same for all textcites, it will show Authors (shorthand) if the shorthand field is given.



        If you want the usual behaviour of cite just with parentheses around the year, I suggest you try biblatex-ext and its cite delimiter feature (§5.3 Delimiters for citation commands of the biblatex-ext documentation).



        DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}


        should give you what you want.



        Furthermore, I think that study IDs are best dealt with via a dedicated field and not with shorthand. So in the example below I created a new field studyid. If there is an algorithmic way to assign the study ID this could be further automated (this could make for a nice follow-up question), at the moment you have to assign the field value manually in the .bib. studyid is declared a label field so that we can use printbiblist easily.



        We define two cite macros citewid and citeonlyid. citewid shows the citation and together with the study ID. citeonlyid shows only the study ID.



        Finally we set up everything needed for printbiblist.



        documentclass{article}
        usepackage[utf8]{inputenc}
        usepackage[T1]{fontenc}
        usepackage{lmodern}

        usepackage{filecontents}
        begin{filecontents*}{studyid.dbx}
        DeclareDatamodelFields[type=field,datatype=literal,label=true]{studyid}
        DeclareDatamodelEntryfields{studyid}
        end{filecontents*}

        usepackage[backend=biber, style=ext-authoryear, datamodel=studyid]{biblatex}

        % cite should give author (year)
        DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}

        % define citewid: author (year) [study-id]
        RegisterCiteDelims{outer}{citewid}
        RegisterCiteDelims{inner}{citewid}
        DeclareInnerCiteDelimsAlias{citewid}{cite}
        DeclareFieldAlias{extblx@innercitewiddelims}{extblx@innercitedelims}

        DeclareFieldFormat{citestudyid}{mkbibbrackets{S#1}}

        newbibmacro*{citewid}{%
        usebibmacro{cite}%
        setunit{addspace}%
        printfield[citestudyid]{studyid}}

        DeclareCiteCommand{citewid}[mkoutercitewiddelims]
        {usebibmacro{prenote}}
        {usebibmacro{citeindex}%
        usebibmacro{citewid}}
        {multicitedelim}
        {usebibmacro{postnote}}

        % define citeonlyid: [study-id]
        RegisterCiteDelims{outer}{citeonlyid}
        DeclareOuterCiteDelims{citeonlyid}{bibopenbracket}{bibclosebracket}
        DeclareCiteCommand{citeonlyid}[mkouterciteonlyiddelims]
        {usebibmacro{prenote}}
        {iffieldundef{studyid}
        {PackageWarning{biblatex}{%
        No 'studyid' in entry 'thefield{entrykey}'.MessageBreak
        Add the 'studyid' fieldMessageBreak
        or don't cite this entry withMessageBreak
        'stringciteonlyid'}}
        {printfield[studyidwidth]{studyid}}}
        {multicitedelim}
        {usebibmacro{postnote}}

        % printbiblist similar to shorthand definitions
        DeclareBibliographyDriver{studyid}{%
        usedriver
        {}
        {thefield{entrytype}}%
        finentry}

        DeclareFieldFormat{studyidwidth}{S#1}
        defbibenvironment{studyid}
        {list
        {printfield[studyidwidth]{studyid}}
        {setlength{labelwidth}{studyidwidth}%
        setlength{leftmargin}{labelwidth}%
        setlength{labelsep}{biblabelsep}%
        addtolength{leftmargin}{labelsep}%
        setlength{itemsep}{bibitemsep}%
        setlength{parsep}{bibparsep}%
        renewcommand*{makelabel}[1]{##1hss}}}
        {endlist}
        {item}

        DeclareSortingTemplate{studyid}{
        sort{
        field{studyid}
        }
        }

        begin{filecontents}{jobname.bib}
        @article{borges2018,
        author = {Borges, M. and Barros, E. and Maia, P. H.},
        title = {Cloud restriction solver:
        A refactoring-based approach to migrate applications to the cloud},
        journal = {Information and Software Technology},
        volume = {95},
        pages = {346-365},
        year = {2018},
        studyid = {002},
        }
        @article{licht2009,
        author = {Licht, Carmilla M. M. and de Geus, Eco J. C.
        and van Dyck, Richard and Penninx, Brenda W. J. H.},
        title = {Association between anxiety disorders and
        heart rate variability in {The} {Netherlands} {Study} of
        {Depression} and {Anxiety} ({NESDA})},
        journal = {Psychosomatic medicine},
        volume = {71},
        number = {5},
        pages = {508--518},
        doi = {10.1097/PSY.0b013e3181a292a6},
        date = {2009},
        studyid = {001},
        }
        end{filecontents}

        addbibresource{jobname.bib}
        addbibresource{biblatex-examples.bib}

        begin{document}
        cite{sigfridsson}

        cite{borges2018}

        citewid{borges2018}

        citeonlyid{borges2018,licht2009}

        printbiblist[title=List of studies]{studyid}

        printbibliography
        end{document}


        The citations read "Sigfridsson and Ryde (1998)", "Borges, Barros, and Maia (2018)", "Borges, Barros, and Maia (2018) [S002]", "[S002; S001]". The MWE also contains a list of studies with numbers in the 'label' position and a normal bibliography.






        share|improve this answer














        As mentioned in https://github.com/plk/biblatex/issues/569 textcite/citet is more than just cite with parentheses around the year. You will see different behaviour as well if you use pre- and postnotes, compare cite[cf.][380]{sigfridsson} and textcite[cf.][380]{sigfridsson}.



        cf. Sigfridsson and Ryde 1998, p. 380//Sigfridsson and Ryde (cf. 1998, p. 381)



        The idea is that textcite is used as the subject of the sentence for cases like Textcite{sigfridsson} found that .... To make sure that the grammatical structure is the same for all textcites, it will show Authors (shorthand) if the shorthand field is given.



        If you want the usual behaviour of cite just with parentheses around the year, I suggest you try biblatex-ext and its cite delimiter feature (§5.3 Delimiters for citation commands of the biblatex-ext documentation).



        DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}


        should give you what you want.



        Furthermore, I think that study IDs are best dealt with via a dedicated field and not with shorthand. So in the example below I created a new field studyid. If there is an algorithmic way to assign the study ID this could be further automated (this could make for a nice follow-up question), at the moment you have to assign the field value manually in the .bib. studyid is declared a label field so that we can use printbiblist easily.



        We define two cite macros citewid and citeonlyid. citewid shows the citation and together with the study ID. citeonlyid shows only the study ID.



        Finally we set up everything needed for printbiblist.



        documentclass{article}
        usepackage[utf8]{inputenc}
        usepackage[T1]{fontenc}
        usepackage{lmodern}

        usepackage{filecontents}
        begin{filecontents*}{studyid.dbx}
        DeclareDatamodelFields[type=field,datatype=literal,label=true]{studyid}
        DeclareDatamodelEntryfields{studyid}
        end{filecontents*}

        usepackage[backend=biber, style=ext-authoryear, datamodel=studyid]{biblatex}

        % cite should give author (year)
        DeclareInnerCiteDelims{cite}{bibopenparen}{bibcloseparen}

        % define citewid: author (year) [study-id]
        RegisterCiteDelims{outer}{citewid}
        RegisterCiteDelims{inner}{citewid}
        DeclareInnerCiteDelimsAlias{citewid}{cite}
        DeclareFieldAlias{extblx@innercitewiddelims}{extblx@innercitedelims}

        DeclareFieldFormat{citestudyid}{mkbibbrackets{S#1}}

        newbibmacro*{citewid}{%
        usebibmacro{cite}%
        setunit{addspace}%
        printfield[citestudyid]{studyid}}

        DeclareCiteCommand{citewid}[mkoutercitewiddelims]
        {usebibmacro{prenote}}
        {usebibmacro{citeindex}%
        usebibmacro{citewid}}
        {multicitedelim}
        {usebibmacro{postnote}}

        % define citeonlyid: [study-id]
        RegisterCiteDelims{outer}{citeonlyid}
        DeclareOuterCiteDelims{citeonlyid}{bibopenbracket}{bibclosebracket}
        DeclareCiteCommand{citeonlyid}[mkouterciteonlyiddelims]
        {usebibmacro{prenote}}
        {iffieldundef{studyid}
        {PackageWarning{biblatex}{%
        No 'studyid' in entry 'thefield{entrykey}'.MessageBreak
        Add the 'studyid' fieldMessageBreak
        or don't cite this entry withMessageBreak
        'stringciteonlyid'}}
        {printfield[studyidwidth]{studyid}}}
        {multicitedelim}
        {usebibmacro{postnote}}

        % printbiblist similar to shorthand definitions
        DeclareBibliographyDriver{studyid}{%
        usedriver
        {}
        {thefield{entrytype}}%
        finentry}

        DeclareFieldFormat{studyidwidth}{S#1}
        defbibenvironment{studyid}
        {list
        {printfield[studyidwidth]{studyid}}
        {setlength{labelwidth}{studyidwidth}%
        setlength{leftmargin}{labelwidth}%
        setlength{labelsep}{biblabelsep}%
        addtolength{leftmargin}{labelsep}%
        setlength{itemsep}{bibitemsep}%
        setlength{parsep}{bibparsep}%
        renewcommand*{makelabel}[1]{##1hss}}}
        {endlist}
        {item}

        DeclareSortingTemplate{studyid}{
        sort{
        field{studyid}
        }
        }

        begin{filecontents}{jobname.bib}
        @article{borges2018,
        author = {Borges, M. and Barros, E. and Maia, P. H.},
        title = {Cloud restriction solver:
        A refactoring-based approach to migrate applications to the cloud},
        journal = {Information and Software Technology},
        volume = {95},
        pages = {346-365},
        year = {2018},
        studyid = {002},
        }
        @article{licht2009,
        author = {Licht, Carmilla M. M. and de Geus, Eco J. C.
        and van Dyck, Richard and Penninx, Brenda W. J. H.},
        title = {Association between anxiety disorders and
        heart rate variability in {The} {Netherlands} {Study} of
        {Depression} and {Anxiety} ({NESDA})},
        journal = {Psychosomatic medicine},
        volume = {71},
        number = {5},
        pages = {508--518},
        doi = {10.1097/PSY.0b013e3181a292a6},
        date = {2009},
        studyid = {001},
        }
        end{filecontents}

        addbibresource{jobname.bib}
        addbibresource{biblatex-examples.bib}

        begin{document}
        cite{sigfridsson}

        cite{borges2018}

        citewid{borges2018}

        citeonlyid{borges2018,licht2009}

        printbiblist[title=List of studies]{studyid}

        printbibliography
        end{document}


        The citations read "Sigfridsson and Ryde (1998)", "Borges, Barros, and Maia (2018)", "Borges, Barros, and Maia (2018) [S002]", "[S002; S001]". The MWE also contains a list of studies with numbers in the 'label' position and a normal bibliography.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 4 at 15:58

























        answered Jan 4 at 15:53









        moewemoewe

        87.5k9110335




        87.5k9110335























            0














            Thank you for that hint.



            I have added now two commands:



            newcommand{citeNotAsShorthand}[1]{{citeauthor{#1} (citeyear{#1})}}%

            newcommand{citeNotAsShorthanda}[2][blue]{color{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}


            When I use:
            citet{IWSPM2016:Linaker2016} then "Linåker and Wnuk (S030)" will be printed.



            When I use
            citeNotAsShorthand{IWSPM2016:Linaker2016}
            then "Linåker and Wnuk (2016)" will be printed - which is quite good.



            And
            citeNotAsShorthanda{IWSPM2016:Linaker2016}
            prints "Linåker and Wnuk (2016) [S030]".



            Great!






            share|improve this answer





















            • I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
              – moewe
              Jan 3 at 12:38










            • Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
              – Thomas S.
              Jan 3 at 12:47










            • I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
              – moewe
              Jan 3 at 12:50










            • Please see above my second answer...
              – Thomas S.
              Jan 3 at 20:30










            • I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
              – Thomas S.
              Jan 3 at 20:38
















            0














            Thank you for that hint.



            I have added now two commands:



            newcommand{citeNotAsShorthand}[1]{{citeauthor{#1} (citeyear{#1})}}%

            newcommand{citeNotAsShorthanda}[2][blue]{color{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}


            When I use:
            citet{IWSPM2016:Linaker2016} then "Linåker and Wnuk (S030)" will be printed.



            When I use
            citeNotAsShorthand{IWSPM2016:Linaker2016}
            then "Linåker and Wnuk (2016)" will be printed - which is quite good.



            And
            citeNotAsShorthanda{IWSPM2016:Linaker2016}
            prints "Linåker and Wnuk (2016) [S030]".



            Great!






            share|improve this answer





















            • I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
              – moewe
              Jan 3 at 12:38










            • Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
              – Thomas S.
              Jan 3 at 12:47










            • I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
              – moewe
              Jan 3 at 12:50










            • Please see above my second answer...
              – Thomas S.
              Jan 3 at 20:30










            • I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
              – Thomas S.
              Jan 3 at 20:38














            0












            0








            0






            Thank you for that hint.



            I have added now two commands:



            newcommand{citeNotAsShorthand}[1]{{citeauthor{#1} (citeyear{#1})}}%

            newcommand{citeNotAsShorthanda}[2][blue]{color{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}


            When I use:
            citet{IWSPM2016:Linaker2016} then "Linåker and Wnuk (S030)" will be printed.



            When I use
            citeNotAsShorthand{IWSPM2016:Linaker2016}
            then "Linåker and Wnuk (2016)" will be printed - which is quite good.



            And
            citeNotAsShorthanda{IWSPM2016:Linaker2016}
            prints "Linåker and Wnuk (2016) [S030]".



            Great!






            share|improve this answer












            Thank you for that hint.



            I have added now two commands:



            newcommand{citeNotAsShorthand}[1]{{citeauthor{#1} (citeyear{#1})}}%

            newcommand{citeNotAsShorthanda}[2][blue]{color{#1}{citeauthor{#2} (citeyear{#2}) [citefield{#2}{shorthand}]}}


            When I use:
            citet{IWSPM2016:Linaker2016} then "Linåker and Wnuk (S030)" will be printed.



            When I use
            citeNotAsShorthand{IWSPM2016:Linaker2016}
            then "Linåker and Wnuk (2016)" will be printed - which is quite good.



            And
            citeNotAsShorthanda{IWSPM2016:Linaker2016}
            prints "Linåker and Wnuk (2016) [S030]".



            Great!







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jan 3 at 12:35









            Thomas S.Thomas S.

            313




            313












            • I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
              – moewe
              Jan 3 at 12:38










            • Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
              – Thomas S.
              Jan 3 at 12:47










            • I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
              – moewe
              Jan 3 at 12:50










            • Please see above my second answer...
              – Thomas S.
              Jan 3 at 20:30










            • I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
              – Thomas S.
              Jan 3 at 20:38


















            • I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
              – moewe
              Jan 3 at 12:38










            • Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
              – Thomas S.
              Jan 3 at 12:47










            • I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
              – moewe
              Jan 3 at 12:50










            • Please see above my second answer...
              – Thomas S.
              Jan 3 at 20:30










            • I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
              – Thomas S.
              Jan 3 at 20:38
















            I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
            – moewe
            Jan 3 at 12:38




            I strongly recommend not building up cite... macros from other cite... macros. citeNotAsShorthand and citeNotAsShorthanda will have difficulties dealing with multiple citations (citeNotAsShorthanda{sigfridsson,worman}), they also need more care when you want pre- and postnotes (as in cite[cf.][380]{sigfridsson}). Furthermore they may confuse citation tracking and the "ibid." and other context-sensitive features.
            – moewe
            Jan 3 at 12:38












            Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
            – Thomas S.
            Jan 3 at 12:47




            Do you have any other idea for that. I see now that when I add it with my version, no entry in the list of references will be made. When I do it with the "standard" cite commands it works - but the format is not the expected one for my case.
            – Thomas S.
            Jan 3 at 12:47












            I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
            – moewe
            Jan 3 at 12:50




            I can write something up later today or tomorrow if no one else has taken it until then. I'm still not exactly sure what your requirements are and especially about the shorthand. So if you can add a few more explanations or examples of what you want to see to your question that would be appreciated.
            – moewe
            Jan 3 at 12:50












            Please see above my second answer...
            – Thomas S.
            Jan 3 at 20:30




            Please see above my second answer...
            – Thomas S.
            Jan 3 at 20:30












            I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
            – Thomas S.
            Jan 3 at 20:38




            I have now completed the code example. I need the "Studie's numbers" within the common text of my work. At the end there is a list of all included studies, ordered by Study-ID. After that is the common list of references including all cited work.
            – Thomas S.
            Jan 3 at 20:38


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468323%2fauthoryear-style-mixed-up-with-shortand-usage%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents