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, ...)
User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Re: Special Modifications to Bibliography Style  Topic is solved

Postby cgnieder » Mon Dec 16, 2013 10:44 pm

I downloaded v6.01 of apacite and still couldn't reproduce your error until I changed the class from article to book. It seems there have been some changes to the conditionals. I adapted the above code with the relevant parts of the definition of \thebibliography in v6.01 which then compiled without errors:

  1. \listfiles
  2. \documentclass[12pt]{book}
  3. \usepackage[T1]{fontenc}
  4. \usepackage[doublespacing]{setspace}
  5. \usepackage{apacite}
  6. \usepackage{lipsum} % not for use in the actual document
  7.  
  8. % Original code taken from "apacite.sty" v6.01
  9. \makeatletter
  10. \def\thebibliography#1{%
  11. \@ifundefined{chapter}%
  12. {\st@rtbibsection}%
  13. {\@ifundefined{@sectionbibtrue}%
  14. {\@ifundefined{@mainmatterfalse}%
  15. {\st@rtbibchapter}%
  16. {\if@mainmatter
  17. \st@rtbibsection
  18. \else
  19. \st@rtbibchapter
  20. \fi
  21. }%
  22. }%
  23. {\if@sectionbib
  24. \st@rtbibsection
  25. \else
  26. \st@rtbibchapter
  27. \fi
  28. }%
  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. \show\if@sectionbibdefault
  57. \makeatother
  58.  
  59. \usepackage{filecontents}
  60.  
  61. \begin{filecontents*}{\jobname.bib}
  62. @book{ShipingOutWhere,
  63. author = "H. Shipping",
  64. title = "Expert Deliveries",
  65. edition = "",
  66. publisher = "Silly Dogcourt",
  67. address = "Boston",
  68. year = "1978"
  69. }
  70.  
  71. @book{Shu1980,
  72. author = "D. F. Shu and J. S. Mikey",
  73. title = "Introduction to Small Packages",
  74. edition = "",
  75. publisher = "Lackluster University",
  76. address = "New York",
  77. year = "1980"
  78. }
  79.  
  80. @book{SnowEssentials,
  81. author = "I. P. Snow",
  82. title = "The Nighttime Extortionist",
  83. edition = "3",
  84. publisher = "Bucksport Company",
  85. address = "San Francisco",
  86. year = "1990"
  87. }
  88.  
  89. @book{Zambaba1,
  90. author = "T. Zambaba",
  91. title = "Mega Laughanormous",
  92. edition = "2",
  93. publisher = "The Mafia",
  94. address = "Hoboken, New Jersey",
  95. year = "1997"
  96. }
  97.  
  98. @book{SnowOrigins,
  99. author = "I. P. Snow",
  100. title = "The Nighttime Extortionist Microwaves a Light Bulb",
  101. edition = "9",
  102. publisher = "Bucksport Company",
  103. address = "San Francisco",
  104. year = "1999"
  105. }
  106.  
  107. @book{BeeVomit,
  108. author = "E. T. BeeVomit",
  109. title = "The Honeycomb Matrix",
  110. edition = "",
  111. publisher = "Cambridge University Press",
  112. address = "",
  113. year = "1999"}
  114.  
  115. @book{WFartmann,
  116. author = "W. Fartmann",
  117. title = "Booze \& Plans 4 Tomorrow",
  118. edition = "6",
  119. publisher = "Dub Pub",
  120. address = "Miami, Florida",
  121. year = "1999"
  122. }
  123.  
  124. @book{ChaseMax,
  125. author = "C. E. Max and J. E. Orive",
  126. title = "Myths about the Speed Demons on the Road",
  127. edition = "",
  128. publisher = "Benjamin Cummings",
  129. address = "San Francisco",
  130. year = "2001"
  131. }
  132.  
  133. @book{Fix2004,
  134. author = "N. E. Fix and I. Paeyoo",
  135. title = "Lots of Money: If You Screw Me I Find You",
  136. edition = "",
  137. publisher = "McGraw--Hill",
  138. address = "New York",
  139. year = "2004"
  140. }
  141.  
  142. @book{Lewiston,
  143. author = "W. Lewiston",
  144. title = "Mastery of the Internet: From Process to Production",
  145. edition = "4",
  146. publisher = "Online Press",
  147. address = "Everywhere",
  148. year = "2004"
  149. }
  150.  
  151. @book{HTwCentry,
  152. author = "N. Hester and L. Blimey and W. Chesire",
  153. title = "The Colours of the Online Environment",
  154. edition = "4",
  155. publisher = "Chesire Company",
  156. address = "London",
  157. year = "2007"
  158. }
  159.  
  160. @book{Schx1,
  161. author = "L. Schx and M. Savage",
  162. title = "Delivery from Dementia: an Extension of the Never-Motionless Mind",
  163. edition = "3",
  164. publisher = "McGraw--Hill",
  165. address = "New York",
  166. year = "2007"
  167. }
  168.  
  169. @book{BenDoverReturns,
  170. author = "B. Dover and D. Nine",
  171. title = "When I Am Fixated on the Premature Mind I Dream about Long Titles",
  172. edition = "",
  173. publisher = "Boston Private Press",
  174. address = "Boston",
  175. year = "2012"
  176. }
  177.  
  178. @book{JJCreeper,
  179. author = "I. C. U. Creeper",
  180. title = "How to creep around the house on tip toes and socks",
  181. edition = "",
  182. publisher = "Nighttime Illumination",
  183. address = "Atlanta, Georgia",
  184. year = "2010"
  185. }
  186.  
  187. @book{FreeMe,
  188. author = "U. N. I. R. Free and I. M. Me",
  189. title = "Releaving your Old Self and Not Caring about the Mistakes You Make Along the Way",
  190. edition = "2",
  191. publisher = "House of Pride",
  192. address = "New York",
  193. year = "2011"
  194. }
  195.  
  196. @book{Lini,
  197. author = "S. Lini and F. Lini",
  198. title = "Confusion about Commuting through the Fast Paced Cities",
  199. edition = "2",
  200. publisher = "Sickamore International",
  201. address = "Seattle",
  202. year = "2011"
  203. }
  204. \end{filecontents*}
  205.  
  206. \bibliographystyle{apacite}
  207.  
  208. \begin{document}
  209. \lipsum[1] % not for use in the actual document
  210. \nocite{*}
  211.  
  212. \bibliography{\jobname}
  213. \end{document}


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

Tags:

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

Postby LavaTyper » Mon Dec 16, 2013 11:58 pm

It works! Finally... I applied it to my full project and it all works beautifully.

Having said that, my background with LaTeX is not as expertise as yours (as in, what are all these log files...meh I'll just ignore them), so this is why I really needed help here. Much appreciated.

I'm also surprised that v6.01 and v6.03 would be so different to cause such problems.

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Dec 17, 2013 12:05 am

LavaTyper wrote:Having said that, my background with LaTeX is not as expertise as yours (as in, what are all these log files...meh I'll just ignore them)

Most of the time you actually can ignore them. Many of those are auxiliary files for the processing, most notably the aux file that contains (not only) information on labels for example, or the toc file that contains the actual table of contents.

The files you shouldn't ignore are the logging files such as log and blg (the bibliography log file). They often contain valuable information when errors happen...

LavaTyper wrote:I'm also surprised that v6.01 and v6.03 would be so different to cause such problems.


The differences in the case at hand aren't so big, actually, they're supposed to be minor internal code anyway. But if you start hacking on it then the version is important :)

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

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

Postby Johannes_B » Tue Dec 17, 2013 10:20 am

LavaTyper wrote:once again the above example does not work for me.
... It does not work.

Here is my attached log and resulting PDF file...after I accept the error messages that I get.


And you didn't wonder about the errors? It is working perfectly on my machine, and Thorsten said the same thing. You didn't upload a log file (well, you did, but much later than i requested) ...

But i am glad to hear, that it now works.
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 » Tue Dec 17, 2013 7:57 pm

Johannes_B wrote:
LavaTyper wrote:once again the above example does not work for me.
... It does not work.

Here is my attached log and resulting PDF file...after I accept the error messages that I get.


And you didn't wonder about the errors? It is working perfectly on my machine, and Thorsten said the same thing. You didn't upload a log file (well, you did, but much later than i requested) ...



Why do you insist on arguing with me? How was I supposed to know what to do with the files when I have so little experience with LaTeX? I asked for help, not to be trapped in an argument. This is the second time that you're acting like this to me.

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

Postby LavaTyper » Sat Jan 25, 2014 8:46 pm

Updated request

The code that cgnieder provided almost works, but for my project I need to have everything be left justified, and no hyphenation.

So, I have \usepackage[document]{ragged2e} and \usepackage[none]{hyphenate} in the preamble.

Everything seems fine... except... some entries in the bibliography have unacceptably long spaces. For my project, I need to remove inconsistent spacing.



Help:

In the minimal working example, below, there is an error with the last cited entry in the bibliography. There is a large space between "Z. (1997)" and also between "(1997). This" - for my project, which has about 100 entries, I need to have consistent spacing.


How do I fix this issue?


(Also see attached screenshot - to illustrate what I mean)


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

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Jan 25, 2014 8:58 pm

If you don't allow hyphenation then you don't gain much with ragged2e. In fact it causes what you're experiencing here. In standard LaTeX \raggedright sets \rightskip to 0pt plus 1fil which means the space to the right is allowed to stretch infinitely. With ragged2e \raggedright sets \rightskip to 0pt plus 2em.

Solution to your case seems to be not to use ragged2e and place \raggedright at the beginning of your document.

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

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

Postby LavaTyper » Sun Jan 26, 2014 3:39 am

That seemed to work, but then I ended up with that same spacing issue in my table of contents. I've just decided to use both ragged2e and \raggedright.


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 8 guests