Text FormattingSpecial Modifications to Bibliography Style

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

Special Modifications to Bibliography Style

Post by LavaTyper »

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?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Special Modifications to Bibliography Style

Post by Johannes_B »

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: 69
Joined: Sat Feb 11, 2012 2:38 am

Re: Special Modifications to Bibliography Style

Post by LavaTyper »

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: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Special Modifications to Bibliography Style

Post by Johannes_B »

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: 69
Joined: Sat Feb 11, 2012 2:38 am

Special Modifications to Bibliography Style

Post by LavaTyper »

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.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Special Modifications to Bibliography Style

Post by Johannes_B »

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: 69
Joined: Sat Feb 11, 2012 2:38 am

Special Modifications to Bibliography Style

Post by LavaTyper »

Alright here is what I have in my document.

Code: Select all

\documentclass[12pt]{article}

\linespread{2}
\usepackage{apacite}

\begin{document}

\section{Another world}

Many textbooks exist \cite{ShipingOutWhere, Shu1980, SnowEssentials, Zambaba1, SnowOrigins, BeeVomit, WFartmann, ChaseMax, Fix2004, Lewiston, HTwCentry, Schx1, BenDoverReturns, JJCreeper, FreeMe, Lini}.

\newpage

\bibliographystyle{apacite}
\bibliography{references}

\end{document}
And here is what I have i my references.bib file:

Code: Select all

@book{ShipingOutWhere,
	author = "H. Shipping",
	title = "Expert Deliveries",
	edition = "",
	publisher = "Silly Dogcourt",
	address = "Boston",
	year = "1978"}

@book{Shu1980,
	author = "D. F. Shu and J. S. Mikey",
	title = "Introduction to Small Packages",
	edition = "",
	publisher = "Lackluster University",
	address = "New York",
	year = "1980"}

@book{SnowEssentials,
	author = "I. P. Snow",
	title = "The Nighttime Extortionist",
	edition = "3",
	publisher = "Bucksport Company",
	address = "San Francisco",
	year = "1990"}

@book{Zambaba1,
	author = "T. Zambaba",
	title = "Mega Laughanormous",
	edition = "2",
	publisher = "The Mafia",
	address = "Hoboken, New Jersey",
	year = "1997"}

@book{SnowOrigins,
	author = "I. P. Snow",
	title = "The Nighttime Extortionist Microwaves a Light Bulb",
	edition = "9",
	publisher = "Bucksport Company",
	address = "San Francisco",
	year = "1999"}

@book{BeeVomit,
	author = "E. T. BeeVomit",
	title = "The Honeycomb Matrix",
	edition = "",
	publisher = "Cambridge University Press",
	address = "",
	year = "1999"}

@book{WFartmann,
	author = "W. Fartmann",
	title = "Booze \& Plans 4 Tomorrow",
	edition = "6",
	publisher = "Dub Pub",
	address = "Miami, Florida",
	year = "1999"}

@book{ChaseMax,
	author = "C. E. Max and J. E. Orive",
	title = "Myths about the Speed Demons on the Road",
	edition = "",
	publisher = "Benjamin Cummings",
	address = "San Francisco",
	year = "2001"}

@book{Fix2004,
	author = "N. E. Fix and I. Paeyoo",
	title = "Lots of Money: If You Screw Me I Find You",
	edition = "",
	publisher = "McGraw--Hill",
	address = "New York",
	year = "2004"}

@book{Lewiston,
	author = "W. Lewiston",
	title = "Mastery of the Internet: From Process to Production",
	edition = "4",
	publisher = "Online Press",
	address = "Everywhere",
	year = "2004"}

@book{HTwCentry,
	author = "N. Hester and L. Blimey and W. Chesire",
	title = "The Colours of the Online Environment",
	edition = "4",
	publisher = "Chesire Company",
	address = "London",
	year = "2007"}

@book{Schx1,
	author = "L. Schx and M. Savage",
	title = "Delivery from Dementia: an Extension of the Never-Motionless Mind",
	edition = "3",
	publisher = "McGraw--Hill",
	address = "New York",
	year = "2007"}

@book{BenDoverReturns,
	author = "B. Dover and D. Nine",
	title = "When I Am Fixated on the Premature Mind I Dream about Long Titles",
	edition = "",
	publisher = "Boston Private Press",
	address = "Boston",
	year = "2012"}

