help with integrating scrivener, bibdesk and latex

I’ve been trying to find an answer to this myself for the past two hours and I’m at the end of my rope! I’m hoping that someone here might be able to help me.

I’m using scrivener to write my dissertation. I manage my bibliography with bibdesk. What I’ve been doing is exporting the draft to word and then using a bibdesk template to create a bibliography. The problem with that is that I combine in-text citations with footnotes and it’s easy to lose track.

I just discovered the multimarkdown function in scrivener and latex and I’m completely in love, but I’m having a huge problem getting the footnotes to actually sync up with the citations. Here’s what I’m doing… I drag the bibdesk citeyear command to the insertion point in scrivener. I then make it a footnote. I compile the draft in the mmd->latex format. I then open the new latex file and run the layout command. Everything looks like a dream except for the fact that in place of the authors, I see this — [?]

Any ideas? I don’t know if this question would be better answered on a latex forum, but if anyone here has some insights, my dissertation and I would really thank you.

I’ve moved this to the MMD section of the forum because I think that Fletcher may be able to answer your question much better than I can.
Thanks,
Keith

As this works for me, let me try to reconstruct the process:

  • drag “citeyear” from Bibdesk sidepanel to Scriv: result “\citeyear{key}”
  • use cmd-shift-F to turn “\citeyear{key}” into a footnote
  • compile with MMD -> Latex
  • open .tex and run latex, bibtex, latex, latex
  • in the resulting pdf I see a footnote with a year in it.

Pretty weird though that this works. Evidently the internal footnote format of scrivener “protects” the latex cite code (which outside of this kind of footnotes gets turned into $\backslash$cite{key} ).


Edit: scratch that. Other tex code gets mangled, but cite commands (and \citeyear) work anyhow (thanks to cleancites.pl).

You can also do footnotes with cites by hand (though I’m not sure you can do “citeyear”):

Bladibla.^footnotekey

Be sure to indicate your bibliography among the MMD settings in Scrivener (i.e. insert the Bibtex key and indicate the path to your .bib file).

Have you read the instructions on including BibTeX data in MMD documents?

http://fletcherpenney.net/MultiMarkdown_Syntax_Guide#bibliographysupport

http://fletcherpenney.net/MultiMarkdown_Syntax_Guide#bibtexsupport

http://fletcherpenney.net/MultiMarkdown_Syntax_Guide#bibtex

I’ve checked and double checked to make sure that I’m following the exact same process that Carlo described (had a friend sit down next to me to supervise) and I got nothing. I’ve also gone through all the information on fletcherpenney.net and I think what I’ve done wrong is becoming clearer, but I’m still uncertain on how to fix things. The information out there is really sophisticated and I’m still grappling with some of the basics.

I think the biggest thing I missed is that I did absolutely nothing with changing the MMD settings in Scrivener. I’ve done the reading on that, but I’ve still got some big questions:

  1. Does it matter where my sty or bib files are stored on my computer if I specify the path in Scrivener’s MMD settings?

  2. How do I specify the path to the bib file? I’ve gone to MMD settings, added BibTeX as a metadata file, and typed in bibliography.bib (the name of my file). My guess is that I’m doing something wrong. Some of the metadata tags seem straightforward - “author” is simply my name. The ones that require a link to another file or a file path, however, are beyond me.

  3. Are the XSLT files that MMD uses the same thing as BibDesk’s sty files? I’ve got a pretty rigid style that I need to stick to and I’d like to create a different style than the default memoir option.

  4. On one forum topic here, it was suggested that we use MMD syntax for citations. Does that still hold true? Is it possible to create a cite string in BibDesk that replicates the MMD sytax?

Again, thank you all for your patience and whatever guidance you can provide. I can see the Scrivener/BibDesk/LaTex combination being absolutely phenomenal, but these first steps are a real challenge.

Hi martini,

The following is AFAIK and IMHO where applicable. I’m sure fletcher and KB will have something to add.

No. You only need to specify the path for the .bib file. The rest is handled by LaTeX.

The easiest way is to open the MMD setings window, go to the bibtex key and drag you .bib file into the right hand area.

No, but you’l have to specify your desired style inside one of the XSLT files, as the files included with MMD specify natbib. I’ve set up jurabib without major problems.

Not sure what you mean here. You can use the MMD syntax or latex \cite{} syntax. Both work. Don’t forget, BibDesk is just a GUI.

Hope this helps.

I always keep my .bib file in the same folder as the exported LaTeX, but as long as the path is correct, it should work anywhere.

As long as bibliography.bib is in the same folder as the LaTeX file you generate, that is fine.

XSLT is totally separate from BibTeX’s style files (not BibDesk). You can create your own XSLT files to your heart’s content to do almost anything you want.

see http://groups.google.com/group/multimarkdown/browse_thread/thread/c9937c17906a8b1 for some sample export templates for BibDesk. I released these for feedback and if anyone tells me they’re working, I can put them on my main site as well. (Go to the last couple of posts by me in the thread to download the files)

I can’t begin to say how ridiculously triumphant I feel for being able to create something that works! Thank you Carlo and Fletcher for all of your help!!

Just in case anyone else who is a complete, complete beginner has to do the same, here are the steps that I followed (it’s basic, but sometimes we need to keep it simple).

  1. Created a new folder named “Testâ€

[quote]
… in TeXShop and clicked the “typesetâ€

Thanks, Carlo. Following another thread (sorry for not looking there first), I downloaded the MMD files and extracted them to Library/Application Support. I now see where all the information is and where the XSLT files are located. When I double-clicked on an XSLT file (just to see what it looks like, forget about modification at the moment), Safari opened, but then nothing happened. How do I open the file?

Yes. I know there’s got to be at least one person reading this who is banging their head on their desk because someone is actually typing the words “how do I open this file.” Sorry!

XSLT (like HTML and tex) files really are nothing more than simple text files. All you need is a text editor. A good (and free) editor is TextWrangler (http://www.barebones.com/products/textwrangler/), but also TextEdit should do fine. To open the files with TextEdit (or another application) right-click or control-click them and select “open with” from the pop-up menu. Also, if you press cmd-i with the files selected you can see which application they will open with and change it for that file or all files of the same type.

Don’t worry about asking questions and banging heads: we all started as noobs. :slight_smile:

My deepest apologies (and I am NOT normally one to respond this way) but that is WAY too complicated. I’m beginning an advanced masters and if that’s what I’m going to have to do to get footnotes, etc in, no thank you. Surely this is overly complicated? There must be an easier way. When I read those directions over (either in the 7 step method above or the various links further up the page) my eyes start to glaze over. On top of that, it all sounds VERY precarious, like a computer crash or a mistakenly deleted folder could destroy all the hard work done.

So, (and I’m embarrassed to ask this) is that the best there is? If so, Scrivener may have just found its way to the trash bin. :cry:

(OK, that last sentence was a bit melodramatic, but really, if that’s how “easy” it is to get reference notes from BibDesk, I’m quite sad right now.)

All together, I think that the seven steps took about 5 to 10 minutes to do. The hard part wasn’t doing it. The hard part was figuring out what to do. I’ve got absolutely no programming experience whatsoever and I posted those steps in case someone who is in the same position I was could benefit from what I learned.

You asked if this is the best there is and, without hesitation, I’d say yes. I’d also add that I don’t think I’d be able to write my dissertation without Scrivener. It’s a matter of personal preference. This works for me and I’m thankful for it.

As for integrating it with BibDesk and LaTeX… that’s very much a matter of personal preference, too. I’ve exported my Scrivener files to Word and then selected BibDesk files to export to Word to combine the two. That process works fine. I’d just like to learn a way to approach bibliographies that can sustain me through my career as an academic, not just a handful of papers over the course of a semester or a few years. That’s why I’m actually making the effort to learn more about integrating these programs.

To each their own, I guess.

PS: I’m completely lost on how to edit XSLT files if someone wants to toss a woman a bone in the form of links for additional information. I also have no idea if the editing that I should be doing should occur in the XSLT template or in the LaTeX template. Any thoughts on when one should edit one as opposed to the other?

What part of it is difficult? If you’re combining BibDesk and LaTeX, you have to have a .bib file, you have to insert citations in your document, and you have to process the files when you’re done. It’s the same whether you’re using Scrivener and MultiMarkdown, or writing in raw LaTeX.

You’re always welcome to use something like Endnote if you prefer - and certainly many people prefer to use a program like that. Or OpenOffice has an integrated bibliography database now. Or Sente.

But, do be fair, technically none of the BibDesk, MultiMarkdown, LaTeX workflow has anything to do with Scrivener. In this case, Scrivener is simply acting as a highly over-qualified text editor. The workflow would be the same using TextMate or another text editor. So Keith doesn’t deserve any blame for this.

LaTeX and BibTeX is not a tool for people who are afraid of the command line. It’s a very powerful setup that produces output of much higher quality than you’ll ever get out of Word or an RTF based program. But the price is a little bit of “elbow grease” (can that term be used in reference to computers?..)

And since this comment simply referenced footnotes - footnotes are a feature built into Scrivener that doesn’t require anything else. And BibTeX/LaTeX should allow automatic generation of footnotes if that’s how you wish to display your citations (though I haven’t played with footnotes for citations - they’re not the norm in medical literature.)

In any event, good luck finding the suite of tools that fits your needs.

F-

Footnotes can be made by selecting the text that goes in the note, pressing cmd-shift-F and you’re done. By exporting to Latex they become \footnote{} commands and work exactly as expected.

The seven-step program is just the installation, ordinary use is pretty simple. Consider also that martini is asking about modifying the default setup, which should work “out of the box”: MMD is included in Scriv (IIRC) and drag-n-drop from BibDesk should work as advertised without hackery (AFAIK).

Isn’t that always the case with any setup? Always be careful and RTFM.

IMHO, yes, pretty much. Doing everything by hand in TeXShop is not much more attractive. And there I had to hack some bst and sty files too to get everything as I needed.

BibDesk is just a front-end for a bibtex database, if you’re not going to use it with latex, you might be better off with other tools. But if you are going to use it with latex, doing the seven-step dance for Scriv+MMD is really not much harder than setting it up in tex.

The XSLT template transforms what you write in Scrivener into a Latex document. Beyond that, I guess that for your needs you don’t need to learn any XSLT syntax. It just transforms bits of code into other bits of code. What you need to change is probably just the latex code output by adding packages or substituting one command with another.

What you should change depends on your worflow: are you going to export from Scriv into latex often? Change the XSLT. Are you going to work in Scriv and export only once at the very end into latex? Change your latex document.

To edit an XSLT file, open it in TextEdit or TextWrangler. Look for the parts with latex commands, and change to suit your needs. The XSLT files contain the latex preamble (“template”) that is inserted into your final document. Probably you’ll want to change stuff in memoir.xslt or xhtml2latex.xslt. If you’re more specific (what .xslt are you usng now? What re you trying to accomplish?) perhaps we can help you better.

There’s also a third way: You can use latex-snippet.xslt and have a LaTeX main file that loads the compiled document:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
...
\begin{document}
%...
\include{Untitled}
%...
\end{document}

You will obviously loose the Metadata from Scrivener’s ‘MultiMarkdown Settings’, which isn’t such a big issue.

When it comes to specifying the layout that I’d like to have, I think what I’m going to do is completely ignore all the MMD files, specify some of the MMD metadata in Scrivener, and stick with changing the txt file. That’s where I’m running into problems.

On another thread, someone posted a link to long document on the memoir class. I’ve gone through it and tried to make changes to the txt file that I get after exporting the draft from Scrivener. The only things that I’ve managed to do without getting an error message is change the paragraph indent and create block quotes (hurrah!!!).

I thought I was understanding the commands, but I’m either not or I’m screwing up with inserting them into the txt file. Here’s what I’d like to do: 1) skip a line between paragraphs (I inserted \parskip{12pt} in a few places and got nothing); 2) have the titles be without the little numbers next to them (eg, go from “1.2 Section Title” to “Section Title”); 3) figure out how to have double spacing just in case I’d like to have a document with that one day.

Also, when I open up the txt document that’s created after the scrivener export, I see that it begins with “\documentclass[10pt,oneside]{memoir}”. I thought that one way to get around my problem with making these little changes would be to change the document type. In Scrivener’s MMD options, I changed the XSLT file metadata to “book” once and “article” another time. I made the same changes to that first line (\documentclass…) in the txt file, inserting article/book in place of memoir. I either got no changes in the pdf file or I received an error message and I couldn’t get a pdf file out of it.

At the end of the day, the only thing I really want to do is make some very, very basic stylistic changes (the four that I listed above).

I recognize how rudimentary this stuff is, but I really haven’t been able to find anything out there for the complete novice. I’m doing my best to learn the language, but boy oh boy.

These are indeed relatively basic LaTeX issues:

  1. you can specify the parskip in the preamble by writing

\parskip = 12pt

  1. sections (and chapters and parts) are numbered automatically. You can redefine the “section” command as follows to avoid numbering:

\renewcommand \thesection{}

  1. Lineheight can be modified in various ways. The easiest is probably the following:

\usepackage{setspace}
\setstretch{2}

  1. The article and book documentclasses only define a very basic layout, memoir is actually a collection of packages that can emulate both and has many more options. Try looking at the memoir manual for some pointers on what it can do: http://www.ctan.org/tex-archive/%20macros/latex/contrib/memoir/memman.pdf

LaTeX has a steep learning curve, but IMHO it is worthwhile. Try starting with a basic tutorial just to get to grips with the basic mechanisms, such as the “not so short guide”: http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf

Thank you so very much, Carlo! :smiley: They were definitely basic questions, but being able to do something useful - no matter how ridiculously simple - has given my confidence an enormous boost. More importantly, I can now have things in a format that I can share with others (so Latex is no longer slowing my work down). I can’t even begin to say how happy I am now that the whole Scrivener/BibDesk/Latex combination has finally become functional for me!!

Thank you! Thank you! Thank you!

I’ve worked through a lot of the basics and am feeling much, much more comfortable with the whole Scrivener/Bibdesk/Latex combination, but I haven’t been able to find a way to make one set of tweaks in my bibliography. For reference purposes, I’ve included a screen shot of what I’m trying to work with.

First, I’d like to turn the colored boxes around the references off. I’ve been able to do that by inserting the following code:

\usepackage{hyperref}
\hypersetup{colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=black,%
urlcolor=black,%
pdftex}

Is there another way to go about making sure I don’t have linked boxes in my bibliography and footnotes?

Second, in both my bibliography and in my footnotes, I’ve got these brackets. Using the first citation in the bibliography screen shot… in my bibliography I see [Bor(2006)] and in the footnote, it’s also [Bor(2006)]. In my footnote, I’d like to change that to be “Bor (2006)” - no brackets and a space between the author and the year. In the bibliography, I’d like to be able to just start with the author - no “[Bor(2006)]” at all. What do I need to change? Is that something that I need to go into the bst file to change? Is the latex file where I need to go? What would I erase/modify?

Third, I want to remove the footnote numbers which come after the bibliography entry (the ones in a red box in the picture). As in the above question, is that something that I need to change in the bst file? in latex? somewhere else?

Thanks for any sort of help you might be able to send my way!
bib question.jpg