Guest User

Untitled

a guest
Jan 23rd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.74 KB | None | 0 0
  1. documentclass{scrbook}
  2.  
  3. usepackage{filecontents}
  4. begin{filecontents}{main.bib}
  5. @ARTICLE{travis,
  6. author = {Brehm, M. and Kirchner, B.},
  7. title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular
  8. Dynamics Trajectories},
  9. journal = {J. Chem. Inf. Model.},
  10. year = {2011},
  11. volume = {51 (8)},
  12. pages = {2007-2023},
  13. owner = {Brehministrator},
  14. timestamp = {2011.11.27}
  15. },
  16. @ARTICLE{welton2001,
  17. author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},
  18. title = {Molecular states of water in room temperature ionic liquids},
  19. journal = {Phys. Chem. Chem. Phys.},
  20. year = {2001},
  21. volume = {3},
  22. pages = {5192-5200},
  23. owner = {Brehministrator},
  24. timestamp = {2011.12.11}
  25. }
  26. }
  27. end{filecontents}
  28.  
  29. usepackage[square, sort&compress, super, comma]{natbib}
  30. usepackage[labeled,resetlabels]{multibib}
  31.  
  32. newcites{O}{Own Publications}
  33.  
  34. begin{document}
  35. chapter{Introduction}
  36.  
  37. Citing my own literatureciteO{travis}.
  38. Citing other people's literaturecite{welton2001}.
  39.  
  40. appendix
  41. bibliographystyle{plain}
  42. bibliographystyleO{plain}
  43. bibliography{main}
  44. bibliographyO{main}
  45.  
  46. end{document}
  47.  
  48. documentclass{scrbook}
  49.  
  50. usepackage{filecontents}
  51. begin{filecontents}{main.bib}
  52. @ARTICLE{travis,
  53. author = {Brehm, M. and Kirchner, B.},
  54. title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular
  55. Dynamics Trajectories},
  56. journal = {J. Chem. Inf. Model.},
  57. year = {2011},
  58. volume = {51 (8)},
  59. pages = {2007-2023},
  60. owner = {Brehministrator},
  61. timestamp = {2011.11.27}
  62. },
  63. @ARTICLE{travis1,
  64. author = {Brehm, M. and Kirchner, B.},
  65. title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular
  66. Dynamics Trajectories},
  67. journal = {J. Chem. Inf. Model.},
  68. year = {2011},
  69. volume = {51 (8)},
  70. pages = {2007-2023},
  71. owner = {Brehministrator},
  72. timestamp = {2011.11.27}
  73. },
  74. @ARTICLE{travis2,
  75. author = {Brehm, M. and Kirchner, B.},
  76. title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular
  77. Dynamics Trajectories},
  78. journal = {J. Chem. Inf. Model.},
  79. year = {2011},
  80. volume = {51 (8)},
  81. pages = {2007-2023},
  82. owner = {Brehministrator},
  83. timestamp = {2011.11.27}
  84. },
  85. @ARTICLE{travis3,
  86. author = {Brehm, M. and Kirchner, B.},
  87. title = {TRAVIS - A free Analyzer and Visualizer for Monte Carlo and Molecular
  88. Dynamics Trajectories},
  89. journal = {J. Chem. Inf. Model.},
  90. year = {2011},
  91. volume = {51 (8)},
  92. pages = {2007-2023},
  93. owner = {Brehministrator},
  94. timestamp = {2011.11.27}
  95. },
  96. @ARTICLE{welton2001,
  97. author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},
  98. title = {Molecular states of water in room temperature ionic liquids},
  99. journal = {Phys. Chem. Chem. Phys.},
  100. year = {2001},
  101. volume = {3},
  102. pages = {5192-5200},
  103. owner = {Brehministrator},
  104. timestamp = {2011.12.11}
  105. }
  106. @ARTICLE{welton20011,
  107. author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},
  108. title = {Molecular states of water in room temperature ionic liquids},
  109. journal = {Phys. Chem. Chem. Phys.},
  110. year = {2001},
  111. volume = {3},
  112. pages = {5192-5200},
  113. owner = {Brehministrator},
  114. timestamp = {2011.12.11}
  115. }
  116. @ARTICLE{welton20012,
  117. author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},
  118. title = {Molecular states of water in room temperature ionic liquids},
  119. journal = {Phys. Chem. Chem. Phys.},
  120. year = {2001},
  121. volume = {3},
  122. pages = {5192-5200},
  123. owner = {Brehministrator},
  124. timestamp = {2011.12.11}
  125. }
  126. @ARTICLE{welton20013,
  127. author = {L. Cammarata and S. G. Kazarian and P. A. Salter and T. Welton},
  128. title = {Molecular states of water in room temperature ionic liquids},
  129. journal = {Phys. Chem. Chem. Phys.},
  130. year = {2001},
  131. volume = {3},
  132. pages = {5192-5200},
  133. owner = {Brehministrator},
  134. timestamp = {2011.12.11}
  135. }
  136. }
  137. end{filecontents}
  138.  
  139. usepackage[square,sort&compress,super,comma]{natbib} %%Comment on first run
  140.  
  141. usepackage[labeled,resetlabels]{multibib}
  142.  
  143. newcites{O}{Own Publications}
  144.  
  145. makeatletter
  146. AtBeginDocument{@ifpackageloaded{natbib}{%
  147. expandafterDeclareRobustCommandcsname cite@suffixendcsname
  148. {begingroupletNAT@ctypez@NAT@partrueNAT@swatrue
  149. @ifstar{NAT@fulltrueNAT@cites}{NAT@fullfalsecsname NAT@cites@suffixendcsname}}
  150. expandafternewcommandcsname NAT@cites@suffixendcsname{@ifnextchar [{csname NAT@@citetp@suffixendcsname}{%
  151. ifNAT@numberselse
  152. NAT@swafalse
  153. fi
  154. csname NAT@@citetp@suffixendcsname[]}}
  155. expandafternewcommandcsname NAT@citetp@suffixendcsname{@ifnextchar[{csname NAT@@citetp@suffixendcsname}{csname NAT@@citetp@suffixendcsname[]}}
  156. expandafternewcommandcsname NAT@@citetp@suffixendcsname{}
  157. expandafterdefcsname NAT@@citetp@suffixendcsname[#1]{@ifnextchar[{csname @citex@suffixendcsname[#1]}{csname @citex@suffixendcsname[][#1]}}
  158. expandafternewcommandcsname NAT@set@cites@suffixendcsname{%
  159. ifNAT@numbers
  160. ifNAT@super let@citeNAT@citesuper
  161. defNAT@mbox##1{unskipnobreaktextsuperscript{##1}}%
  162. letciteyearpar=citeyear
  163. letNAT@spacerelax
  164. defNAT@super@kern{kernp@}%
  165. else
  166. letNAT@mbox=mbox
  167. let@citeNAT@citenum
  168. letNAT@spaceNAT@spacechar
  169. letNAT@super@kernrelax
  170. fi
  171. expandafterletcsname @citex@suffixexpandafterendcsnamecsname NAT@citexnum@suffixendcsname
  172. let@biblabelNAT@biblabelnum
  173. let@bibsetupNAT@bibsetnum
  174. renewcommandNAT@idxtxt{NAT@nameNAT@spacecharNAT@openNAT@numNAT@close}%
  175. defnatexlab##1{}%
  176. defNAT@penalty{penalty@m}%
  177. else
  178. let@citeNAT@cite
  179. let@citexNAT@citex
  180. let@biblabelNAT@biblabel
  181. let@bibsetupNAT@bibsetup
  182. letNAT@spaceNAT@spacechar
  183. letNAT@penalty@empty
  184. renewcommandNAT@idxtxt{NAT@nameNAT@spacecharNAT@openNAT@dateNAT@close}%
  185. defnatexlab##1{##1}%
  186. fi}
  187. expandafternewcommandcsname NAT@sep@suffixendcsname{,@suffix}
  188. expandafterdefcsname NAT@separator@suffixendcsname{csname NAT@sep@suffixendcsnameNAT@penalty}%
  189. expandafterdefcsname NAT@def@citea@suffixendcsname{def@citea{csname NAT@separator@suffixendcsnameNAT@space}}%
  190. expandafterdefcsname NAT@def@citea@space@suffixendcsname{def@citea{csname NAT@separator@suffixendcsnameNAT@spacechar}}%
  191. expandafterdefcsname NAT@def@citea@close@suffixendcsname{def@citea{NAT@@closecsname NAT@separator@suffixendcsnameNAT@space}}%
  192. expandafterdefcsname NAT@def@citea@box@suffixendcsname{def@citea{NAT@mbox{NAT@@close}csname NAT@separator@suffixendcsnameNAT@spacechar}}%
  193. expandafterdefcsname NAT@citexnum@suffixendcsname[#1][#2]#3{%
  194. NAT@reset@parser
  195. NAT@sort@cites{#3}%
  196. NAT@reset@citea
  197. @cite{defNAT@num{-1}letNAT@last@yrrelaxletNAT@nm@empty
  198. @for@citeb:=NAT@cite@listdo
  199. {@safe@activestrue
  200. edef@citeb{expandafter@firstofone@citeb@empty}%
  201. @safe@activesfalse
  202. @ifundefined{b@@citeb@extra@b@citeb}{%
  203. {reset@fontbfseries?}
  204. NAT@citeundefinedPackageWarning{natbib}%
  205. {Citation `@citeb' on page thepage space undefined}}%
  206. {letNAT@last@numNAT@numletNAT@last@nmNAT@nm
  207. NAT@parse{@citeb}%
  208. ifNAT@longnames@ifundefined{bv@@citeb@extra@b@citeb}{%
  209. letNAT@name=NAT@all@names
  210. global@namedef{bv@@citeb@extra@b@citeb}{}}{}%
  211. fi
  212. ifNAT@fullletNAT@nmNAT@all@nameselse
  213. letNAT@nmNAT@namefi
  214. ifNAT@swa
  215. @ifnum{NAT@ctype>@ne}{%
  216. @citea
  217. NAT@hyper@{@ifnum{NAT@ctype=tw@}{NAT@test{NAT@ctype}}{NAT@alias}}%
  218. }{%
  219. @ifnum{NAT@cmprs>z@}{%
  220. NAT@ifcat@numNAT@num
  221. {letNAT@nm=NAT@num}%
  222. {defNAT@nm{-2}}%
  223. NAT@ifcat@numNAT@last@num
  224. {@tempcnta=NAT@last@numrelax}%
  225. {@suffix@tempcntam@ne}%
  226. @ifnum{NAT@nm=@tempcnta}{%
  227. @ifnum{NAT@merge>@ne}{}{NAT@last@yr@mbox}%
  228. }{%
  229. advance@tempcnta by@ne
  230. @ifnum{NAT@nm=@tempcnta}{%
  231. ifxNAT@last@yrrelax
  232. def@NAT@last@yr{@citea}%
  233. else
  234. def@NAT@last@yr{--NAT@penalty@suffix}%
  235. fi
  236. }{%
  237. NAT@last@yr@mbox
  238. }%
  239. }%
  240. }{%
  241. @tempswatrue
  242. @ifnum{NAT@merge>@ne}{@ifnum{NAT@last@num=NAT@numrelax}{@tempswafalse}{}}{}%
  243. if@tempswaNAT@citea@mboxfi
  244. }%
  245. }%
  246. csname NAT@def@citea@suffixendcsname
  247. else
  248. ifcaseNAT@ctype
  249. ifxNAT@last@nmNAT@nm NAT@yrsepNAT@penaltyNAT@spaceelse
  250. @citea NAT@test{@ne}NAT@spacecharNAT@mbox{NAT@super@kernNAT@@open}%
  251. fi
  252. if*#1*else#1NAT@spacecharfi
  253. NAT@mbox{NAT@hyper@{{citenumfont{NAT@num}}}}%
  254. csname NAT@def@citea@box@suffixendcsname
  255. or
  256. csname NAT@hyper@citea@space@suffixendcsname{NAT@test{NAT@ctype}}%
  257. or
  258. csname NAT@hyper@citea@space@suffixendcsname{NAT@test{NAT@ctype}}%
  259. or
  260. csname NAT@hyper@citea@space@suffixendcsnameNAT@alias
  261. fi
  262. fi
  263. }%
  264. }%
  265. @ifnum{NAT@cmprs>z@}{NAT@last@yr}{}%
  266. ifNAT@swaelse
  267. @ifnum{NAT@ctype=z@}{%
  268. if*#2*elseNAT@cmt#2fi
  269. }{}%
  270. NAT@mbox{NAT@@close}%
  271. fi
  272. }{#1}{#2}%
  273. }%
  274. csname NAT@set@cites@suffixendcsname
  275. }{}
  276. defmycite{csname cite@suffixendcsname}
  277. }%
  278. makeatother
  279.  
  280. begin{document}
  281. chapter{Introduction}
  282.  
  283. Citing my own literaturemycite{travis} andmycite{travis,travis3} andmycite[p.~1]{travis,travis3,travis2,travis1} andmycite{travis,travis3,travis1}
  284. Citing other people's literaturecite{welton2001} andcite{welton2001,welton20013} andcite[p.~1]{welton2001,welton20013,welton20012,welton20011} andcite{welton2001,welton20013,welton20011}.
  285.  
  286. appendix
  287. bibliographystyle{plain}
  288. bibliographystyleO{plain}
  289. bibliography{main}
  290. bibliographyO{main}
  291.  
  292. end{document}
  293.  
  294. usepackage{xparse}
  295. letoriCiteOciteO
  296.  
  297. %% The O{} in this re-definition means "an optional argument
  298. %% with an empty default value". It is not related to the
  299. %% "O" prefix in the OP's example.
  300. RenewDocumentCommand{citeO}{O{} O{} m}{%
  301. %% The "O" here *is* the prefix as required by the OP's example
  302. renewcommand{citenumfont}[1]{O##1}%
  303. oriCiteO[#1][#2]{#3}%
  304. renewcommand{citenumfont}[1]{##1}%
  305. }
Add Comment
Please, Sign In to add comment