doc-isac/mlehnfeld/master/thesis/hgbbib.sty
changeset 55404 ab97437e021a
equal deleted inserted replaced
55403:d2d4125a92ad 55404:ab97437e021a
       
     1 %% --------------- Bibliography setup --------------------------------------
       
     2 
       
     3 \usepackage{csquotes}	% recommended for biblatex
       
     4 %\usepackage[babel,german=quotes]{csquotes}	% utf8-change ??
       
     5 
       
     6 %utf8-change
       
     7 %Note: biblatex with bibtex backend is frozen at version 1.7.
       
     8 \usepackage[style=numeric-comp,backend=biber,bibencoding=auto]{biblatex}[2013/01/10] %utf8-change
       
     9 
       
    10 \ExecuteBibliographyOptions{bibwarn=true,sortcites=true,defernumbers=true,isbn=false,doi=false,backref=true}
       
    11 
       
    12 %% titles of reference section + 3 categories of references:
       
    13 \newcommand{\@bibtitle}{Quellenverzeichnis}
       
    14 \newcommand{\@bibtitleLiteratur}{Literatur}
       
    15 \newcommand{\@bibtitleAvmedia}{Filme und audiovisuelle Medien}
       
    16 \newcommand{\@bibtitleOnline}{Online-Quellen}	
       
    17 
       
    18 \ifthenelse{\equal{\hgb@MainLanguage}{english}}{%
       
    19 	\renewcommand{\@bibtitle}{References}
       
    20 	\renewcommand{\@bibtitleLiteratur}{Literature}
       
    21 	\renewcommand{\@bibtitleAvmedia}{Films and audio-visual media}
       
    22 	\renewcommand{\@bibtitleOnline}{Online sources}	
       
    23 }{}
       
    24 
       
    25 \defbibfilter{literature}{
       
    26 	not ( type=movie or type=video or type=music or type=audio or 
       
    27 				type=online or type=electronic or type=www or type=software )}
       
    28 
       
    29 \defbibfilter{avmedia}{%
       
    30 	( type=movie or type=video or type=music or type=audio or type=software )}
       
    31 
       
    32 \defbibfilter{online}{%
       
    33 	( type=online or type=electronic or type=www )}
       
    34 
       
    35 
       
    36 \defbibheading{noheader}[]{}	% 'none' should be defined but isn't
       
    37 
       
    38 % utf8-change (deactivated):
       
    39 % German format in biblatex is flawed: it adds wrong spaces and prohibits
       
    40 % line breaking within date strings. Corrected by Wilbur as follows.
       
    41 % Taken from german.lbx: replaced \thinspace by breaking zero space \hskip0pt 
       
    42 %\DefineBibliographyExtras{ngerman}{% 
       
    43   %\def\mkbibdatelong#1#2#3{%
       
    44     %\iffieldundef{#3}
       
    45       %{\hskip0pt}
       
    46       %{\mkbibordinal{\thefield{#3}}%
       
    47        %\iffieldundef{#2}{}{\space}}%	%was: \nobreakspace
       
    48     %\iffieldundef{#2}
       
    49       %{\hskip0pt}
       
    50       %{\mkbibmonth{\thefield{#2}}%
       
    51        %\iffieldundef{#1}{\hskip0pt}{\space}}%
       
    52     %\stripzeros{\thefield{#1}}}%
       
    53 %%
       
    54   %\def\mkbibdateshort#1#2#3{%
       
    55     %\iffieldundef{#3}
       
    56       %{\hskip0pt}
       
    57       %{\mkdatezeros{\thefield{#3}}\adddot
       
    58        %\iffieldundef{#2}{}{\hskip0pt}}%
       
    59     %\iffieldundef{#2}
       
    60       %{\hskip0pt}
       
    61       %{\mkdatezeros{\thefield{#2}}%
       
    62        %\iffieldundef{#1}
       
    63 	 %{\hskip0pt}
       
    64 	 %{\iffieldundef{#3}{/}{\adddot\hskip0pt}}}%
       
    65     %\mkdatezeros{\thefield{#1}}}%
       
    66 %}
       
    67 
       
    68 % utf8-change (deactivated):
       
    69 % Similar problem with badly braking date strings in english.
       
    70 % Taken from english.lbx: added breaking zero space \hskip0pt to /
       
    71 %\DefineBibliographyExtras{english}{% 
       
    72   %\def\mkbibdatelong#1#2#3{%
       
    73     %\iffieldundef{#2}
       
    74       %{}
       
    75       %{\mkbibmonth{\thefield{#2}}%
       
    76        %\iffieldundef{#3}
       
    77          %{\iffieldundef{#1}{}{\space}}
       
    78 	 %{\space}}%	%was: \nobreakspace
       
    79     %\iffieldundef{#3}
       
    80       %{}
       
    81       %{\stripzeros{\thefield{#3}}%
       
    82        %\iffieldundef{#1}{}{,\space}}%
       
    83     %\stripzeros{\thefield{#1}}}%
       
    84 %%
       
    85   %\def\mkbibdateshort#1#2#3{%
       
    86     %\iffieldundef{#2}
       
    87       %{}
       
    88       %{\mkdatezeros{\thefield{#2}}%
       
    89        %\iffieldundef{#3}
       
    90          %{\iffieldundef{#1}{}{/{\hskip0pt}}}
       
    91 	 %{/{\hskip0pt}}}%
       
    92     %\iffieldundef{#3}
       
    93       %{}
       
    94       %{\mkdatezeros{\thefield{#3}}%
       
    95        %\iffieldundef{#1}{}{/{\hskip0pt}}}%
       
    96     %\mkdatezeros{\thefield{#1}}}%
       
    97 %}
       
    98 
       
    99 
       
   100 %This is only a wrapper to \addbibresource to allow the use
       
   101 %of the classic bibtex-workflow in the future.
       
   102 \newcommand{\AddBibFile}[1]{
       
   103 	\addbibresource{#1}%
       
   104 }
       
   105 
       
   106 %See http://www.jr-x.de/publikationen/latex/tipps/zeilenumbruch.html
       
   107 \newenvironment{bibhyphenation}% 
       
   108 	{\hyphenpenalty=20%		(50)
       
   109 	 \tolerance=9999%				(200)
       
   110 	 \exhyphenpenalty=0%		(50)
       
   111 	 \linepenalty=0%				(10)
       
   112 	 \setlength{\emergencystretch}{3em}}%
       
   113 	{}
       
   114 
       
   115 % Currently the only public macro:
       
   116 % \MakeBibliography ... creates a reference section split subsections (default)
       
   117 % \MakeBibliography[nosplit] ... creates a one-piece reference section
       
   118 \newcommand{\MakeBibliography}[1][]{
       
   119 	% opt. arg (#1): optional argument "nosplit" to get a 1-piece bibliography
       
   120 	\clearpage
       
   121 	\ifthenelse{\equal{#1}{nosplit}}%
       
   122 		{% create a single bibliography with all entries:
       
   123 			%\printbibheading[heading=bibintoc,title={#2}]
       
   124 			\printbibheading[heading=bibintoc,title={\@bibtitle}]
       
   125 			\begin{bibhyphenation}	
       
   126 			\printbibliography[heading=noheader]
       
   127 			\end{bibhyphenation}
       
   128 		}
       
   129 		{% split the bibliography using the predefined categories:
       
   130 			%\printbibheading[heading=bibintoc,title={#2}]
       
   131 			\printbibheading[heading=bibintoc,title={\@bibtitle}]
       
   132 			\begin{bibhyphenation}
       
   133 			\printbibliography[filter=literature,heading=subbibintoc,title={\@bibtitleLiteratur}]
       
   134 			\printbibliography[filter=avmedia,heading=subbibintoc,title={\@bibtitleAvmedia}]
       
   135 			\printbibliography[filter=online,heading=subbibintoc,title={\@bibtitleOnline}]
       
   136 			\end{bibhyphenation}
       
   137 		}%
       
   138 }