Multi-column, multi-tiered Styles Listing

I’ve come to realize that incorporating LaTeX into a Scrivener project may NOT be as common as I once thought. I may be one of a few Scrivener users that have naïvely embraced LaTeX while creating my Scrivener project. Both learning curves were incredibly steep at first, and remain so in some respects.

With LOADS of support from the Scrivener team and website, searching through thousands of pages on StackExchange et al., and LOTS of caffeination, I have come to understand how Scrivener + LaTeX together form an amazing team of apps.

But, I still dream … hence this wish list item …

One of the most powerful Scrivener tools that I have employed over the last 2 odd years is the Styles list. The expanded Styles list I have created include 37 Paragraph Styles and 61 Character Styles. Below are snapshots of what my LaTeX embellished Styles list has become.

(Excluding the original 9 Paragraph Styles and 8 Character Styles in Scrivener’s General Non-Fiction (LATEX) Project template, I’ve added 28 new Paragraph Styles and 53 new Character Styles to my project.)

What is so powerful about Scrivener Styles is when I run across a LaTeX feature that requires any number of lines of LaTeX code (e.g. 1 to not-quite ) that I likely will want to re-use elsewhere in my project. Within a few minutes, I can add a new Paragraph or Character Style to the Styles list, and voilà, I have the identical feature available in seconds for future use. Scrivener Styles are such a great way to leverage Scrivener + LaTeX code.

A nice benefit of using a Scrivener Style to implement a unit of LaTeX code is the subtle appearance of the Paragraph or Character Style within the Scrivener text. Using Scrivener Styles can avoid cluttering-up the pre-compiled Scrivener text with sometimes-annoying LaTeX code. Instead, subtle shades of color can serve to effectively indicate the presence of any underlying LaTeX code or function, resulting in much ‘cleaner’, more readable pre-compiled Scrivener text and code.

And, as an added bonus, the more Paragraph or Character Styles I add, the easier it is to look back at my assortment of Styles in Scrivener to see how best to add a new Style. (I’ll admit … creating the first few new Styles took more time to implement that I’d like to admit … the existing Styles in Scrivener’s General Non-Fiction (LATEX) Project template, however, served as an excellent introduction to Scrivener Styles.)

Although my current Styles list is still manageable, only time will tell how far I will push the current single-column incarnation of the Styles list until it becomes so long that I stop adding more items to the list, or delete the less-used items.

So my wish list for the next version of Scrivener is to have a multi-column, multi-tiered Styles listing, with the ability to add tiers of Styles, perhaps something like how the Scrivener Main menu is both multi-columned, and how ‘Navigate’ is multi-tiered.

My guess is it may be some time before a too-long Styles list becomes unmanageable. Having a multi-column, multi-tiered Styles listing, however, would facilitate use of the augmented Styles list; multi-column would help to keep the Styles list short, and multi-tiered would allow for the grouping of similar Paragraph and Character Styles.

Allowing for custom icons to be added to each Styles multi-column, multi-tiered item (like in the Scrivener Binder) would be a nice plus.

Thanks for reading,
scrive
:thinking:

P.S. I’d be interested in hearing if there is anyone else out there that is also heavily invested in LaTeX for Scrivener. Recognizing what I perceived to be a dearth of Scrivener + LaTeX users, I’ve essentially stopped replying to postings to provide LaTeX solutions to issues that arise with Scrivener.

I’m amazed at the effort that went into coding Scrivener’s General Non-Fiction (LATEX) Project template, particularly after realizing how few people may be using LaTeX with Scrivener. Please feel free to let me know if I’m off-base with my supposition regarding the lack of LaTeX use with Scrivener.

Using Scrivener with LaTeX can indeed be quite a bit of fun. I experimented many different options for generating my final PhD Thesis text. One of them relied solely on using LaTeX in Scrivener via Styles and Section Layouts. Since I also needed to generate a word document for my advisor to comment, I eventually settled on a hybrid approach exporting in Markdown with lots of raw tex getting added in post-compile via a Ruby script.

I am in awe at anyone, particularly someone who considers using LaTeX to “be quite a bit of fun”. My iHat is off to you.

With 6129 packages, LaTeX can be mind-blowing with it’s own eco-system that can frighten away the timid. To some extent, my own naivety, coupled with Scrivener’s General Non-Fiction (LaTeX) Project template is what got me hooked on LaTeX for Scrivener.

Despite the difficulty, after close to two years of development, I cannot imagine using Scrivener without LaTeX.

