I’m new to Scrivener and am searching for a way to output code samples.
I’m writing a technical book and plan to have my code files in the project. I want to be able to import (or whatever the function might be) the contents of the code file and have it appear in the text content.
How do I do that?
Here are some threads that may help to give you some ideas:
Also worth mention: if you’re writing a technical book, you might be interested in the more semantic side of Scrivener, using MultiMarkdown and either LibreOffice or LaTeX for the typesetting and layout. If extensive cross-referencing, figure/table captioning (and potentially the listing of these objects), appendices and other such things are what you’re going to need, MMD gives you a good result at the expense of a little learning. It has, for example, a built-in code block environment that you engage by simply indenting the entire code block with tabs (or you can have Scrivener do the indenting for you by applying Format/Formatting/Preserve Formatting to the code block—same as with the rich text examples above).
Thanks AmberV the post on inserting a textbox is close.
I’d love to have content from a file automatically included but copying, pasting, and preserving format will have to do for now, I guess.
I appreciate your help.
Ah, I see what you’re getting at, you want to keep the source files discrete and have the contents dumped in during compile. That’s not presently possible, though we do have it on the list of possibilities, perhaps as a placeholder like the ability to dynamically insert images from the project or file system with <$img…>. It’s a bit tricky though, when it comes to text.