Skip to content

Instantly share code, notes, and snippets.

@konn
Created February 14, 2015 13:20
Show Gist options
  • Save konn/d7050a0b66c9dd58b01a to your computer and use it in GitHub Desktop.
Save konn/d7050a0b66c9dd58b01a to your computer and use it in GitHub Desktop.
\ProvidesFile{tate-numeric.bbx}[2014/02/14 biblatex bibliography style]
\RequireBibliographyStyle{numeric}
\newcounter{bltn@kanjic}
\newcommand{\bltn@colon}{\raisebox{-0.3ex}{\rotatebox[origin=c]{90}{:}}}
\newcommand{\kanjify}[1]{\setcounter{bltn@kanjic}{#1}\Kanji{bltn@kanjic}}
\newcommand*{\addcomma}{、}
\newcommand*{\adddot}{。}
\DeclareFieldFormat{kansuji}{\kanjify{#1}}
\DeclareFieldFormat{yoko}{\pbox<y>{#1}}
\DeclareFieldFormat{parens}{(\nopunct#1)}
\DeclareFieldFormat{dkagi}{『\nopunct#1』}
\DeclareFieldFormat{kagi}{「\nopunct#1」}
\renewcommand*{\finentrypunct}{}
\renewcommand*{\multinamedelim}{/}
\renewcommand*{\finalnamedelim}{/}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=pages,
match=\regexp{(\d+)-(\d+)},
replace=\regexp{\\kanjify{$1}〜\\kanjify{$2}頁}]
\step[fieldsource=title,
match={:},
replace=\regexp{\\raisebox{-0.3ex}{\\rotatebox[origin=c]{90}{:}}}]
\step[fieldsource=author,
match={:},
replace=\regexp{\\raisebox{-0.3ex}{\\rotatebox[origin=c]{90}{:}}}]
\step[fieldsource=booktitle,
match={:},
replace=\regexp{\\raisebox{-0.3ex}{\\rotatebox[origin=c]{90}{:}}}]
\step[fieldsource=subtitle,
match={:},
replace=\regexp{\\raisebox{-0.3ex}{\\rotatebox[origin=c]{90}{:}}}]
}
}
}
\newbibmacro*{titlecontent}{%
\emph{\thefield{title}}%
\iffieldundef{subtitle}{}{ \thefield{subtitle}}%
}
\renewbibmacro*{byeditor}{\printfield{editor}・編}
\renewbibmacro*{title}{%
\ifthenelse{\ifentrytype{article} \or \ifentrytype{inbook}}%
{\printtext[kagi]{\usebibmacro{titlecontent}}}%
{\printtext[dkagi]{\usebibmacro{titlecontent}}}}
\renewbibmacro*{journal}{%
\printtext[dkagi]{\textgt{\printfield{journaltitle}}}%
\iffieldundef{volume}{}{%
第\printfield[yoko]{volume}巻%
\iffieldundef{number}{}{第\printfield[yoko]{number}号}%
}%
}
\newbibmacro*{book}{%
\printtext[dkagi]{\textgt{\printfield{booktitle}}}%
\iffieldundef{chapter}{}{第\printfield[kansuji]{chapter}章}%
\iffieldundef{pages}{}{%
\newunit\newblock
\printfield[pages]{pages}%
}%
\iffieldundef{volume}{}{%
第\printfield[yoko]{volume}巻%
\iffieldundef{number}{}{第\printfield[yoko]{number}号}%
}%
}
\newbibmacro*{publisher+year}{%
\printtext[parens]{%
\printlist{publisher}、%
\printfield[kansuji]{year}年}}
\DeclareBibliographyDriver{book}{%
\usebibmacro{author/translator+others}%
\usebibmacro{title}%
\usebibmacro{publisher+year}}
\DeclareBibliographyDriver{article}{%
\usebibmacro{author/translator+others}\nopunct%
\newunit\nopunct\newblock%
\usebibmacro{title}、%
\newunit\newblock
\usebibmacro{journal}、%
\printtext[parens]{%
\printlist{publisher}、%
\printfield[kansuji]{year}年}%
\finentry%
}
\DeclareBibliographyDriver{inbook}{%
\usebibmacro{author/translator+others}\nopunct%
\newunit%
\usebibmacro{title}%
\newunit%
\usebibmacro{book}%
\newunit\newblock%
\usebibmacro{publisher+year}%
\finentry%
}
\DeclareBibliographyDriver{electronic}{
\usebibmacro{author/translator+others}\nopunct%
\usebibmacro{title}%
\finentry%
}
\endinput
\ProvidesFile{tate-numeric.cbx}[2014/02/14 biblatex citation style]
\RequireCitationStyle{numeric}
\ExecuteBibliographyOptions{labelnumber,autocite=inline}
\newcounter{bltn@temp}
\renewcommand*{\multicitedelim}{、}
\renewcommand*{\iffinalcitedelim}{%
\ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
\renewcommand*{\mkbibbrackets}[1]{〔#1〕}
\DeclareFieldFormat{labelnumber}{%
\setcounter{bltn@temp}{#1}\Kanji{bltn@temp}}
\endinput
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment