Skip to content

Instantly share code, notes, and snippets.

@mxpiotrowski
Created August 19, 2019 15:20
Show Gist options
  • Save mxpiotrowski/928ea414ffb546fbf78e61ae4410a992 to your computer and use it in GitHub Desktop.
Save mxpiotrowski/928ea414ffb546fbf78e61ae4410a992 to your computer and use it in GitHub Desktop.
\documentclass[a4paper]{article}
\usepackage[ngerman, american]{babel}
\usepackage[autostyle=true, german=swiss]{csquotes}
\usepackage[backend=biber, style=authoryear, isbn=false, autolang=hyphen]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Piotrowski2012a,
author = {Piotrowski, Michael},
title = {Natural Language Processing for Historical Texts},
publisher = {Morgan \& Claypool},
year = 2012,
series = {Synthesis Lectures on Human Language Technologies},
location = {locodeussrf},
country = {countryus},
number = 17,
language = {english},
doi = {10.2200/S00436ED1V01Y201207HLT017},
pagetotal = {157}
}
@InProceedings{Piotrowski2016a,
author = {Piotrowski, Michael},
title = {Future publishing formats},
booktitle = {DocEng '16: Proceedings of the 2016 ACM Symposium on
Document Engineering},
year = 2016,
editor = {Robert Sablatnig and Tamir Hassan},
venue = {locodeatvie},
pages = {7--8},
address = {locodeusnyc},
publisher = {ACM},
language = {english},
doi = {10.1145/2960811.2967170}
}
\end{filecontents}
\begin{filecontents}{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field, datatype=key, skipout=false]{venue}
\DeclareDatamodelFields[type=list, datatype=key, skipout=false]{location}
\end{filecontents}
\NewBibliographyString{locodeatvie, locodeczprg, locodedelej, locodeusnyc, locodeussrf}
\DefineBibliographyStrings{american}{%
locodeatvie = {Vienna, Austria},
locodeczprg = {Prague, Czech Republic},
locodedelej = {Leipzig, Germany},
locodeusnyc = {New York, NY},
locodeussrf = {San Rafael, CA},
}
\DefineBibliographyStrings{german}{%
locodeatvie = {Wien},
locodeczprg = {Prag},
locodedelej = {Leipzig},
locodeusnyc = {New York, NY, USA},
locodeussrf = {San Rafael, CA, USA},
}
\DeclareFieldFormat{venue}{\ifbibstring{#1}{\bibstring{#1}}{#1}}
\DeclareListFormat{location}{%
\ifbibstring{#1}{\bibstring{#1}}{#1}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
%%% Local variables:
%%% TeX-PDF-mode: t
%%% TeX-engine: xetex
%%% TeX-open-quote: "\\q{"
%%% TeX-close-quote: "}"
%%% sentence-end-double-space: t
%%% LaTeX-babel-hyphen: nil
%%% eval: (visual-line-mode)
%%% End:
\documentclass[a4paper]{article}
\usepackage[ngerman, american]{babel}
\usepackage[autostyle=true, german=swiss]{csquotes}
\usepackage[backend=biber, style=authoryear, isbn=false, autolang=hyphen]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{Piotrowski2012a,
author = {Piotrowski, Michael},
title = {Natural Language Processing for Historical Texts},
publisher = {Morgan \& Claypool},
year = 2012,
series = {Synthesis Lectures on Human Language Technologies},
location = {locodeussrf},
country = {countryus},
number = 17,
language = {english},
doi = {10.2200/S00436ED1V01Y201207HLT017},
pagetotal = {157}
}
@InProceedings{Piotrowski2016a,
author = {Piotrowski, Michael},
title = {Future publishing formats},
booktitle = {DocEng '16: Proceedings of the 2016 ACM Symposium on
Document Engineering},
year = 2016,
editor = {Robert Sablatnig and Tamir Hassan},
venue = {locodeatvie},
pages = {7--8},
address = {locodeusnyc},
publisher = {ACM},
language = {english},
doi = {10.1145/2960811.2967170}
}
\end{filecontents}
\begin{filecontents}{biblatex-dm.cfg}
\DeclareDatamodelFields[type=field, datatype=key, skipout=false]{venue}
\DeclareDatamodelFields[type=list, datatype=key, skipout=false]{location}
\end{filecontents}
\NewBibliographyString{locodeatvie, locodeczprg, locodedelej, locodeusnyc, locodeussrf}
\DefineBibliographyStrings{american}{%
locodeatvie = {Vienna, Austria},
locodeczprg = {Prague, Czech Republic},
locodedelej = {Leipzig, Germany},
locodeusnyc = {New York, NY},
locodeussrf = {San Rafael, CA},
}
\DefineBibliographyStrings{german}{%
locodeatvie = {Wien},
locodeczprg = {Prag},
locodedelej = {Leipzig},
locodeusnyc = {New York, NY, USA},
locodeussrf = {San Rafael, CA, USA},
}
\DeclareFieldFormat{venue}{\ifbibstring{#1}{\bibstring{#1}}{#1}}
\DeclareListFormat{location}{%
\ifbibstring{#1}{\bibstring{#1}}{#1}%
\ifthenelse{\value{listcount}<\value{liststop}}
{\addcomma\space}
{}}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
%%% Local variables:
%%% TeX-PDF-mode: t
%%% TeX-engine: xetex
%%% TeX-open-quote: "\\q{"
%%% TeX-close-quote: "}"
%%% sentence-end-double-space: t
%%% LaTeX-babel-hyphen: nil
%%% eval: (visual-line-mode)
%%% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment