LaTeX forum ⇒ Text FormattingSpecial Modifications to Bibliography Style Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Special Modifications to Bibliography Style

Postby LavaTyper » Thu Oct 24, 2013 3:39 am

Greetings.

For my project, I am using BibTeX and the apacite package. Everything works fine, and references format as they all should.

But I am currently at the stage in my project where I need to introduce custom modifications, and I have no idea how to make these modifications in LaTeX:

  1. Within each entry, I need single-spacing.
  2. Between each entry, I need double-spacing.
  3. Two-line bibliography entries cannot be broken up into separate pages.

How do I make these modifications?

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Oct 24, 2013 10:17 am

Hi,

it's much easier to help when having some code. Please prepare a self-contained and minimal working example.

Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Postby LavaTyper » Sat Oct 26, 2013 9:50 pm

How am I supposed to provide a minimum working example if I have no idea how to make it work in the first place?

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Oct 27, 2013 11:39 am

How am i supposed to help without knowing your setup? Document class, packages related to the problem, etc. Please follow the link in my first post and try your best.

Best regards
Johannes


Isn't
I have no idea how to make it work in the first place
kind of the opposite of
Everything works fine, and references format as they all should.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Postby LavaTyper » Wed Nov 06, 2013 8:50 pm

Johannes_B wrote:Isn't
I have no idea how to make it work in the first place
kind of the opposite of
Everything works fine, and references format as they all should.


Huh? No it's not the opposite. Why are you accusing me by taking my posts out of context? The first quote that you quoted was from my second post, where the "it" was about the three-modification configuration. The second quote that you quoted was from an entirely different post altogether, where everything up to that point has and is still working fine.

As I just told you, I can't make a minimal working example (following the link in your post) because I'm not knowledgeable enough to know what code needs to be in place to make the specific modifications.

So, I can't provide a minimal working example of the thing which I can get to work.

But if you give me a moment I can try to provide a minimal modifiable example, which you can modify.

Hang on...
Last edited by localghost on Wed Nov 06, 2013 9:12 pm, edited 1 time in total.
Reason: Offensive language edited out.

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Nov 06, 2013 8:52 pm

Well, i am happy that you followed the link. Thank you for that. Give your best and someone will (most likely) be able to help you.

Understanding written text like this isn't always trivial. Sorry if you felt misunderstood.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Postby LavaTyper » Wed Nov 06, 2013 9:18 pm

Alright here is what I have in my document.

  1. \documentclass[12pt]{article}
  2.  
  3. \linespread{2}
  4. \usepackage{apacite}
  5.  
  6. \begin{document}
  7.  
  8. \section{Another world}
  9.  
  10. Many textbooks exist \cite{ShipingOutWhere, Shu1980, SnowEssentials, Zambaba1, SnowOrigins, BeeVomit, WFartmann, ChaseMax, Fix2004, Lewiston, HTwCentry, Schx1, BenDoverReturns, JJCreeper, FreeMe, Lini}.
  11.  
  12. \newpage
  13.  
  14. \bibliographystyle{apacite}
  15. \bibliography{references}
  16.  
  17. \end{document}


And here is what I have i my references.bib file:

  1. @book{ShipingOutWhere,
  2. author = "H. Shipping",
  3. title = "Expert Deliveries",
  4. edition = "",
  5. publisher = "Silly Dogcourt",
  6. address = "Boston",
  7. year = "1978"}
  8.  
  9. @book{Shu1980,
  10. author = "D. F. Shu and J. S. Mikey",
  11. title = "Introduction to Small Packages",
  12. edition = "",
  13. publisher = "Lackluster University",
  14. address = "New York",
  15. year = "1980"}
  16.  
  17. @book{SnowEssentials,
  18. author = "I. P. Snow",
  19. title = "The Nighttime Extortionist",
  20. edition = "3",
  21. publisher = "Bucksport Company",
  22. address = "San Francisco",
  23. year = "1990"}
  24.  
  25. @book{Zambaba1,
  26. author = "T. Zambaba",
  27. title = "Mega Laughanormous",
  28. edition = "2",
  29. publisher = "The Mafia",
  30. address = "Hoboken, New Jersey",
  31. year = "1997"}
  32.  
  33. @book{SnowOrigins,
  34. author = "I. P. Snow",
  35. title = "The Nighttime Extortionist Microwaves a Light Bulb",
  36. edition = "9",
  37. publisher = "Bucksport Company",
  38. address = "San Francisco",
  39. year = "1999"}
  40.  
  41. @book{BeeVomit,
  42. author = "E. T. BeeVomit",
  43. title = "The Honeycomb Matrix",
  44. edition = "",
  45. publisher = "Cambridge University Press",
  46. address = "",
  47. year = "1999"}
  48.  
  49. @book{WFartmann,
  50. author = "W. Fartmann",
  51. title = "Booze \& Plans 4 Tomorrow",
  52. edition = "6",
  53. publisher = "Dub Pub",
  54. address = "Miami, Florida",
  55. year = "1999"}
  56.  
  57. @book{ChaseMax,
  58. author = "C. E. Max and J. E. Orive",
  59. title = "Myths about the Speed Demons on the Road",
  60. edition = "",
  61. publisher = "Benjamin Cummings",
  62. address = "San Francisco",
  63. year = "2001"}
  64.  
  65. @book{Fix2004,
  66. author = "N. E. Fix and I. Paeyoo",
  67. title = "Lots of Money: If You Screw Me I Find You",
  68. edition = "",
  69. publisher = "McGraw--Hill",
  70. address = "New York",
  71. year = "2004"}
  72.  
  73. @book{Lewiston,
  74. author = "W. Lewiston",
  75. title = "Mastery of the Internet: From Process to Production",
  76. edition = "4",
  77. publisher = "Online Press",
  78. address = "Everywhere",
  79. year = "2004"}
  80.  
  81. @book{HTwCentry,
  82. author = "N. Hester and L. Blimey and W. Chesire",
  83. title = "The Colours of the Online Environment",
  84. edition = "4",
  85. publisher = "Chesire Company",
  86. address = "London",
  87. year = "2007"}
  88.  
  89. @book{Schx1,
  90. author = "L. Schx and M. Savage",
  91. title = "Delivery from Dementia: an Extension of the Never-Motionless Mind",
  92. edition = "3",
  93. publisher = "McGraw--Hill",
  94. address = "New York",
  95. year = "2007"}
  96.  
  97. @book{BenDoverReturns,
  98. author = "B. Dover and D. Nine",
  99. title = "When I Am Fixated on the Premature Mind I Dream about Long Titles",
  100. edition = "",
  101. publisher = "Boston Private Press",
  102. address = "Boston",
  103. year = "2012"}
  104.  
  105. @book{JJCreeper,
  106. author = "I. C. U. Creeper",
  107. title = "How to creep around the house on tip toes and socks",
  108. edition = "",
  109. publisher = "Nighttime Illumination",
  110. address = "Atlanta, Georgia",
  111. year = "2010"}
  112.  
  113. @book{FreeMe,
  114. author = "U. N. I. R. Free and I. M. Me",
  115. title = "Releaving your Old Self and Not Caring about the Mistakes You Make Along the Way",
  116. edition = "2",
  117. publisher = "House of Pride",
  118. address = "New York",
  119. year = "2011"}
  120.  
  121. @book{Lini,
  122. author = "S. Lini and F. Lini",
  123. title = "Confusion about Commuting through the Fast Paced Cities",
  124. edition = "2",
  125. publisher = "Sickamore International",
  126. address = "Seattle",
  127. year = "2011"}

LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Postby LavaTyper » Wed Nov 13, 2013 6:52 pm

I still don't have an answer to my question, and I need to get this done for a project.

How do I modify apacite so that three lines of a bibliography entry are contained to within the same page?

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Fri Nov 15, 2013 7:03 pm

