On 06/19/2017 08:48 PM, David Pesetsky wrote:
> Is there a way to tweak Lyx so the Citation dialog shows a different set of 
> options for "Citation Style" than the ones that appear by default when I have 
> selected  "natbib" and "author-year" in Document Settings/Bibliography?  I'd 
> be interested in having a comma rather than semicolon separating multiple 
> references, for example.  
>
> There's nothing I can't produce manually, of course, by simply selecting the 
> date-only option on the Citation Style pull-down menu and typing what I want 
> before and after the date, but if I could take advantage of the pull-down 
> menu options more often, it would save some effort.
>
> Similarly, for some purposes, at least, I'd be happy if I could tweak "text 
> after" in the same dialog so that it ends up preceded by a colon rather than 
> the comma that Lyx inserts.

The issues you're raising here are actually LaTeX issues, rather than
LyX issues. It's important, in understanding how LyX operates, to
separate these: There's the question how things look in LyX; then there
is the question how the PDF looks when it is generated. The latter
ultimately concerns LaTeX. In some cases, LyX provides a 'native' way to
tweak the LaTeX output. But oftentimes, you have to do something
manually, e.g., add something to the LaTeX preamble.

In this case, the semi-colon citation-separator and comma before the
"text after" are being inserted by natbib, which is what formats the
citations and bibliogrpahy. So it's natbib that we need to control. The
natbib manual
    http://mirror.utexas.edu/ctan/macros/latex/contrib/natbib/natbib.pdf
has a bunch of information about tweaks. Section 5 of the manual
mentions a number of package options that change global behavior. The
one you want for your first request is "comma". You just add this, as a
class option, under Document> Settings> Class Options> Custom. (If there
already are some there, this is a comma-separated list, so add it with a
new comma, e.g.: draft,comma.)

For the other one, section 2.9 of the natbib manual explains how to
select citation punctuation using the \setcitestyle command. In your
case, you want:
    \setcitestyle{notesep={: }}
to select a colon followed by a space. It is probably easiest to put
this command into Document> Settings> LaTeX Preamble, though it can also
be entered as TeX code in the document itself. Note, by the way, that
natbib seems to be quite picky about space before and after the "=",
i.e., it does not like space there.

As it happens, \setcitestyle will also control the citation separator,
so you could just do:
    \setcitestyle{notesep = {: },citesep={,}}
and skip the class option, if you wanted.

Note that this will NOT change how the citations appear within LyX
itself. That can be done, but it's a much messier matter.

Richard Heck

PS Yes, the Richard Heck from the other side of L&P....

Reply via email to