doc-isac/mlehnfeld/master/thesis/hgbbib.sty
changeset 55404 ab97437e021a
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc-isac/mlehnfeld/master/thesis/hgbbib.sty	Wed Mar 12 17:43:22 2014 +0100
     1.3 @@ -0,0 +1,138 @@
     1.4 +%% --------------- Bibliography setup --------------------------------------
     1.5 +
     1.6 +\usepackage{csquotes}	% recommended for biblatex
     1.7 +%\usepackage[babel,german=quotes]{csquotes}	% utf8-change ??
     1.8 +
     1.9 +%utf8-change
    1.10 +%Note: biblatex with bibtex backend is frozen at version 1.7.
    1.11 +\usepackage[style=numeric-comp,backend=biber,bibencoding=auto]{biblatex}[2013/01/10] %utf8-change
    1.12 +
    1.13 +\ExecuteBibliographyOptions{bibwarn=true,sortcites=true,defernumbers=true,isbn=false,doi=false,backref=true}
    1.14 +
    1.15 +%% titles of reference section + 3 categories of references:
    1.16 +\newcommand{\@bibtitle}{Quellenverzeichnis}
    1.17 +\newcommand{\@bibtitleLiteratur}{Literatur}
    1.18 +\newcommand{\@bibtitleAvmedia}{Filme und audiovisuelle Medien}
    1.19 +\newcommand{\@bibtitleOnline}{Online-Quellen}	
    1.20 +
    1.21 +\ifthenelse{\equal{\hgb@MainLanguage}{english}}{%
    1.22 +	\renewcommand{\@bibtitle}{References}
    1.23 +	\renewcommand{\@bibtitleLiteratur}{Literature}
    1.24 +	\renewcommand{\@bibtitleAvmedia}{Films and audio-visual media}
    1.25 +	\renewcommand{\@bibtitleOnline}{Online sources}	
    1.26 +}{}
    1.27 +
    1.28 +\defbibfilter{literature}{
    1.29 +	not ( type=movie or type=video or type=music or type=audio or 
    1.30 +				type=online or type=electronic or type=www or type=software )}
    1.31 +
    1.32 +\defbibfilter{avmedia}{%
    1.33 +	( type=movie or type=video or type=music or type=audio or type=software )}
    1.34 +
    1.35 +\defbibfilter{online}{%
    1.36 +	( type=online or type=electronic or type=www )}
    1.37 +
    1.38 +
    1.39 +\defbibheading{noheader}[]{}	% 'none' should be defined but isn't
    1.40 +
    1.41 +% utf8-change (deactivated):
    1.42 +% German format in biblatex is flawed: it adds wrong spaces and prohibits
    1.43 +% line breaking within date strings. Corrected by Wilbur as follows.
    1.44 +% Taken from german.lbx: replaced \thinspace by breaking zero space \hskip0pt 
    1.45 +%\DefineBibliographyExtras{ngerman}{% 
    1.46 +  %\def\mkbibdatelong#1#2#3{%
    1.47 +    %\iffieldundef{#3}
    1.48 +      %{\hskip0pt}
    1.49 +      %{\mkbibordinal{\thefield{#3}}%
    1.50 +       %\iffieldundef{#2}{}{\space}}%	%was: \nobreakspace
    1.51 +    %\iffieldundef{#2}
    1.52 +      %{\hskip0pt}
    1.53 +      %{\mkbibmonth{\thefield{#2}}%
    1.54 +       %\iffieldundef{#1}{\hskip0pt}{\space}}%
    1.55 +    %\stripzeros{\thefield{#1}}}%
    1.56 +%%
    1.57 +  %\def\mkbibdateshort#1#2#3{%
    1.58 +    %\iffieldundef{#3}
    1.59 +      %{\hskip0pt}
    1.60 +      %{\mkdatezeros{\thefield{#3}}\adddot
    1.61 +       %\iffieldundef{#2}{}{\hskip0pt}}%
    1.62 +    %\iffieldundef{#2}
    1.63 +      %{\hskip0pt}
    1.64 +      %{\mkdatezeros{\thefield{#2}}%
    1.65 +       %\iffieldundef{#1}
    1.66 +	 %{\hskip0pt}
    1.67 +	 %{\iffieldundef{#3}{/}{\adddot\hskip0pt}}}%
    1.68 +    %\mkdatezeros{\thefield{#1}}}%
    1.69 +%}
    1.70 +
    1.71 +% utf8-change (deactivated):
    1.72 +% Similar problem with badly braking date strings in english.
    1.73 +% Taken from english.lbx: added breaking zero space \hskip0pt to /
    1.74 +%\DefineBibliographyExtras{english}{% 
    1.75 +  %\def\mkbibdatelong#1#2#3{%
    1.76 +    %\iffieldundef{#2}
    1.77 +      %{}
    1.78 +      %{\mkbibmonth{\thefield{#2}}%
    1.79 +       %\iffieldundef{#3}
    1.80 +         %{\iffieldundef{#1}{}{\space}}
    1.81 +	 %{\space}}%	%was: \nobreakspace
    1.82 +    %\iffieldundef{#3}
    1.83 +      %{}
    1.84 +      %{\stripzeros{\thefield{#3}}%
    1.85 +       %\iffieldundef{#1}{}{,\space}}%
    1.86 +    %\stripzeros{\thefield{#1}}}%
    1.87 +%%
    1.88 +  %\def\mkbibdateshort#1#2#3{%
    1.89 +    %\iffieldundef{#2}
    1.90 +      %{}
    1.91 +      %{\mkdatezeros{\thefield{#2}}%
    1.92 +       %\iffieldundef{#3}
    1.93 +         %{\iffieldundef{#1}{}{/{\hskip0pt}}}
    1.94 +	 %{/{\hskip0pt}}}%
    1.95 +    %\iffieldundef{#3}
    1.96 +      %{}
    1.97 +      %{\mkdatezeros{\thefield{#3}}%
    1.98 +       %\iffieldundef{#1}{}{/{\hskip0pt}}}%
    1.99 +    %\mkdatezeros{\thefield{#1}}}%
   1.100 +%}
   1.101 +
   1.102 +
   1.103 +%This is only a wrapper to \addbibresource to allow the use
   1.104 +%of the classic bibtex-workflow in the future.
   1.105 +\newcommand{\AddBibFile}[1]{
   1.106 +	\addbibresource{#1}%
   1.107 +}
   1.108 +
   1.109 +%See http://www.jr-x.de/publikationen/latex/tipps/zeilenumbruch.html
   1.110 +\newenvironment{bibhyphenation}% 
   1.111 +	{\hyphenpenalty=20%		(50)
   1.112 +	 \tolerance=9999%				(200)
   1.113 +	 \exhyphenpenalty=0%		(50)
   1.114 +	 \linepenalty=0%				(10)
   1.115 +	 \setlength{\emergencystretch}{3em}}%
   1.116 +	{}
   1.117 +
   1.118 +% Currently the only public macro:
   1.119 +% \MakeBibliography ... creates a reference section split subsections (default)
   1.120 +% \MakeBibliography[nosplit] ... creates a one-piece reference section
   1.121 +\newcommand{\MakeBibliography}[1][]{
   1.122 +	% opt. arg (#1): optional argument "nosplit" to get a 1-piece bibliography
   1.123 +	\clearpage
   1.124 +	\ifthenelse{\equal{#1}{nosplit}}%
   1.125 +		{% create a single bibliography with all entries:
   1.126 +			%\printbibheading[heading=bibintoc,title={#2}]
   1.127 +			\printbibheading[heading=bibintoc,title={\@bibtitle}]
   1.128 +			\begin{bibhyphenation}	
   1.129 +			\printbibliography[heading=noheader]
   1.130 +			\end{bibhyphenation}
   1.131 +		}
   1.132 +		{% split the bibliography using the predefined categories:
   1.133 +			%\printbibheading[heading=bibintoc,title={#2}]
   1.134 +			\printbibheading[heading=bibintoc,title={\@bibtitle}]
   1.135 +			\begin{bibhyphenation}
   1.136 +			\printbibliography[filter=literature,heading=subbibintoc,title={\@bibtitleLiteratur}]
   1.137 +			\printbibliography[filter=avmedia,heading=subbibintoc,title={\@bibtitleAvmedia}]
   1.138 +			\printbibliography[filter=online,heading=subbibintoc,title={\@bibtitleOnline}]
   1.139 +			\end{bibhyphenation}
   1.140 +		}%
   1.141 +}