Style macros, line auto-numbering

I’m working on a computer programming book and a friend of mine said I needed to check out Scrivener. I’ve gone through the tutorial and it looks really nice, I’ve just got a couple questions still to help determine if it’s for me.

First of all, is there an easy way to define and change text styles? I’ve got a bunch of styles that I have to use…chapter heading, section heading, code listing, listing caption, etc. Ideally I could set those up and easily switch between them. I think I found the settings I need under Text->Scriptwriting. It seemed like I could only edit built-in styles though. I’d like to know how to create my own script mode that has the various styles I need.

Secondly, my book will have several code listings, and I need to put the line number next to each line. Is there any way to auto-number the lines so that I don’t have to do it? Also I would love it if Scrivener could automatically update the line numbers within the listing as I shuffle lines around.

Thanks a lot for any info. I’m really hoping that Scrivener will be a good fit for me.

For styles look at this:

literatureandlatte.com/forum/vie … php?t=2227

Auto line numbering is, as far as I know, not implemented, but you can of course export your work to an application that does (e.g. Word).

Hope this helps and welcome to Scrivener!

For line numbering you would have to insert the <$n> tag at the beginning of each line, which would get replaced with auto-numbering upon export/print.
Best,
Keith

Try Scrivener’s MultiMarkdown->LaTeX export. By default it uses LaTeX’s verbatim environment for Preformatted Code Blocks, but you can easily replace that with a more powerful environment (i.e. the listings package).

Thanks for that. Is it possible to import something as a script element? I imported a .doc file that has all the styles I need to use. I’d like to be able to select some text and create a script element that uses its style info, instead of having to go through and manually set everything up. I saw that I can save the current style as a favorite style…can I do something similar to save it as a script element?

bump hoping there’s an easy way to do this…