LaTeX forum ⇒ BibTeX, biblatex and biberHow to customize the bib items with BibLaTeX? Topic is solved

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
CMP
Posts: 10
Joined: Thu Aug 22, 2019 8:33 pm

How to customize the bib items with BibLaTeX?

Postby CMP » Mon May 04, 2020 2:08 am

Hi Everyone,

I am here again with one more question.

I recently decided to switch with BibLaTeX from natbib reference management.
Therefore, I am a beginner learner with BibTe.
But as always I need some customization on the existing options. :)

I have attached an MWE herewith along with my concern at the end.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[english]{babel}
  4. \usepackage{enumerate}
  5. \usepackage{enumitem}
  6. \usepackage[
  7. style=numeric,
  8. url=false,
  9. doi=false,
  10. isbn=false
  11. ]{biblatex}
  12. \usepackage{hyperref,url}
  13. \usepackage{color}
  14. \usepackage[autostyle, english = american]{csquotes}
  15.  
  16. \addbibresource{BibRef.bib}
  17.  
  18. \newcommand{\red}{\color[rgb]{1,0,0}}
  19. \hypersetup{,colorlinks=true,allcolors=red}
  20.  
  21. \begin{document}
  22.  
  23. \begin{center}
  24. {\LARGE
  25. Solving NP-hard Problems
  26. }
  27.  
  28. \vspace{15mm}
  29.  
  30. {\large\sc
  31. Author\footnote[1]{
  32. Author, is an Assistant Professor in the Department of XYZ,
  33. XYZ University.
  34. ~~ {\em e-mail\/}: ~{\tt <!-- e --><a href="mailto:xyz@university.edu">xyz@university.edu</a><!-- e -->}}}
  35.  
  36. \vspace{1mm}
  37.  
  38. {\large\em XYZ University}
  39.  
  40. \vspace{15mm}
  41.  
  42. \end{center}
  43.  
  44. \vspace{3mm}
  45.  
  46. \begin{quote}
  47. {\bf\em Abstract}.
  48. XYZ.
  49.  
  50. \vspace{4mm}
  51.  
  52. \end{quote}
  53.  
  54. \section{Introduction}
  55.  
  56. About the paper!
  57.  
  58. \section{Main Results}
  59.  
  60. Main results!
  61. Markov Chains \cite{n97}
  62.  
  63. \section{Some Additional Results}
  64.  
  65. A graduate text in Mathematics \cite{ds14}
  66.  
  67. \section{Something More}
  68.  
  69. Probability and Measure Theory, \cite{MR1810041}.
  70.  
  71. \section{Additional Things}
  72.  
  73. Algebra, \cite{MR1034353}.
  74.  
  75. \section{Albert Einstein}
  76. Here we go \cite{ae05}.
  77.  
  78. \printbibliography
  79.  
  80. \newpage
  81.  
  82. \noindent
  83. {\red But the desired reference style is as below
  84. --
  85. everything plain and fields are separated by comma!}
  86.  
  87. \begin{enumerate}[label={[}\arabic*{]}]
  88. \item
  89. R.B. Ash, Probability and Measure Theory, second ed.,
  90. Academic Press, Burlington, MA, 2000.
  91.  
  92. \item
  93. A. Einstein, On the electrodynamics of moving bodies,
  94. Annalender Physik 322 (10) (1905) 891--921.
  95.  
  96. \item
  97. T.W. Hungerford, A counterexample in Galois theory,
  98. Amer. Math. Monthly 97 (1) (1990) 54--57.
  99.  
  100. \item
  101. J.R. Norris, Markov Chains,
  102. Cambridge University Press, 1997.
  103.  
  104. \item
  105. D.W. Stroock,
  106. An Introduction to Markov Processes,
  107. second ed.,
  108. Springer, Berlin, Heidelberg, 2014.
  109. \end{enumerate}
  110.  
  111. \noindent
  112. {\red
  113. So, I am wondering how is it possible to achieve this customized reference style
  114. with BibTaTeX?}
  115. \end{document}