At this point in my life, after years of work managing IT projects, I found my relative IT skills had atrophied somewhat. Others with more up-to-date IT skills would likely find a more gradual learning curve. But for non-IT savvy authors looking for a better tool for writing, which Scrivener (with or without LaTeX) definitely is, I don’t know how many will be willing to make the kind of investment required to learn both Scrivener + LaTeX, despite the cornucopia of utilities available from the combination of the two.

The seamless nature of how well LaTeX functions within Scrivener, starting with the General Non-Fiction (LaTeX) Project template, leads me to believe that those who developed Scrivener did so with more than an eye on the evolution of LaTeX that today accumulates about 100 packages per month, now at 6129 packages from 2821 contributors.

My hope is that in future versions, Scrivener developers retain the seamless nature between Scrivener and LaTeX, and hopefully can expand on such features as Styles that have proved so powerful to enlarge the use of LaTeX within Scrivener, despite what for some can be a steep learning curve.

Thank you for your comments regarding the development of your PhD Thesis text. It is good to hear how others may have ventured forth into what may appear to be the great LaTeX unknown, including those with long-term objectives that stand to gain the most from the investment. A PhD Thesis is not a trivial effort.

Regards,
scrive
:thinking:

Thank you for your kind words. Of course, that is not to say that LaTeX is easy nor that it won’t be a huge pain at times. Error msgs, in particular, are sometimes completely off which leads to many wasted hours searching online for answers.

Despite all that, I think it can also be entertaining and it does allow us create beautiful documents with many interesting resources (in particular, I like the backlinks from the bibliography/glossary to the text). So I would love Scrivener to remain TeX friendly and I agree with your assessement of the LaTeX template offered. It is very good and helpful.

Speaking of which, perhaps you would care to share your own template? I think this could help inspire others to venture down the same road and hopefully help them along the way.

BTW, how are you dealing with tables @scrive?

Hi Bernardo,

Thank you for the question regarding tables. My apologies for the delay in responding to your queries.

As my knowledge of LaTeX is quite limited, I’ve had to use whatever tools I could find to bridge the gap in my knowledge of LaTeX.

For tables, I’ve used https://www.tablesgenerator.com/ a few times to facilitate my creation of tables. As I don’t know who owns the website, I cannot offer an unqualified recommendation for the site. For anyone who might find the site useful, I would suggest using surrogate data to avoid any unintended release of sensitive data.

That said, the website is quite powerful and can be helpful as a tool to learn more about how to use LaTeX to construct tables, something that I seriously needed to get a handle on the structural code for LaTeX tables.

As a bit of a neophyte when it comes to such websites, I experienced a bit of a learning curve with respect to the custom grid feature image, the Save table… and Load table… utility, and when to “Escape special TeX symbols (%, &, _, #, $)”.

I’d appreciate and welcome any thoughts or suggestions you might have for additional resources to facilitate the generation of LaTeX tables.

As to your earlier query regarding templates, I’m hoping to provide an example or two for others that may be interested on how to expand their use of Scrivener Styles.

Thank you again for your queries,
scrive
:thinking:

If you’re ever looking for an offline way of generating LaTeX syntax of almost any sort, the open source tool LyX is what I often use, both for stuff that is annoying to type out by hand, and as a tool for discovery, if I know what I want to do but am not sure of how to. For this:

  1. Create a new document as a scratch area.
  2. Use the Insert/Table... command and select the starter dimensions.
  3. The data entry should be pretty straight-forward, it works like most tools do in this regard. You’ll notice when the cursor is in a table cell there will be an additional toolbar with various commands for row and column management, merging and splitting cells and setting some formatting options.

Once you’ve got things set up the way you want, use the View ▸ Code Preview Pane, where you can copy and paste into Scrivener.

Hi AmberV,

Thank you for the reminder about LyX.

I had researched LyX some time ago (early on in my journey with Scrivener + LaTeX), but was scared off by the MacOS unsigned developer warnings, and trouble trying to understand how to use GnuPG to verify the apps signature (which still to this day I still cannot seem to wrap my head around, including failed attempts to download Fink and the develoer Xcode.app from Apple … another story …).

I ultimately decided to go for it, however, and put my faith in the unverified LyX download in order to test the LyX app. Thank you for the 1., 2., 3., intro on how to create a table and see the LaTeX code generated. Nice!

At first blush, I see similarities between and https://www.tablesgenerator.com/ and LyX. I can appreciate the anonymity and added features that LyX offers. I’ll need to set some time aside to get familiar with all the features LyX offers.

Thank you again for the reference,
scrive
:thinking:

Bah, that warning is one of the first things I disable on a new Mac. I use too many open source and independent programs to be wasting time with Apple wagging its finger around and pretending half of my workflow is suspicious. I obviously never bought into it being a beneficial addition to the ecosystem. Maybe if they made it free I’d have less of a jaded opinion on it.

LyX is great though. If Scrivener never came along, I’d probably still be using it for writing.

Hi Bernardo,

Other than Scrivener’s General Non-Fiction (LaTeX) Project template that I initially used to create my Scrivener project, I haven’t relied on any other template. The General Non-Fiction (LaTeX) Project template had just enough examples for Styles that I’ve been able to copy, adjust and modify, to create the new Styles extensions that where listed in my earlier posting.

Your query, however (as is often the benefit of having feedback from others) prompted me to rethink my approach toward my use of Verses throughout my project. Prior to your query, I had hobbled together a formatted Verse format which is simply a Verse of text with top and bottom borders, a nice and simple way to highlight text, often a supporting quote. The following, (using LaTeX \lipsum) is an example of such a formatted Verse:

using the following standalone LaTeX code (Note: excludes LaTeX setup code):

\smallskip
\vspace{-3.5mm}\par ~~~~~~ \hrulefill~~~~~\par\vspace{-2.5mm} % Top border
\lipsum[2-4][12-18]
\vspace{-5mm}\par ~~~~~~ \hrulefill~~~~~\par\vspace{-1.5mm} % Bottom border
\smallskip

Currently, I have about 45 of the formatted Verses scattered throughout my project, each one using the above standalone LaTeX code.

After your query, I realized the need (and after some thought) the utility and simplicity to create a paragraph Style to standardize my formatted Verses.

I also thought how such a new paragraph Style might demonstrate how useful Scrivener Styles can be, so I created one. (My apologies if this is not what you were thinking of in your query.)

The new paragraph Style now appears in my list of Scrivener Styles as ‘Verse Text-Box’, highlighted below in Blue:


The Verse Text-Box was created in the LaTeX (Memoir Book) Project Formats screen shown below:

The Prefix/suffix LaTeX code (toward the right side) in the above screen is mostly hidden, so I’ve included the full LaTeX code below:

Prefix:

\smallskip
\vspace{-3.5mm}\par ~~~~~~ {\color{ElectricUltramarine}\hrulefill}~~~~~\par\vspace{-2.5mm}
\begin{verse}[\versewidth]

suffix:

\end{verse}
\vspace{-5mm}\par ~~~~~~ {\color{mediumblue}\hrulefill}~~~~~\par\vspace{-1.5mm} 
\smallskip

The corresponding Verse Test-Box entry in the Styles panel appears as follows:


In the Styles panel shown above, I selected a faint-pink highlight box color for the Verse Test-Box Style: image
to indicate where and when the Verse Test-Box Style is being used in the Scrivener text:

The result is a single line of Scrivener text that replaces the original 5 lines of Scrivener text / LaTeX code for the same formatted Verse.

To summarize what just happened:

By creating a new paragraph Style I called Verse Test-Box, I was able to replace a small section of funky-looking, distractive Scrivener text / LaTeX code :

\smallskip
\vspace{-3.5mm}\par ~~~~~~ \hrulefill~~~~~\par\vspace{-2.5mm} % Top border
\lipsum[2-4][12-18]
\vspace{-5mm}\par ~~~~~~ \hrulefill~~~~~\par\vspace{-1.5mm} % Bottom border
\smallskip

with a single line of Scrivener text (notice the faint-pink highlight box background color that I specified in the Styles panel above):


The compiled PDF output from the original formatted Verse:

is essentially identical to the compiled PDF output using the Verse Test-Box Style shown below (except that I upgraded the color of the top and bottom borders to shades of blue):

Going forward, my plan is to retrofit each of the original formatted Verses with the Verse Test-Box Style.

This may not seem like much for non-LaTeX Scrivener users, but I’ve found my use of Styles helps to do two things:

  1. Styles eliminate much of the LaTeX code within the Scrivener text, which for me eliminates the distraction in my train of thought that I might experience when I review the Scrivener text,
    (… and as an experienced programmer like yourself can appreciate …)
  2. Styles consolidates the LaTeX code to a single point of failure, so that instead of having numerous separate instances of standalone LaTeX code to check and verify for errors, there is only one instance of the code to check for errors.

The above demonstrates one of my simpler implementations of Scrivener Styles with LaTeX. Most of the other Scrivener Styles I have created are more involved and would take a bit more to explain and demonstrate.

I’d be willing to give it a go to explain some of the more complex implementation of Scrivener Styles, but only if you or others would be interested to know what I have created.

Let me know of you think it would be worthwhile for me to delve into one of my more complex implementations of Scrivener Styles, although it might take me a bit of time to construct an example for others to understand.

Thank you again for your query and suggestion.

I hope the above may be of some help to you and other Scrivener LaTeX users,
scrive
:thinking:

2 Likes