I’ve previously compiled documents containing references to images in the Research Folder using MMD to LaTeX with no problem. The images are exported along with the document, and everything gets read and laid out properly.
But all of a sudden (seemingly–it’s been a couple of months since I did any compiling) when I try to compile any files in the Draft folder that contain images (or rather, image references), I just get what looks like a dud .tex file (just an empty-piece-of-paper icon, although it has a .tex suffix) and when I open it in TeXShop, there is nothing there. No images are exported. No error messages.
I can compile and export files without images just fine.
I’m working with the same Scrivener project and the same files–just trying to export them again. I can’t think of any changes I’ve made to either the files I’m exporting, or the images in the Research folder, or the Compile settings, although I guess I did something. I wonder if anyone might be able to tell me what’s going on?
How are the images referenced? They must be referenced as Scrivener links to be exported if they are not embedded in the text itself.
All the best,
Keith
Just to add a little more information to the picture:
If I choose Compile for MMD, I do get the exported images in a folder along with the plain text file. That text file contains all of the original text including the MMD syntax for inserting the image, caption, etc.
If I choose Compile for MMD to RTF, I get an RTF file with all text properly formatted, but with the MMD image syntax removed. And no image is exported along with it.
And if I choose Compile for MMD to LaTex, I get an empty .tex file (no text), and no exported images.
The MMD -> RTF exporter is very basic, it just uses the built-in OS X textutil, and it doesn’t support images - iamges will be lost.
As for LaTeX, Scrivener just pumps the exported .mmd files through the LaTeX exporter. I just tried this, though, with a Scrivener link to an image in the text ("") and it worked fine.
Ioa is the MMD expert, so hopefully he may be able to shed some light on cases where images may not work - Ioa?
Yeah, this should be working fine and dandy. I would first ask if you’ve ever done a custom installation of MMD into your Application Support folder. It might be that something got damaged in there. If you do have a “MultiMarkdown” folder in “Application Support”, try moving it out to the Desktop and compiling again. If that sorts out the problem, you know there is something wrong with the custom install.
Thanks a lot, Keith, I appreciate your thinking about it. I just tested the other exporters as a kind of stab at troubleshooting–I know so little about all of this, it’s hard for me to figure out what to look for.
I also tested compiling to LaTeX with new files and images, in a new Scrivener project created by me. And, just for fun, I tested compiling Fletcher’s Sample project as well, just to test a case in which I’m sure there aren’t any errors in the MMD syntax. Each time, what I see is that if the selection of files that I am compiling includes any file with a reference to an image, the only output is a blank .tex file. If my selection doesn’t include any files with image references, then the output is normal.
It has worked just fine in the past, so I am thinking the solution must not be too hard, but like I say, I am just kind of stymied when it comes to how to troubleshoot it.
Hmm, I don’t think Scrivener checks there, but I do think it also checks in your system level Library/Application support folder. Keith would have to verify that. Maybe do a Spotlight search with the criteria as:
Search for: MultiMarkdown
Search: This Mac | File Name
Kind is Folder.
All right, and I’m assuming you’ve already tried moving that to the Desktop and compiling, with the same result. If so, there might be a glitch in the MMD file itself that is causing a silent error. If you are good with Terminal, you could try compiling a plain MMD file instead of a .tex file, and then run the MMD helper script, “mmd2LaTeX.pl” against this file, like this:
cd ~/Library/MultiMarkdown/bin
./mmd2LaTeX.pl test_compile.md
This assumes you’ve named it “test_compile.md” and moved it into that bin folder, naturally. Running it manually from the command line is exactly what Scrivener does, but it might pick up any warning messages or other output that is not getting sent back to Scrivener.
OK–Doing this produced a good .tex file in the bin folder. The PDF output from that .tex file also looks good–it includes the images properly laid out. (The images were exported by Scrivener in a folder along with the .md file; I moved everything into bin).
Okay, in that case move the whole MultiMarkdown folder into Application Support. It really should be working once you do that, since we’ve confirmed the copy in this folder will work.
OK, I moved the MultiMarkdown folder into Application Support. This didn’t change anything–when I ran Compile in Scrivener I still got what looked like a blank .tex file.
But then, I thought I would try to view the file as plain text so I changed the extension to .txt. When I did that, or actually just removed the extension, the “file” appeared as the expected export folder, containing a good .tex file along with all the images. In other words, a normal export, only hidden.
I guess that’s been happening all along but it didn’t occur to me to inspect the “blank .tex file” more closely before.
So, that’s good! But it seems like I need to change something in the Scrivener compile or export settings so that the exported folder doesn’t have the .tex extension?
This is pretty much what has been happening to me: the compile produces a package containing the .tex file and the images. Opening the package in finder then double clicking the .tex opens the file in TexShop as it should, and everything works normally from there.
This only seems to happen when there are Scrivener-linked images.
A-ha! Yes, if there are images, Scrivener exports a folder with the .tex file inside it, and the folder will have the .tex extension too. It’s very odd that the folder appeared as a blank file on your system, though - normally folders with extensions only appear as single files if the file type has been registered as a bundle, so I’ve never heard of this happening before. I may need to change that code to drop the extension in that case, then, as I wasn’t aware this could happen.
It does seem to be the extension which is causing the problem. If I remove the extension (in Get Information rather than just in Finder) from the file package it then displays in Finder as a normal folder.
Yep, I’m relieved! I’m not sure why the folder is appearing as a file now when it didn’t before–I guess something changed on my system. Anyway, it just didn’t occur to me that that was what was happening. Mostly because I’m fairly clueless. But partly also because when there are no images, the Scrivener output is, of course, just a .tex file, which is obviously fine, but I just got it in my head that either Scrivener or MMD couldn’t be handling the images in my files properly, or something, because it was just exporting (I thought) a .tex file.
All of that is just to say that maybe it might even be a good idea to have Scrivener always export a folder when compiling to LaTeX, even if there aren’t any images and the folder only contains the .tex file? So the expected output would always be consistent? I always put .tex files in a dedicated folder anyway before generating a PDF so that all the auxiliary files get collected in one spot, so it wouldn’t be wrong from that standpoint to have all .tex files coming out of Scrivener in a folder.
Regardless of all that–thanks very much, Keith and Ioa, for working through this with me.
I think I’d get complaints about creating a needless folder in that case (I’ve had similar complaints before about other exports needlessly creating folders). I have added it to my list not to add the .tex extension to exported folders, though, and to look into this, as obviously now I know this can happen it is bound to end up confusing more people and so needs to be avoided.