@book{JJCreeper,
	author = "I. C. U. Creeper",
	title = "How to creep around the house on tip toes and socks",
	edition = "",
	publisher = "Nighttime Illumination",
	address = "Atlanta, Georgia",
	year = "2010"}

@book{FreeMe,
	author = "U. N. I. R. Free and I. M. Me",
	title = "Releaving your Old Self and Not Caring about the Mistakes You Make Along the Way",
	edition = "2",
	publisher = "House of Pride",
	address = "New York",
	year = "2011"}

@book{Lini,
	author = "S. Lini and F. Lini",
	title = "Confusion about Commuting through the Fast Paced Cities",
	edition = "2",
	publisher = "Sickamore International",
	address = "Seattle",
	year = "2011"}
LavaTyper
Posts: 69
Joined: Sat Feb 11, 2012 2:38 am

Special Modifications to Bibliography Style

Post by LavaTyper »

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: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Special Modifications to Bibliography Style

Post by localghost »

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.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[doublespacing]{setspace}
\usepackage{apacite}
\usepackage{lipsum}  % not for use in the actual document

% Original code taken from "apacite.sty"
\makeatletter
\def\thebibliography#1{%
  \@ifundefined{chapter}%
    {\st@rtbibsection}%
    {\if@sectionbibdefault
       {\@ifundefined{@mainmatterfalse}%
          {\st@rtbibchapter}%
          {\if@mainmatter
             \st@rtbibsection
           \else
             \st@rtbibchapter
           \fi
          }%
       }%
     \else
        \if@sectionbib
          \st@rtbibsection
        \else
          \st@rtbibchapter
        \fi
     \fi
    }%
  \bibliographytypesize % e.g., to put the bibliography in \small type
  \bibliographyprenote  % some explanatory note before the references
  \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
    {}% skip
    {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
  \list{\relax}{\singlespacing
                \labelsep=\biblabelsep
                \parsep=\bibparsep
                \itemsep=\bibitemsep
                \leftmargin=\bibleftmargin
                \itemindent=\bibindent}% changed to cope with 4th ed.
   \def\newblock{\hskip .11em plus .33em minus .07em}%
   \sloppy\clubpenalty10000\widowpenalty10000
   \sfcode`\.=1000\relax %'
   \bt@beg@thb@hook
   \APACrestorebibitem
}
\setlength{\bibitemsep}{%
  \ifcase \@ptsize \relax % 10pt
    0.6\baselineskip%
  \or % 11pt
    0.618\baselineskip%
  \or % 12pt
    0.604\baselineskip%
  \fi%
}
\makeatother

\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@book{ShipingOutWhere,
  author = "H. Shipping",
  title = "Expert Deliveries",
  edition = "",
  publisher = "Silly Dogcourt",
  address = "Boston",
  year = "1978"
}

@book{Shu1980,
  author = "D. F. Shu and J. S. Mikey",
  title = "Introduction to Small Packages",
  edition = "",
  publisher = "Lackluster University",
  address = "New York",
  year = "1980"
}

@book{SnowEssentials,
  author = "I. P. Snow",
  title = "The Nighttime Extortionist",
  edition = "3",
  publisher = "Bucksport Company",
  address = "San Francisco",
  year = "1990"
}

@book{Zambaba1,
  author = "T. Zambaba",
  title = "Mega Laughanormous",
  edition = "2",
  publisher = "The Mafia",
  address = "Hoboken, New Jersey",
  year = "1997"
}

@book{SnowOrigins,
  author = "I. P. Snow",
  title = "The Nighttime Extortionist Microwaves a Light Bulb",
  edition = "9",
  publisher = "Bucksport Company",
  address = "San Francisco",
  year = "1999"
}

@book{BeeVomit,
  author = "E. T. BeeVomit",
  title = "The Honeycomb Matrix",
  edition = "",
  publisher = "Cambridge University Press",
  address = "",
  year = "1999"}

@book{WFartmann,
  author = "W. Fartmann",
  title = "Booze \& Plans 4 Tomorrow",
  edition = "6",
  publisher = "Dub Pub",
  address = "Miami, Florida",
  year = "1999"
}

@book{ChaseMax,
  author = "C. E. Max and J. E. Orive",
  title = "Myths about the Speed Demons on the Road",
  edition = "",
  publisher = "Benjamin Cummings",
  address = "San Francisco",
  year = "2001"
}

@book{Fix2004,
  author = "N. E. Fix and I. Paeyoo",
  title = "Lots of Money: If You Screw Me I Find You",
  edition = "",
  publisher = "McGraw--Hill",
  address = "New York",
  year = "2004"
}

@book{Lewiston,
  author = "W. Lewiston",
  title = "Mastery of the Internet: From Process to Production",
  edition = "4",
  publisher = "Online Press",
  address = "Everywhere",
  year = "2004"
}

@book{HTwCentry,
  author = "N. Hester and L. Blimey and W. Chesire",
  title = "The Colours of the Online Environment",
  edition = "4",
  publisher = "Chesire Company",
  address = "London",
  year = "2007"
}

@book{Schx1,
  author = "L. Schx and M. Savage",
  title = "Delivery from Dementia: an Extension of the Never-Motionless Mind",
  edition = "3",
  publisher = "McGraw--Hill",
  address = "New York",
  year = "2007"
}

@book{BenDoverReturns,
  author = "B. Dover and D. Nine",
  title = "When I Am Fixated on the Premature Mind I Dream about Long Titles",
  edition = "",
  publisher = "Boston Private Press",
  address = "Boston",
  year = "2012"
}

@book{JJCreeper,
  author = "I. C. U. Creeper",
  title = "How to creep around the house on tip toes and socks",
  edition = "",
  publisher = "Nighttime Illumination",
  address = "Atlanta, Georgia",
  year = "2010"
}

@book{FreeMe,
  author = "U. N. I. R. Free and I. M. Me",
  title = "Releaving your Old Self and Not Caring about the Mistakes You Make Along the Way",
  edition = "2",
  publisher = "House of Pride",
  address = "New York",
  year = "2011"
}

@book{Lini,
  author = "S. Lini and F. Lini",
  title = "Confusion about Commuting through the Fast Paced Cities",
  edition = "2",
  publisher = "Sickamore International",
  address = "Seattle",
  year = "2011"
}
\end{filecontents*}

\bibliographystyle{apacite}

\begin{document}
  \lipsum[1]  % not for use in the actual document
  \nocite{*}

  \bibliography{\jobname}
\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).
LavaTyper
Posts: 69
Joined: Sat Feb 11, 2012 2:38 am

Special Modifications to Bibliography Style

Post by LavaTyper »

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?

Code: Select all

\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[doublespacing]{setspace}
\usepackage{lipsum}
\usepackage{apacite}

% Original code taken from "apacite.sty"
\makeatletter
\def\thebibliography#1{%
  \@ifundefined{chapter}%
    {\st@rtbibsection}%
    {\if@sectionbibdefault
       {\@ifundefined{@mainmatterfalse}%
          {\st@rtbibchapter}%
          {\if@mainmatter
             \st@rtbibsection
           \else
             \st@rtbibchapter
           \fi
          }%
       }%
     \else
        \if@sectionbib
          \st@rtbibsection
        \else
          \st@rtbibchapter
        \fi
     \fi
    }%
  \bibliographytypesize % e.g., to put the bibliography in \small type
  \bibliographyprenote  % some explanatory note before the references
  \@ifundefined{APAC@metaprenote@\APAC@extra@b@citeb}%
    {}% skip
    {\csname APAC@metaprenote@\APAC@extra@b@citeb\endcsname}%
  \list{\relax}{\singlespacing
                \labelsep=\biblabelsep
                \parsep=\bibparsep
                \itemsep=\bibitemsep
                \leftmargin=\bibleftmargin
                \itemindent=\bibindent}% changed to cope with 4th ed.
   \def\newblock{\hskip .11em plus .33em minus .07em}%
   \sloppy\clubpenalty10000\widowpenalty10000
   \sfcode`\.=1000\relax %'
   \bt@beg@thb@hook
   \APACrestorebibitem
}
\setlength{\bibitemsep}{%
  \ifcase \@ptsize \relax % 10pt
    0.6\baselineskip%
  \or % 11pt
    0.618\baselineskip%
  \or % 12pt
    0.604\baselineskip%
  \fi%
}
\makeatother






\begin{document}


\chapter{\label{chapter:ToBeReferencedInProject}Fancy Technology}


\lipsum[1]  % not for use in the actual document
\nocite{*}
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}.

\bibliographystyle{apacite} % APA Standard bibliography
\bibliography{references}	% Bibtex database file: "references.bib"




\end{document}
The "references" file is the same as before.
Post Reply