Custom cite command
I'm trying to create a custom cite
command that takes in three arguments: the book/article name and the initial and final pages of the part that I'm citing. This is the code so far:
renewcommand{cite}[3]{
(vedi~ifthenelse{equal{#2}{#3}}
{parencite[pno~#2]{#1}}
{parencite[ppno~#2~hspace{-0.035cm}--hspace{-0.035cm}~#3]{#1}}hspace{0.035cm})\}
So if the input is
cite{book_1}{64}{64}
the output is
I'd like to modify is so that that output corresponds to the input
cite{book_1, 64}
if the initial and final cited pages are the same, and
cite{book_1, 64-65}
if they're different. Is there a way to do this?
biblatex bibliographies citing
add a comment |
I'm trying to create a custom cite
command that takes in three arguments: the book/article name and the initial and final pages of the part that I'm citing. This is the code so far:
renewcommand{cite}[3]{
(vedi~ifthenelse{equal{#2}{#3}}
{parencite[pno~#2]{#1}}
{parencite[ppno~#2~hspace{-0.035cm}--hspace{-0.035cm}~#3]{#1}}hspace{0.035cm})\}
So if the input is
cite{book_1}{64}{64}
the output is
I'd like to modify is so that that output corresponds to the input
cite{book_1, 64}
if the initial and final cited pages are the same, and
cite{book_1, 64-65}
if they're different. Is there a way to do this?
biblatex bibliographies citing
Why do you want to do this, rather than just use the optional arguments to thecite
command? e.g.cite[p.64]{book1}
– Seamus
Feb 8 at 16:34
add a comment |
I'm trying to create a custom cite
command that takes in three arguments: the book/article name and the initial and final pages of the part that I'm citing. This is the code so far:
renewcommand{cite}[3]{
(vedi~ifthenelse{equal{#2}{#3}}
{parencite[pno~#2]{#1}}
{parencite[ppno~#2~hspace{-0.035cm}--hspace{-0.035cm}~#3]{#1}}hspace{0.035cm})\}
So if the input is
cite{book_1}{64}{64}
the output is
I'd like to modify is so that that output corresponds to the input
cite{book_1, 64}
if the initial and final cited pages are the same, and
cite{book_1, 64-65}
if they're different. Is there a way to do this?
biblatex bibliographies citing
I'm trying to create a custom cite
command that takes in three arguments: the book/article name and the initial and final pages of the part that I'm citing. This is the code so far:
renewcommand{cite}[3]{
(vedi~ifthenelse{equal{#2}{#3}}
{parencite[pno~#2]{#1}}
{parencite[ppno~#2~hspace{-0.035cm}--hspace{-0.035cm}~#3]{#1}}hspace{0.035cm})\}
So if the input is
cite{book_1}{64}{64}
the output is
I'd like to modify is so that that output corresponds to the input
cite{book_1, 64}
if the initial and final cited pages are the same, and
cite{book_1, 64-65}
if they're different. Is there a way to do this?
biblatex bibliographies citing
biblatex bibliographies citing
asked Feb 8 at 15:59
noibenoibe
32010
32010
Why do you want to do this, rather than just use the optional arguments to thecite
command? e.g.cite[p.64]{book1}
– Seamus
Feb 8 at 16:34
add a comment |
Why do you want to do this, rather than just use the optional arguments to thecite
command? e.g.cite[p.64]{book1}
– Seamus
Feb 8 at 16:34
Why do you want to do this, rather than just use the optional arguments to the
cite
command? e.g. cite[p.64]{book1}
– Seamus
Feb 8 at 16:34
Why do you want to do this, rather than just use the optional arguments to the
cite
command? e.g. cite[p.64]{book1}
– Seamus
Feb 8 at 16:34
add a comment |
1 Answer
1
active
oldest
votes
Personally, I don't think the usual input
autocite[64]{sigfridsson}
autocite[64-65]{sigfridsson}
is too complicated or far inferior to cite{key}{64}{65}
.
Here is a solution that only slightly modifies the macro mknormrange
to drop the second page number if it is equal to the first. We then need to change around the order of commands in the postnote
formats to give expected output with respect to "p."/"pp.". Then you can use the standard biblatex
postnote syntax
autocite[<startpage>-<endpage>]{<key>}
documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}
addbibresource{biblatex-examples.bib}
DeclareFieldFormat{postnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{volcitepages}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{multipostnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
makeatletter
defblx@normrange@process#1#2{%
ifstrequal{#1}{#2}
{blx@range@out@value{#1}}
{blx@range@out@value{#1bibrangedash#2}}}
makeatother
begin{document}
autocite[64-64]{sigfridsson}
autocite[64-65]{sigfridsson}
printbibliography
end{document}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473949%2fcustom-cite-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Personally, I don't think the usual input
autocite[64]{sigfridsson}
autocite[64-65]{sigfridsson}
is too complicated or far inferior to cite{key}{64}{65}
.
Here is a solution that only slightly modifies the macro mknormrange
to drop the second page number if it is equal to the first. We then need to change around the order of commands in the postnote
formats to give expected output with respect to "p."/"pp.". Then you can use the standard biblatex
postnote syntax
autocite[<startpage>-<endpage>]{<key>}
documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}
addbibresource{biblatex-examples.bib}
DeclareFieldFormat{postnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{volcitepages}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{multipostnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
makeatletter
defblx@normrange@process#1#2{%
ifstrequal{#1}{#2}
{blx@range@out@value{#1}}
{blx@range@out@value{#1bibrangedash#2}}}
makeatother
begin{document}
autocite[64-64]{sigfridsson}
autocite[64-65]{sigfridsson}
printbibliography
end{document}
add a comment |
Personally, I don't think the usual input
autocite[64]{sigfridsson}
autocite[64-65]{sigfridsson}
is too complicated or far inferior to cite{key}{64}{65}
.
Here is a solution that only slightly modifies the macro mknormrange
to drop the second page number if it is equal to the first. We then need to change around the order of commands in the postnote
formats to give expected output with respect to "p."/"pp.". Then you can use the standard biblatex
postnote syntax
autocite[<startpage>-<endpage>]{<key>}
documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}
addbibresource{biblatex-examples.bib}
DeclareFieldFormat{postnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{volcitepages}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{multipostnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
makeatletter
defblx@normrange@process#1#2{%
ifstrequal{#1}{#2}
{blx@range@out@value{#1}}
{blx@range@out@value{#1bibrangedash#2}}}
makeatother
begin{document}
autocite[64-64]{sigfridsson}
autocite[64-65]{sigfridsson}
printbibliography
end{document}
add a comment |
Personally, I don't think the usual input
autocite[64]{sigfridsson}
autocite[64-65]{sigfridsson}
is too complicated or far inferior to cite{key}{64}{65}
.
Here is a solution that only slightly modifies the macro mknormrange
to drop the second page number if it is equal to the first. We then need to change around the order of commands in the postnote
formats to give expected output with respect to "p."/"pp.". Then you can use the standard biblatex
postnote syntax
autocite[<startpage>-<endpage>]{<key>}
documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}
addbibresource{biblatex-examples.bib}
DeclareFieldFormat{postnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{volcitepages}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{multipostnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
makeatletter
defblx@normrange@process#1#2{%
ifstrequal{#1}{#2}
{blx@range@out@value{#1}}
{blx@range@out@value{#1bibrangedash#2}}}
makeatother
begin{document}
autocite[64-64]{sigfridsson}
autocite[64-65]{sigfridsson}
printbibliography
end{document}
Personally, I don't think the usual input
autocite[64]{sigfridsson}
autocite[64-65]{sigfridsson}
is too complicated or far inferior to cite{key}{64}{65}
.
Here is a solution that only slightly modifies the macro mknormrange
to drop the second page number if it is equal to the first. We then need to change around the order of commands in the postnote
formats to give expected output with respect to "p."/"pp.". Then you can use the standard biblatex
postnote syntax
autocite[<startpage>-<endpage>]{<key>}
documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}
addbibresource{biblatex-examples.bib}
DeclareFieldFormat{postnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{volcitepages}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
DeclareFieldFormat{multipostnote}{mknormrange*[{mkpageprefix[pagination]}]{#1}}
makeatletter
defblx@normrange@process#1#2{%
ifstrequal{#1}{#2}
{blx@range@out@value{#1}}
{blx@range@out@value{#1bibrangedash#2}}}
makeatother
begin{document}
autocite[64-64]{sigfridsson}
autocite[64-65]{sigfridsson}
printbibliography
end{document}
edited Feb 8 at 16:56
answered Feb 8 at 16:35
moewemoewe
91.2k10114343
91.2k10114343
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f473949%2fcustom-cite-command%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Why do you want to do this, rather than just use the optional arguments to the
cite
command? e.g.cite[p.64]{book1}
– Seamus
Feb 8 at 16:34