It's not so much about modifying the bibliography style but more about customizing the {thebibliography} environment as defined by apacite.

Starting from the questions in your initial post and the provided code there are three things to be done.

  1. For the correct inter-line spacing the setspace package with its doublespacing option is required. Using \linespread is not recommended (see l2tabu). With the \singlespacing command the spacing in the items can then be set inside the {thebibliography} environment.

  2. The {thebibliography} environment needs to be modified by altering the separation between items (\itemsep). This can be done by assigning 0.6\baselineskip to the length \bibitemsep*.

  3. To avoid the so called widows and orphans in the bibliography, the corresponding values \clubpenalty and \widowpenalty are set to a maximum.

All these considerations translated to an example document based on the introduced code look like this.
  1. \documentclass[12pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[doublespacing]{setspace}
  4. \usepackage{apacite}
  5. \usepackage{lipsum} % not for use in the actual document
  6.  
  7. % Original code taken from "apacite.sty"
  8. \makeatletter
  9. \def\thebibliography#1{%
  10. \@ifundefined{chapter}%
  11. {\st@rtbibsection}%
  12. {\if@sectionbibdefault
  13. {\@ifundefined{@mainmatterfalse}%
  14. {\st@rtbibchapter}%
  15. {\if@mainmatter
  16. \st@rtbibsection
  17. \else
  18. \st@rtbibchapter
  19. \fi
  20. }%
  21. }%
  22. \else
  23. \if@sectionbib
  24. \st@rtbibsection
  25. \else
  26. \st@rtbibchapter
  27. \fi
  28. \fi
  29. }%
  30. \bibliographytypesize % e.g., to put the bibliography in \small type
  31. \bibliographyprenote % some explanatory note before the references
  32. \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
  33. {}% skip
  34. {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
  35. \list{\relax}{\singlespacing
  36. \labelsep=\biblabelsep
  37. \parsep=\bibparsep
  38. \itemsep=\bibitemsep
  39. \leftmargin=\bibleftmargin
  40. \itemindent=\bibindent}% changed to cope with 4th ed.
  41. \def\newblock{\hskip .11em plus .33em minus .07em}%
  42. \sloppy\clubpenalty10000\widowpenalty10000
  43. \sfcode`\.=1000\relax %'
  44. \bt@beg@thb@hook
  45. \APACrestorebibitem
  46. }
  47. \setlength{\bibitemsep}{%
  48. \ifcase \@ptsize \relax % 10pt
  49. 0.6\baselineskip%
  50. \or % 11pt
  51. 0.618\baselineskip%
  52. \or % 12pt
  53. 0.604\baselineskip%
  54. \fi%
  55. }
  56. \makeatother
  57.  
  58. \usepackage{filecontents}
  59.  
  60. \begin{filecontents*}{\jobname.bib}
  61. @book{ShipingOutWhere,
  62. author = "H. Shipping",
  63. title = "Expert Deliveries",
  64. edition = "",
  65. publisher = "Silly Dogcourt",
  66. address = "Boston",
  67. year = "1978"
  68. }
  69.  
  70. @book{Shu1980,
  71. author = "D. F. Shu and J. S. Mikey",
  72. title = "Introduction to Small Packages",
  73. edition = "",
  74. publisher = "Lackluster University",
  75. address = "New York",
  76. year = "1980"
  77. }
  78.  
  79. @book{SnowEssentials,
  80. author = "I. P. Snow",
  81. title = "The Nighttime Extortionist",
  82. edition = "3",
  83. publisher = "Bucksport Company",
  84. address = "San Francisco",
  85. year = "1990"
  86. }
  87.  
  88. @book{Zambaba1,
  89. author = "T. Zambaba",
  90. title = "Mega Laughanormous",
  91. edition = "2",
  92. publisher = "The Mafia",
  93. address = "Hoboken, New Jersey",
  94. year = "1997"
  95. }
  96.  
  97. @book{SnowOrigins,
  98. author = "I. P. Snow",
  99. title = "The Nighttime Extortionist Microwaves a Light Bulb",
  100. edition = "9",
  101. publisher = "Bucksport Company",
  102. address = "San Francisco",
  103. year = "1999"
  104. }
  105.  
  106. @book{BeeVomit,
  107. author = "E. T. BeeVomit",
  108. title = "The Honeycomb Matrix",
  109. edition = "",
  110. publisher = "Cambridge University Press",
  111. address = "",
  112. year = "1999"}
  113.  
  114. @book{WFartmann,
  115. author = "W. Fartmann",
  116. title = "Booze \& Plans 4 Tomorrow",
  117. edition = "6",
  118. publisher = "Dub Pub",
  119. address = "Miami, Florida",
  120. year = "1999"
  121. }
  122.  
  123. @book{ChaseMax,
  124. author = "C. E. Max and J. E. Orive",
  125. title = "Myths about the Speed Demons on the Road",
  126. edition = "",
  127. publisher = "Benjamin Cummings",
  128. address = "San Francisco",
  129. year = "2001"
  130. }
  131.  
  132. @book{Fix2004,
  133. author = "N. E. Fix and I. Paeyoo",
  134. title = "Lots of Money: If You Screw Me I Find You",
  135. edition = "",
  136. publisher = "McGraw--Hill",
  137. address = "New York",
  138. year = "2004"
  139. }
  140.  
  141. @book{Lewiston,
  142. author = "W. Lewiston",
  143. title = "Mastery of the Internet: From Process to Production",
  144. edition = "4",
  145. publisher = "Online Press",
  146. address = "Everywhere",
  147. year = "2004"
  148. }
  149.  
  150. @book{HTwCentry,
  151. author = "N. Hester and L. Blimey and W. Chesire",
  152. title = "The Colours of the Online Environment",
  153. edition = "4",
  154. publisher = "Chesire Company",
  155. address = "London",
  156. year = "2007"
  157. }
  158.  
  159. @book{Schx1,
  160. author = "L. Schx and M. Savage",
  161. title = "Delivery from Dementia: an Extension of the Never-Motionless Mind",
  162. edition = "3",
  163. publisher = "McGraw--Hill",
  164. address = "New York",
  165. year = "2007"
  166. }
  167.  
  168. @book{BenDoverReturns,
  169. author = "B. Dover and D. Nine",
  170. title = "When I Am Fixated on the Premature Mind I Dream about Long Titles",
  171. edition = "",
  172. publisher = "Boston Private Press",
  173. address = "Boston",
  174. year = "2012"
  175. }
  176.  
  177. @book{JJCreeper,
  178. author = "I. C. U. Creeper",
  179. title = "How to creep around the house on tip toes and socks",
  180. edition = "",
  181. publisher = "Nighttime Illumination",
  182. address = "Atlanta, Georgia",
  183. year = "2010"
  184. }
  185.  
  186. @book{FreeMe,
  187. author = "U. N. I. R. Free and I. M. Me",
  188. title = "Releaving your Old Self and Not Caring about the Mistakes You Make Along the Way",
  189. edition = "2",
  190. publisher = "House of Pride",
  191. address = "New York",
  192. year = "2011"
  193. }
  194.  
  195. @book{Lini,
  196. author = "S. Lini and F. Lini",
  197. title = "Confusion about Commuting through the Fast Paced Cities",
  198. edition = "2",
  199. publisher = "Sickamore International",
  200. address = "Seattle",
  201. year = "2011"
  202. }
  203. \end{filecontents*}
  204.  
  205. \bibliographystyle{apacite}
  206.  
  207. \begin{document}
  208. \lipsum[1] % not for use in the actual document
  209. \nocite{*}
  210.  
  211. \bibliography{\jobname}
  212. \end{document}

I'm not sure if our feature "Open in writeLaTeX" in the head of the above code box works with externally generated files. But the example should work on your machine.


Thorsten



____________
* The calculation is based on the fact that LaTeX by default uses a leading which is 1.2\baselineskip. Hence 1.2×1.6667=2 and 1/1.6667=0.6 gives the correct factor for double-spaced lines. But this only the default. The actual factor depends on the font size (see code example).
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

LavaTyper
Posts: 68
Joined: Sat Feb 11, 2012 2:38 am

Postby LavaTyper » Sat Nov 16, 2013 1:13 am

Alright but I'm really doing this for my dissertation (which uses Chapters), and I need to have the references file separate. The other thing is that I don't want all of the references in my actual references file to be included if I don't cite them all...just the ones that I do cite.

Everything seems to work fine, except for one problem:

I'd naturally adopt the script that you wrote and just add it into my thesis, but then it doesn't work. I get a chapter title that says "References," a line below it that says "References," and then a blank page. I also end up with a series of error messages in TeXShop. If I keep the \chapter and "book" options, then the first LaTeX typeset and first BiBTeX typeset works, but the second LaTeX typeset fails with error messages.

Here is a mix of the old and the new codes, and what I am trying to do.

Note::

if I change the document class from "book" to "article" and \chapter to \section then it all works (**MWE**).

So, how can I use your code with Chapters?


  1. \documentclass[12pt]{book}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[doublespacing]{setspace}
  4. \usepackage{lipsum}
  5. \usepackage{apacite}
  6.  
  7. % Original code taken from "apacite.sty"
  8. \makeatletter
  9. \def\thebibliography#1{%
  10. \@ifundefined{chapter}%
  11. {\st@rtbibsection}%
  12. {\if@sectionbibdefault
  13. {\@ifundefined{@mainmatterfalse}%
  14. {\st@rtbibchapter}%
  15. {\if@mainmatter
  16. \st@rtbibsection
  17. \else
  18. \st@rtbibchapter
  19. \fi
  20. }%
  21. }%
  22. \else
  23. \if@sectionbib
  24. \st@rtbibsection
  25. \else
  26. \st@rtbibchapter
  27. \fi
  28. \fi
  29. }%
  30. \bibliographytypesize % e.g., to put the bibliography in \small type
  31. \bibliographyprenote % some explanatory note before the references
  32. \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
  33. {}% skip
  34. {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
  35. \list{\relax}{\singlespacing
  36. \labelsep=\biblabelsep
  37. \parsep=\bibparsep
  38. \itemsep=\bibitemsep
  39. \leftmargin=\bibleftmargin
  40. \itemindent=\bibindent}% changed to cope with 4th ed.
  41. \def\newblock{\hskip .11em plus .33em minus .07em}%
  42. \sloppy\clubpenalty10000\widowpenalty10000
  43. \sfcode`\.=1000\relax %'
  44. \bt@beg@thb@hook
  45. \APACrestorebibitem
  46. }
  47. \setlength{\bibitemsep}{%
  48. \ifcase \@ptsize \relax % 10pt
  49. 0.6\baselineskip%
  50. \or % 11pt
  51. 0.618\baselineskip%
  52. \or % 12pt
  53. 0.604\baselineskip%
  54. \fi%
  55. }
  56. \makeatother
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. \begin{document}
  64.  
  65.  
  66. \chapter{\label{chapter:ToBeReferencedInProject}Fancy Technology}
  67.  
  68.  
  69. \lipsum[1] % not for use in the actual document
  70. \nocite{*}
  71. So, as you can see, Many textbooks exist \cite{ShipingOutWhere, Shu1980, SnowEssentials, Zambaba1, SnowOrigins, BeeVomit, WFartmann, ChaseMax, Fix2004, Lewiston, HTwCentry, Schx1, BenDoverReturns, JJCreeper, FreeMe, Lini}.
  72.  
  73. \bibliographystyle{apacite} % APA Standard bibliography
  74. \bibliography{references} % Bibtex database file: "references.bib"
  75.  
  76.  
  77.  
  78.  
  79. \end{document}


The "references" file is the same as before.


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 4 guests