jmclawson / biblatex-mla

MLA-style citations and bibliographies using Biblatex
23 stars 9 forks source link

How to cite inside text? #9

Closed padde closed 10 years ago

padde commented 10 years ago

I can cite a work at the end of a sentence or paragraph with the \autocite command. Sometimes, however, i want to cite a work in the middle of the text, for example:

Knuth (Some work 43) states that premature optimization is the root of all evil.

or even

Knuth states that premature optimization is the root of all evil (Some work 43).

“Some work” is included to show the general case where multiple works of the same author are cited in the same document.

I have tried all of the following citation commands to no avail:

Is there a way to achieve the examples above with biblatex-mla?

Thanks!

padde commented 10 years ago

Ah, i should read the manual more thoroughly. Apparently \autocite* suppresses the author's name. So i went ahead and made my own \textcite command

\renewcommand{\textcite}[2][]{%
\citeauthor{#2} \autocite*[#1]{#2}%
}

This allows me to write

\textcite[43]{knuth} states that premature optimization is the root of all evil.

which will produce the following output:

Knuth (Some work 43) states that premature optimization is the root of all evil.

In the cases where i need to tear apart the author's name and the title/page number i do it this way:

 \citeauthor{knuth} states that premature optimization is the root of all evil \autocite*[43]{knuth}.

which will produce the following output:

Knuth states that premature optimization is the root of all evil (Some work 43).

jmclawson commented 10 years ago

That looks like a good workaround. I don't have something like this included in the package, as it's designed to be used with the style of referencing recommended by the Modern Language Association (MLA)--which recommends holding off on citing until just before punctuation like a comma or period.

In your last example, when you "tear apart" the author's name and the parenthetical citation, is it necessary to use the starred variant? I don't myself use \citeauthor to know, but it ought to trigger the omission of the author's name in a subsequent citation to the same work. (If that doesn't work, I think it's something I can add.)

padde commented 10 years ago

Unfortunately, it does not work this way. I am, however, forced to use an outdated version (from TeXLive 2011) so it may be a problem that does not exist in more recent versions. Anyway, it would be great to see this feature! It's already late today but i'll give it a shot tomorrow and let you know what i found out.

padde commented 10 years ago

So i made a few experiments and came up with an example document.

I was able to get \citeauthor play together well with \autocite by using the following macro:

\let\oldciteauthor\citeauthor
\renewcommand{\citeauthor}[1]{%
\notecite{#1}%
\oldciteauthor{#1}%
}

This will cause this line

\citeauthor{knuth} states that premature optimization is the root of all evil \autocite[43]{knuth}.

to render as

Knuth states that premature optimization is the root of all evil (43).

There is aproblem with this approach, though, because citations without page numbers like this one

\citeauthor{knuth} states that premature optimization is the root of all evil \autocite{knuth}.

will render as

Knuth states that premature optimization is the root of all evil (Knuth).

Of course it would be great if this would instead result in

Knuth states that premature optimization is the root of all evil (‘Title of Work’).

But i didn't know how to approach that.