The corresponding .bib file is as below:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. @book {MR1810041,
  2. AUTHOR = {Ash, Robert B.},
  3. TITLE = {Probability and Measure Theory},
  4. EDITION = {Second},
  5. PUBLISHER = {Academic Press, Burlington, MA},
  6. YEAR = {2000},
  7. PAGES = {xii+516},
  8. ISBN = {0-12-065202-1},
  9. MRCLASS = {28-01 (60-01)},
  10. MRNUMBER = {1810041},
  11. }
  12.  
  13. @article{ae05,
  14. AUTHOR = {Albert Einstein},
  15. TITLE = {On the electrodynamics of moving bodies},
  16. JOURNAL = {Annalen der Physik},
  17. VOLUME = {322},
  18. NUMBER = {10},
  19. PAGES = {891--921},
  20. YEAR = {1905},
  21. DOI = {http://dx.doi.org/10.1002/andp.19053221004},
  22. keywords = {physics},
  23. }
  24.  
  25. @article {MR1034353,
  26. AUTHOR = {Hungerford, Thomas W.},
  27. TITLE = {A counterexample in {G}alois theory},
  28. JOURNAL = {Amer. Math. Monthly},
  29. FJOURNAL = {American Mathematical Monthly},
  30. VOLUME = {97},
  31. YEAR = {1990},
  32. NUMBER = {1},
  33. PAGES = {54--57},
  34. ISSN = {0002-9890},
  35. MRCLASS = {12F10},
  36. MRNUMBER = {1034353},
  37. URL = {https://doi.org/10.2307/2324007},
  38. }
  39.  
  40. @book {n97,
  41. AUTHOR = {Norris, J. R.},
  42. TITLE = {Markov Chains},
  43. PUBLISHER = {Cambridge University Press},
  44. YEAR = {1997},
  45. DOI = {10.1017/CBO9780511810633},
  46. }
  47.  
  48. @book {ds14,
  49. AUTHOR = {Stroock, Daniel W.},
  50. TITLE = {An Introduction to Markov Processes},
  51. PUBLISHER = {Springer, Berlin, Heidelberg},
  52. EDITION = {Second},
  53. YEAR = {2014},
  54. ISBN = {978-3642405228},
  55. PAGES = {IX+275},
  56. DOI = {10.1007/978-3-642-40523-5},
  57. }


Then we get the following Reference listing which I do not want.

[img]
UnWantedRef.png
[/img]

But what I wanted is the following.

[img]
WantedRef.png
[/img]

Any help would greatly be appreciated.
Attachments
WantedRef.png
WantedRef.png (59.02 KiB) Viewed 306 times
UnWantedRef.png
UnWantedRef.png (44.13 KiB) Viewed 306 times

Bartman
Posts: 113
Joined: Fri Jan 03, 2020 2:39 pm

Postby Bartman » Mon May 11, 2020 7:53 pm

From your description it is relatively clear what you have and what you want. Thanks for that.

Since i am not a biblatex professional, i wanted to wait and see if someone has a solution for you. Maybe my suggestion can help you, if you have not yet been able to develop a solution.

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \begin{filecontents}{\jobname.bib}
  2. @book {MR1810041,
  3. AUTHOR = {Ash, Robert B.},
  4. TITLE = {Probability and Measure Theory},
  5. EDITION = {2},
  6. PUBLISHER = {Academic Press, Burlington, MA},
  7. DATE = {2000},
  8. PAGES = {xii+516},
  9. ISBN = {0-12-065202-1},
  10. MRCLASS = {28-01 (60-01)},
  11. MRNUMBER = {1810041},
  12. }
  13.  
  14. @article{ae05,
  15. AUTHOR = {Albert Einstein},
  16. TITLE = {On the electrodynamics of moving bodies},
  17. JOURNALTITLE = {Annalen der Physik},
  18. VOLUME = {322},
  19. NUMBER = {10},
  20. PAGES = {891--921},
  21. DATE = {1905},
  22. DOI = {http://dx.doi.org/10.1002/andp.19053221004},
  23. keywords = {physics},
  24. }
  25.  
  26. @article {MR1034353,
  27. AUTHOR = {Hungerford, Thomas W.},
  28. TITLE = {A counterexample in {G}alois theory},
  29. JOURNALTITLE = {Amer. Math. Monthly},
  30. FJOURNAL = {American Mathematical Monthly},
  31. VOLUME = {97},
  32. DATE = {1990},
  33. NUMBER = {1},
  34. PAGES = {54--57},
  35. ISSN = {0002-9890},
  36. MRCLASS = {12F10},
  37. MRNUMBER = {1034353},
  38. URL = {https://doi.org/10.2307/2324007},
  39. }
  40.  
  41. @book{n97,
  42. AUTHOR = {Norris, J. R.},
  43. TITLE = {Markov Chains},
  44. PUBLISHER = {Cambridge University Press},
  45. DATE = {1997},
  46. DOI = {10.1017/CBO9780511810633},
  47. }
  48.  
  49. @book{ds14,
  50. AUTHOR = {Stroock, Daniel W.},
  51. TITLE = {An Introduction to Markov Processes},
  52. PUBLISHER = {Springer},
  53. LOCATION = {Berlin and Heidelberg},
  54. EDITION = {2},
  55. DATE = {2014},
  56. ISBN = {978-3642405228},
  57. PAGES = {IX+275},
  58. DOI = {10.1007/978-3-642-40523-5},
  59. }
  60. \end{filecontents}
  61.  
  62. \documentclass[12pt]{article}
  63. \usepackage[T1]{fontenc}
  64. \usepackage{lmodern}
  65. \usepackage[english]{babel}
  66. \usepackage[
  67. % style=numeric,% default
  68. url=false,
  69. doi=false,
  70. isbn=false,
  71. giveninits
  72. ]{biblatex}
  73. \usepackage{xcolor}
  74. \usepackage[
  75. autostyle%,
  76. % english = american% not necessary
  77. ]{csquotes}
  78. \usepackage{xpatch}% for \xpatchbibdriver
  79. \usepackage{fmtcount}% for \ordinalstringnum
  80. \usepackage{hyperref}
  81.  
  82. \addbibresource{\jobname.bib}
  83. \addbibresource{biblatex-examples.bib}
  84.  
  85. \hypersetup{colorlinks=true,allcolors=red}
  86.  
  87. % biblatex.def
  88. \DeclareFieldFormat*{title}{#1}
  89. \DeclareFieldFormat{journaltitle}{#1}
  90. \DeclareFieldFormat{pages}{#1}
  91. \DeclareFieldFormat{edition}{%
  92. \ifinteger{#1}
  93. {\ordinalstringnum{#1}~\bibstring{edition}}
  94. {#1\isdot}}
  95.  
  96. \DeclareDelimAlias{finalnamedelim}{multinamedelim}
  97. \DeclareDelimAlias{finallistdelim}{multilistdelim}
  98.  
  99. \renewcommand*{\newunitpunct}{\addcomma\space}
  100.  
  101. \renewbibmacro{in:}{%
  102. \ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
  103.  
  104. \renewcommand*{\bibpagespunct}{\addspace}
  105.  
  106. % standard.bbx
  107. \renewbibmacro*{volume+number+eid}{%
  108. \printfield{volume}%
  109. % \setunit*{\adddot}%
  110. \setunit*{\addspace}%
  111. \printfield[parens]{number}%
  112. \setunit{\addcomma\space}%
  113. \printfield{eid}}
  114.  
  115. \renewbibmacro*{publisher+location+date}{%
  116. \printlist{publisher}%
  117. \setunit*{\addcomma\space}%
  118. % \iflistundef{publisher}
  119. % {\setunit*{\addcomma\space}}
  120. % {\setunit*{\addcolon\space}}%
  121. \printlist{location}%
  122. \setunit*{\addcomma\space}%
  123. \usebibmacro{date}%
  124. \newunit}
  125.  
  126. \xpatchbibdriver{book}
  127. {\newunit\newblock
  128. \usebibmacro{chapter+pages}}
  129. {}
  130. {}{\typeout{failed to patch bibmacro book to remove page macro}}
  131.  
  132.  
  133. % article.cls
  134. \renewenvironment{abstract}{%
  135. \quote
  136. {\bfseries\itshape\abstractname\par}%
  137. }
  138. {\endquote}
  139.  
  140. \begin{document}
  141. \begin{center}
  142. {\LARGE Solving NP-hard Problems\par}
  143.  
  144. \vspace{15mm}
  145. {
  146. \large\scshape
  147. Author\footnote{%
  148. Author, is an Assistant Professor in the Department of XYZ,
  149. XYZ University.\\\emph{e-mail\/}:~\url{xyz@university.edu}%
  150. }
  151. \par
  152. }
  153.  
  154. \vspace{1mm}
  155. \large\emph{XYZ University}
  156. \end{center}
  157.  
  158. \vspace{18mm}
  159.  
  160. \begin{abstract}
  161. XYZ.
  162. \end{abstract}
  163.  
  164. \vspace{4mm}
  165.  
  166. \section{Introduction}
  167. About the paper!
  168.  
  169. \section{Main Results}
  170. Main results!
  171. Markov Chains \autocite{n97}
  172.  
  173. \section{Some Additional Results}
  174. A graduate text in Mathematics \autocite{ds14}
  175.  
  176. \section{Something More}
  177. Probability and Measure Theory, \autocite{MR1810041}.
  178.  
  179. \section{Additional Things}
  180. Algebra, \autocite{MR1034353}.
  181.  
  182. \section{Albert Einstein}
  183. Here we go \autocite{ae05}.
  184.  
  185. \section{\LaTeX}
  186. \autocite{companion}
  187.  
  188. \printbibliography
  189. \end{document}

CMP
Posts: 10
Joined: Thu Aug 22, 2019 8:33 pm

Postby CMP » Thu Sep 17, 2020 4:19 am

Thank you Bartman!

That helps a lot!


Return to “BibTeX, biblatex and biber”

Who is online

Users browsing this forum: No registered users and 2 guests