Skip to content

Commit

Permalink
Bib: Select inbook format based on booktitle field (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Mar 8, 2024
1 parent 17bd760 commit d67c61d
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 25 deletions.
33 changes: 24 additions & 9 deletions thuthesis-author-year.bst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
%% -------------------------------------------------------------------
%% GB/T 7714 BibTeX Style
%% https://github.com/zepinglee/gbt7714-bibtex-style
%% Version: 2022/03/21 v2.1.4
%% Version: 2024/03/08 v2.1.6
%% -------------------------------------------------------------------
%% Copyright (C) 2016--2022 by Zeping Lee <zepinglee AT gmail.com>
%% Copyright (C) 2016--2024 by Zeping Lee <zepinglee AT gmail.com>
%% -------------------------------------------------------------------
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
Expand Down Expand Up @@ -39,6 +39,7 @@ INTEGERS {
show.medium.type
short.journal
italic.journal
link.journal
bold.journal.volume
show.missing.address.publisher
space.before.pages
Expand Down Expand Up @@ -83,6 +84,7 @@ FUNCTION {load.config}
"slash" 'component.part.label :=
#0 'short.journal :=
#0 'italic.journal :=
#0 'link.journal :=
#0 'bold.journal.volume :=
#0 'show.missing.address.publisher :=
#1 'space.before.pages :=
Expand Down Expand Up @@ -745,7 +747,7 @@ FUNCTION {editor.full}

FUNCTION {make.full.names}
{ type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.full
{ type$ "collection" =
Expand Down Expand Up @@ -887,7 +889,7 @@ FUNCTION {format.volume}
{ volume is.number
{ entry.lang lang.zh =
{ "第 " volume * " 卷" * }
{ "volume" volume tie.or.space.connect }
{ "Vol." volume tie.or.space.connect }
if$
}
{ volume }
Expand All @@ -902,7 +904,7 @@ FUNCTION {format.number}
{ number is.number
{ entry.lang lang.zh =
{ "第 " number * " 册" * }
{ "number" number tie.or.space.connect }
{ "No." number tie.or.space.connect }
if$
}
{ number }
Expand Down Expand Up @@ -1067,7 +1069,7 @@ FUNCTION {get.journal.title}
}

FUNCTION {check.arxiv.preprint}
{ #1 #5 substring$ "l" change.case$ "arxiv" =
{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" =
{ #1 }
{ #0 }
if$
Expand All @@ -1080,6 +1082,10 @@ FUNCTION {format.journal}
'emphasize
'skip$
if$
link.journal
'add.link
'skip$
if$
}
'skip$
if$
Expand Down Expand Up @@ -1976,6 +1982,10 @@ FUNCTION {preprint}
format.urldate "" output.after
output.eprint
output.url
show.preprint not eprint empty$ or
'output.doi
'skip$
if$
new.block
format.note output
fin.entry
Expand Down Expand Up @@ -2040,7 +2050,12 @@ FUNCTION {dataset}
electronic
}

FUNCTION {inbook} { book }
FUNCTION {inbook} {
booktitle empty$
'book
'incollection
if$
}

FUNCTION {inproceedings}
{ "C" set.entry.mark
Expand Down Expand Up @@ -2281,7 +2296,7 @@ FUNCTION {editor.key.organization.label}
FUNCTION {calc.short.authors}
{ "" 'short.label :=
type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.key.label
{ type$ "collection" =
Expand Down Expand Up @@ -2483,7 +2498,7 @@ FUNCTION {presort}
" "
*
type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.sort
{ type$ "collection" =
Expand Down
31 changes: 23 additions & 8 deletions thuthesis-bachelor.bst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
%% -------------------------------------------------------------------
%% GB/T 7714 BibTeX Style
%% https://github.com/zepinglee/gbt7714-bibtex-style
%% Version: 2022/03/21 v2.1.4
%% Version: 2024/03/08 v2.1.6
%% -------------------------------------------------------------------
%% Copyright (C) 2016--2022 by Zeping Lee <zepinglee AT gmail.com>
%% Copyright (C) 2016--2024 by Zeping Lee <zepinglee AT gmail.com>
%% -------------------------------------------------------------------
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
Expand Down Expand Up @@ -39,6 +39,7 @@ INTEGERS {
show.medium.type
short.journal
italic.journal
link.journal
bold.journal.volume
show.missing.address.publisher
space.before.pages
Expand Down Expand Up @@ -78,6 +79,7 @@ FUNCTION {load.config}
"slash" 'component.part.label :=
#0 'short.journal :=
#0 'italic.journal :=
#0 'link.journal :=
#0 'bold.journal.volume :=
#0 'show.missing.address.publisher :=
#1 'space.before.pages :=
Expand Down Expand Up @@ -735,7 +737,7 @@ FUNCTION {editor.full}

FUNCTION {make.full.names}
{ type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.full
{ type$ "collection" =
Expand Down Expand Up @@ -877,7 +879,7 @@ FUNCTION {format.volume}
{ volume is.number
{ entry.lang lang.zh =
{ "第 " volume * " 卷" * }
{ "volume" volume tie.or.space.connect }
{ "Vol." volume tie.or.space.connect }
if$
}
{ volume }
Expand All @@ -892,7 +894,7 @@ FUNCTION {format.number}
{ number is.number
{ entry.lang lang.zh =
{ "第 " number * " 册" * }
{ "number" number tie.or.space.connect }
{ "No." number tie.or.space.connect }
if$
}
{ number }
Expand Down Expand Up @@ -1057,7 +1059,7 @@ FUNCTION {get.journal.title}
}

FUNCTION {check.arxiv.preprint}
{ #1 #5 substring$ "l" change.case$ "arxiv" =
{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" =
{ #1 }
{ #0 }
if$
Expand All @@ -1070,6 +1072,10 @@ FUNCTION {format.journal}
'emphasize
'skip$
if$
link.journal
'add.link
'skip$
if$
}
'skip$
if$
Expand Down Expand Up @@ -1966,6 +1972,10 @@ FUNCTION {preprint}
format.urldate "" output.after
output.eprint
output.url
show.preprint not eprint empty$ or
'output.doi
'skip$
if$
new.block
format.note output
fin.entry
Expand Down Expand Up @@ -2030,7 +2040,12 @@ FUNCTION {dataset}
electronic
}

FUNCTION {inbook} { book }
FUNCTION {inbook} {
booktitle empty$
'book
'incollection
if$
}

FUNCTION {inproceedings}
{ "C" set.entry.mark
Expand Down Expand Up @@ -2271,7 +2286,7 @@ FUNCTION {editor.key.organization.label}
FUNCTION {calc.short.authors}
{ "" 'short.label :=
type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.key.label
{ type$ "collection" =
Expand Down
31 changes: 23 additions & 8 deletions thuthesis-numeric.bst
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
%% -------------------------------------------------------------------
%% GB/T 7714 BibTeX Style
%% https://github.com/zepinglee/gbt7714-bibtex-style
%% Version: 2022/03/21 v2.1.4
%% Version: 2024/03/08 v2.1.6
%% -------------------------------------------------------------------
%% Copyright (C) 2016--2022 by Zeping Lee <zepinglee AT gmail.com>
%% Copyright (C) 2016--2024 by Zeping Lee <zepinglee AT gmail.com>
%% -------------------------------------------------------------------
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
Expand Down Expand Up @@ -39,6 +39,7 @@ INTEGERS {
show.medium.type
short.journal
italic.journal
link.journal
bold.journal.volume
show.missing.address.publisher
space.before.pages
Expand Down Expand Up @@ -78,6 +79,7 @@ FUNCTION {load.config}
"slash" 'component.part.label :=
#0 'short.journal :=
#0 'italic.journal :=
#0 'link.journal :=
#0 'bold.journal.volume :=
#0 'show.missing.address.publisher :=
#1 'space.before.pages :=
Expand Down Expand Up @@ -735,7 +737,7 @@ FUNCTION {editor.full}

FUNCTION {make.full.names}
{ type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.full
{ type$ "collection" =
Expand Down Expand Up @@ -877,7 +879,7 @@ FUNCTION {format.volume}
{ volume is.number
{ entry.lang lang.zh =
{ "第 " volume * " 卷" * }
{ "volume" volume tie.or.space.connect }
{ "Vol." volume tie.or.space.connect }
if$
}
{ volume }
Expand All @@ -892,7 +894,7 @@ FUNCTION {format.number}
{ number is.number
{ entry.lang lang.zh =
{ "第 " number * " 册" * }
{ "number" number tie.or.space.connect }
{ "No." number tie.or.space.connect }
if$
}
{ number }
Expand Down Expand Up @@ -1057,7 +1059,7 @@ FUNCTION {get.journal.title}
}

FUNCTION {check.arxiv.preprint}
{ #1 #5 substring$ "l" change.case$ "arxiv" =
{ #1 #5 substring$ purify$ "l" change.case$ "arxiv" =
{ #1 }
{ #0 }
if$
Expand All @@ -1070,6 +1072,10 @@ FUNCTION {format.journal}
'emphasize
'skip$
if$
link.journal
'add.link
'skip$
if$
}
'skip$
if$
Expand Down Expand Up @@ -1966,6 +1972,10 @@ FUNCTION {preprint}
format.urldate "" output.after
output.eprint
output.url
show.preprint not eprint empty$ or
'output.doi
'skip$
if$
new.block
format.note output
fin.entry
Expand Down Expand Up @@ -2030,7 +2040,12 @@ FUNCTION {dataset}
electronic
}

FUNCTION {inbook} { book }
FUNCTION {inbook} {
booktitle empty$
'book
'incollection
if$
}

FUNCTION {inproceedings}
{ "C" set.entry.mark
Expand Down Expand Up @@ -2271,7 +2286,7 @@ FUNCTION {editor.key.organization.label}
FUNCTION {calc.short.authors}
{ "" 'short.label :=
type$ "book" =
type$ "inbook" =
type$ "inbook" = booktitle empty$ not and
or
'author.editor.key.label
{ type$ "collection" =
Expand Down

0 comments on commit d67c61d

Please sign in to comment.