Page LayoutAllowing line break with in-text citation?

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
arwintcher
Posts: 29
Joined: Thu Feb 19, 2009 3:23 pm

Allowing line break with in-text citation?

Post by arwintcher »

I asked this on the Ubuntu forums but I think it may be the wrong place.

Anyway I am using a custom (author-date) citation style created with the custom-bib program. Citations should mostly appear in the text like so (Citation 2009:101). I have a couple of citations that have two authors with long names that are being treated like one word, making the paragraph look really wierd. I can't figure out how to get these citations to wrap to the next line at the margin, like normal text.

For example, if I have a paragraph that carries on like this, and want to put a citation (Jiminez Martinez and Valdez Diaz 2009:158-159) into it that is sort of long, it should wrap at whatever word is at the end of the paragraph (at the moment, it wraps to the next line after the "Valdez"). However, the citation
(Jiminez Martinez and Valdez Diaz 2009:158-159) in question looks like this in the document (i.e. it starts on a new line, regardless of how little text is on the line before it).

Does anyone know how I can fix this? There aren't any extra {} in the .bib file for the citation that is causing problems.

Recommended reading 2024:

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

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

emimca
Posts: 3
Joined: Fri Oct 02, 2009 3:50 pm

Re: Allowing line break with in-text citation?

Post by emimca »

I have the exact same problem. Have you been able to figure it out? Thanks.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Allowing line break with in-text citation?

Post by Stefan Kottwitz »

Hi emimca,

welcome to the board!
My in-text citations could be broken, I'm using natbib. Perhaps post a compilable minimal working example, we could examine that.

Stefan
LaTeX.org admin
emimca
Posts: 3
Joined: Fri Oct 02, 2009 3:50 pm

Re: Allowing line break with in-text citation?

Post by emimca »

Hi Stefan,

Thank you. Here's an example. I am using a Harvard style bibliography. Thanks a lot for your help.
Attachments
example.zip
(21.1 KiB) Downloaded 1042 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Allowing line break with in-text citation?

Post by Stefan Kottwitz »

That's good example code allowing testing, I've found that using cite allows line breaks in \cite:

Code: Select all

\usepackage{cite}
Stefan
LaTeX.org admin
emimca
Posts: 3
Joined: Fri Oct 02, 2009 3:50 pm

Re: Allowing line break with in-text citation?

Post by emimca »

Works wonderfully! Thank you so much!
arwintcher
Posts: 29
Joined: Thu Feb 19, 2009 3:23 pm

Re: Allowing line break with in-text citation?

Post by arwintcher »

Unfortunately for me, the cite package conflicts with natbib (well, as I understand it, natbib is a re-implementation of cite).

In trying to construct a MWE I have run across a strange problem. When using my custom style, I get "citation XX on page X is undefined" errors. If I use, say, plain or humannat, the citation appears just fine, although the line wrap issue is still present.

I would just use humannat except that it has two issues: any text in the "note" field is printed in the references, and it has trouble with certain non-English names. For example, one author's first name is João Zilhão, which appears in the references at the end of the thesis as Zilhão, J. a.
arwintcher
Posts: 29
Joined: Thu Feb 19, 2009 3:23 pm

Re: Allowing line break with in-text citation?

Post by arwintcher »

I searched and searched for the answer to this and never hit on the right search terms to find the answer. However, I asked an acquaintance and they pointed me right to an answer that worked for me. See here:

http://newsgroups.derkeiler.com/Archive ... 00301.html

and

http://newsgroups.derkeiler.com/Archive ... 00370.html

The important bit is to try enclosing the author's last name in curly brackets in the bibtex file. So, using my previous example:

Jiminez Martinez and Valdez Diaz 2009:158-159

@ARTICLE{martinez09citation,
author = {{Jim\'{i}nez Mar\'{i}inez}, Emiliano and {Valdez D\'{i}az}, Francisco},
title = {Citation},
journal = {Journal},
year = {2009},
volume = {13},
pages = {150-160},
}

It's worked for me so far, anyway!
arwintcher
Posts: 29
Joined: Thu Feb 19, 2009 3:23 pm

Re: Allowing line break with in-text citation?

Post by arwintcher »

I also learned that there are some conflicts between natbib and hyperref. If you take out hyperref the citations will break across lines.

ETA:

Actually, all you need to do is add the option breaklinks:
\usepackage[breaklinks]{hyperref}
vdhvu
Posts: 3
Joined: Mon Mar 12, 2007 9:35 am

Re: Allowing line break with in-text citation?

Post by vdhvu »

If use option \usepackage[breaklinks]{hyperref}, it works well for me.

Thank you so much
Post Reply