Guest User

Untitled

a guest
Jan 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.70 KB | None | 0 0
  1. documentclass{article}
  2. usepackage[T1]{fontenc}
  3. usepackage[utf8]{inputenc}
  4. usepackage[ngerman]{babel}
  5. usepackage[babel,german=quotes]{csquotes}
  6. usepackage[backend=biber,style=numeric-comp,mcite,subentry,sorting=nty,sortsets=true,backref=false]{biblatex}
  7.  
  8. usepackage{filecontents}
  9. begin{filecontents*}{jobname.bib}
  10. @Book{fish:drugs,
  11. mainsubtitle = {Drugs and Society},
  12. year = {2006},
  13. editor = {Jefferson M. Fish},
  14. maintitle= {U.S.~public policy},
  15. publisher= {Rowman & Littlefield Publishers, Inc},
  16. location = {Lanham, Maryland},
  17. isbn = {0-7425-4245-9},
  18. sortname = {Jefferson M. Fish},
  19. sorttitle= {U.S. public policy Drugs and Society},
  20. options = {dataonly},
  21. }
  22. @Set{set:fish:drugs,
  23. entryset = {fish:drugs:gable:alt,fish:drugs:cleveland:use,fish:drugs:evans:intro},
  24. options = {multivolumehead=fish:drugs},
  25. }
  26. @Inbook{fish:drugs:evans:intro,
  27. crossref = {fish:drugs},
  28. author = {Richard M. Evans and Stanley Neustadter},
  29. chapter= {6},
  30. title = {Legalization: An Introduction},
  31. pages = {129-148},
  32. sorttitle = {06 Legalization: An Introduction},
  33. options= {dataonly},
  34. }
  35. @Inbook{fish:drugs:cleveland:use,
  36. crossref = {fish:drugs},
  37. author = {Mary M. Cleveland},
  38. chapter= {9a},
  39. title = {Use, 'Abuse', Adverse Health Effects, and Addiction},
  40. pages = {197-200},
  41. sorttitle = {09 Use, Abuse, Adverse Health Effects, and Addiction},
  42. options= {dataonly},
  43. }
  44. @Inbook{fish:drugs:gable:alt,
  45. crossref = {fish:drugs},
  46. author = {Robert S. Gable},
  47. chapter= {7},
  48. title = {Acute Toxicity of Drugs versus Regulatory Status},
  49. pages = {149-161},
  50. sorttitle = {07 Acute Toxicity of Drugs versus Regulatory Status},
  51. }
  52. @Book{A,
  53. author = {René Goscinny and Albert Uderzo},
  54. maintitle = {Asterix und Obelix},
  55. year = {1959--2018},
  56. publisher = {Dargaud},
  57. location= {Paris},
  58. volumes = {99},
  59. options = {dataonly},
  60. }
  61. @Set{set:A,
  62. entryset= {A:V1,A:V2,A:V3,A:V4,A:V5,A:V6},
  63. options = {multivolumehead=A},
  64. }
  65. @Book{A:V1,
  66. crossref= {A},
  67. title = {Asterix der Gallier},
  68. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 01},
  69. year = {1959},
  70. isbn = {1234567890123},
  71. volume = {1},
  72. }
  73. @Book{A:V2,
  74. crossref= {A},
  75. title = {Asterix und Kleopatra},
  76. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 02},
  77. year = {1968},
  78. isbn = {2345678901234},
  79. volume = {2},
  80. }
  81. @Book{A:V3,
  82. crossref= {A},
  83. title = {Asterix als Gladiator},
  84. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 03},
  85. year = {1969},
  86. isbn = {3456789012345},
  87. volume = {3},
  88. }
  89. @Book{A:V4,
  90. crossref= {A},
  91. title = {Der Kampf der Häuptlinge},
  92. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 04},
  93. year = {1969},
  94. isbn = {4567890123456},
  95. volume = {4},
  96. }
  97. @Book{A:V5,
  98. crossref= {A},
  99. title = {Die goldene Sichel},
  100. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 05},
  101. year = {1970},
  102. isbn = {5678901234567},
  103. volume = {5},
  104. }
  105. @Book{A:V6,
  106. crossref= {A},
  107. title = {Tour de France},
  108. sorttitle = {Goscinny Rene Uderzo Albert Asterix und Obelix 06},
  109. year = {1970},
  110. isbn = {6789012345678},
  111. volume = {6},
  112. }
  113. @Book{DHS:base,
  114. editor= {{Deutsche Hauptstelle für Suchtfragen e.~V.}},
  115. sortname = {{Deutsche Hauptstelle für Suchtfragen}},
  116. year = {2017},
  117. url = {www.dhs.de},
  118. urldate = {2018-04-30},
  119. maintitle = {Suchtmedizinische Reihe},
  120. options = {dataonly},
  121. }
  122. @Book{DHS:nik,
  123. crossref = {DHS:base},
  124. title = {Tabakabhängigkeit},
  125. sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 01},
  126. volume= {1},
  127. isbn = {978-3-937587-00-4},
  128. }
  129. @Book{DHS:alk,
  130. crossref = {DHS:base},
  131. title = {Alkoholabhängigkeit},
  132. sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 02},
  133. volume= {2},
  134. isbn = {978-3-937587-01-1},
  135. }
  136. @Book{DHS:drogen,
  137. crossref = {DHS:base},
  138. title = {Drogenabhängigkeit},
  139. sorttitle = {Deutsche Hauptstelle für Suchtfragen Suchtmedizinische Reihe 04},
  140. volume= {4},
  141. isbn = {978-3-937587-03-5},
  142. }
  143. @Set{DHS:SMR,
  144. crossref = {DHS:base},
  145. entryset = {DHS:alk,DHS:nik,DHS:drogen},
  146. options = {multivolumehead=DHS:base},
  147. }
  148. end{filecontents*}
  149.  
  150. newtoggle{adapted}togglefalse{adapted}
  151.  
  152. makeatletter
  153. % compress set member citations
  154. % code by moewe
  155. % https://tex.stackexchange.com/questions/416444/biber-and-biblatex-reference-to-multiple-subentries
  156. % https://tex.stackexchange.com/questions/470391/compress-citation-of-multiple-set-members-in-biblatex
  157. newcounter{cbx@tempcntc}
  158. newcounter{cbx@tempcntd}
  159. renewbibmacro*{cite:init}{%
  160. globalboolfalse{cbx:parens}%
  161. globalundefcbx@lasthash
  162. globalundefcbx@lastnumber
  163. globalundefcbx@lastprefix
  164. globalundefcbx@lastcount
  165. setcounter{cbx@tempcnta}{0}%
  166. setcounter{cbx@tempcntb}{-2}%
  167. setcounter{cbx@tempcntc}{0}%
  168. setcounter{cbx@tempcntd}{-1}}
  169.  
  170. renewbibmacro*{cite:comp:inset}{%
  171. iftoggle{adapted}% new
  172. {ifdef{cbx@lastnumber}
  173. {iffieldequals{labelnumber}{cbx@lastnumber}
  174. {}% same label number
  175. {% label number changed
  176. usebibmacro{cite:dump}%
  177. ifnumgreater{value{cbx@tempcntb}}{-1}
  178. {multicitedelim%
  179. usebibmacro{cite:init}}% cite reset
  180. {}}}%%%<- terminate previous entry
  181. {}}
  182. {}% end new
  183. stepcounter{cbx@tempcntd}%
  184. ifboolexpr{
  185. (( test {iffieldundef{labelprefix}} and test {ifundefcbx@lastprefix} )
  186. or
  187. test {iffieldequals{labelprefix}{cbx@lastprefix}})
  188. and test {iffieldequals{labelnumber}{cbx@lastnumber}}
  189. }
  190. {}
  191. {setcounter{cbx@tempcntc}{0}%
  192. usebibmacro{cite:dump}%
  193. ifnumgreater{value{cbx@tempcntb}}{-1}
  194. {multicitedelim}
  195. {}}%
  196. printtext[bibhyperref]{%
  197. ifboolexpr{
  198. (( test {iffieldundef{labelprefix}} and test {ifundefcbx@lastprefix} )
  199. or
  200. test {iffieldequals{labelprefix}{cbx@lastprefix}})
  201. and test {iffieldequals{labelnumber}{cbx@lastnumber}}
  202. }
  203. {}
  204. {printfield{labelnumber}%
  205. savefield{labelnumber}{cbx@lastnumber}}%
  206. ifnumequal{thefield{entrysetcount}}{value{cbx@tempcntd}}
  207. {savefield{entrykey}{cbx@lastkey}%
  208. savefield{entrysetcount}{cbx@lastcount}%
  209. stepcounter{cbx@tempcntc}}
  210. {usebibmacro{cite:dump}%
  211. ifnumgreater{value{cbx@tempcntd}}{0}
  212. {multicitedelim}
  213. {}%
  214. printfield{entrysetcount}}}%
  215. setcounter{cbx@tempcntd}{thefield{entrysetcount}}%
  216. setcounter{cbx@tempcntb}{-1}}
  217.  
  218. renewbibmacro*{cite:dump}{%
  219. ifnumgreater{value{cbx@tempcntc}}{0}
  220. {ifnumgreater{value{cbx@tempcntc}}{1}
  221. {bibrangedash}
  222. {multicitedelim}%
  223. bibhyperref[cbx@lastkey]{%
  224. printtext[entrysetcount]{cbx@lastcount}}}
  225. {}%
  226. setcounter{cbx@tempcntc}{0}%
  227. ifnumgreater{value{cbx@tempcnta}}{0}
  228. {ifnumgreater{value{cbx@tempcnta}}{1}
  229. {bibrangedash}
  230. {multicitedelim}%
  231. bibhyperref[cbx@lastkey]{%
  232. ifdefcbx@lastprefix
  233. {printtext[labelprefix]{cbx@lastprefix}}
  234. {}%
  235. printtext[labelnumber]{cbx@lastnumber}}}
  236. {}%
  237. setcounter{cbx@tempcnta}{0}%
  238. globalundefcbx@lastprefix}
  239. makeatother
  240.  
  241. addbibresource{jobname.bib}
  242.  
  243. begin{document}parindent=0ptrelaxparskip=2exrelax
  244. nocite{*}
  245.  
  246. %Clevelandsupercite{fish:drugs:cleveland:use} writes some hard stuff.
  247. Asterix loves fish.supercite{fish:drugs:evans:intro,fish:drugs:gable:alt,fish:drugs:cleveland:use}
  248.  
  249. Obelix loves drugs.supercite{DHS:nik,DHS:alk,DHS:drogen}
  250.  
  251. Idefix loves Asterix, rotten fish and drugs.supercite{DHS:nik,DHS:alk,DHS:drogen,A:V1,A:V3,A:V4,A:V5,fish:drugs:evans:intro,fish:drugs:gable:alt,fish:drugs:cleveland:use}
  252.  
  253. toggletrue{adapted}
  254.  
  255. Years ago Idefix loved Asterix, no drugs and good fish.supercite{DHS:nik,DHS:alk,DHS:drogen,A:V1,A:V3,A:V4,A:V5,fish:drugs:evans:intro,fish:drugs:gable:alt,fish:drugs:cleveland:use} These times have been betterdots
  256.  
  257. printbibliography
  258. end{document}
Add Comment
Please, Sign In to add comment