Adding words to the Grammar checker

Is there any way to add words or text to the Grammar checker ?

I’m using Scrivener with LaTeX. I use the mhchem package that employs the \ce{…} macro to properly displaying chemical formulas.

The Grammar checker highlights ‘ce’ each time the \ce{…} syntax appears. I’ve already added ‘ce’ to the Spellchecker so it does not highlight the \ce{…} syntax.

I was wondering if I could somehow add the ‘ce’ to the Grammar checker so it stops highlighting it ?

There are a number of other items I’d like to add to the Grammar checker, but I thought I’d start with just ‘ce’.

(I did not notice any reference in the Scrivener manual on how to add to the Grammar checker.)


I can’t see how to selectively “ignore” a grammar rule either (apart from turning the whole thing off of course)! I think you prefer to see all your LaTeX markup in your editor, but if you were to use inline styles, then you could add the LaTeX markup at compile rather than during editing; less “noise” in the editor and the added benefit that the grammar checker won’t be triggered.

1 Like

Hi nontroppo,

Thank you for the update on the Grammar checker.

I’ve reviewed the ‘Using Styles’ video tutorial in an attempt to implement an “inline styles” based solution. Please let me know if there there are other tutorials on how to use LaTeX markup at compile time to reduce the “noise”.

Do you know if there are any items on the Scrivener ‘ToDo list’ (or whatever it is called) that address any future ability to add terms to the Grammar checker list?

Or, is this really a MacOS issue, and should be addressed outside of Scrivener?

If there is a future possibility of adding to the Grammar checker list, I’ll wait before I research other options outside of Scrivener. (I realize it could be a l-o-n-g wait!)

Thanks again for the update,

Scrivener uses the macOS text system, and grammer and spelling is part of that. Apple has not really touched this AFAIK for years, and they didn’t eat their own dog food when they made Pages, so I highly doubt there will be any improvements to this system. I suspect you either disable it, live with it or use Styles :innocent:

Probably the best way to learn using Styles is Scrivener’s own manual project (markdown+LaTeX) or the built-in Non-fiction LaTeX template (plaintext+LaTeX; File > New Project…), as @AmberV uses Styles for many of the formatting conventions in both projects. The magic happens in the compile Styles panel, where you can add prefix and suffix markup to a style. So as simple as it gets, an inline equation injects $ before and after text with that style applied during compile.

1 Like

Thank you again for your ideas regarding the Grammar checker. Given Apple’s lack of support for the Grammar checker, I’ve turned my Grammar checker setting off to eliminate the highlighting when the Grammar checker suspects a grammar issue.

When I first read your initial posting, I was a bit confused by your suggestion to use inline styles to reduce the “noise” from the Grammar checker. (I am still on a steep learning curve with Scrivener).

What I now believe you meant with your suggestion was that I could use inline styles in the following way:

  1. First, replace all instances of text where the Grammar checker finds an issue (e.g. the LaTeX macro \ce ), with ‘special’ replacement text that the Grammar checker ignores, then:

  2. Second, make an entry in Scrivener inline styles that replaces the ‘special’ replacement text with the original text where the Grammar checker found an issue (e.g. the LaTeX macro \ce )

If this is what you meant when suggesting I use Scrivener inline styles to remove, then replace, the offending LaTeX text from my project, it is an interesting solution.

Given my extensive use of LaTeX within Scrivener, your initial comment that:

is an important one.

There are thousands of LaTeX macro commands within my project. My initial thought is that creating ‘special’ replacement text to substitute for the LaTeX macro commands (to satisfy the Grammar checker) to then be converted back to proper LaTeX macro commands may create more confusion and possible compile errors than the effort is worth.

Let me know if I have mis-intrepreted your suggestion to use Scrivener inline styles to deal with how the Grammar checker deals with LaTeX macro commands.

Otherwise, thank you for your thoughts. My guess is there are a limited number of those who understand Scrivener+LaTeX as well as you do, so I appreciate your responses to my inquiries.

Thank you,

If this is what you meant when suggesting I use Scrivener inline styles to remove , then replace , the offending LaTeX text from my project, it is an interesting solution.

An inline style will allow you to completely remove the LaTeX markup from your editor, so that \ce{text} is simply replaced by text which is highlighted with an inline style (I suppose this can be considered a ‘replacement’). You can see this as a method to “tag” a text fragment semantically (inline-maths, chemistry etc). The style itself does no more than that. Your text will not have LaTeX markup in it. It is the job of the compiler format to then apply transformation rules at compile time, it takes your text and prepends / appends whatever markup you want, it can be LateX, HTML etc. This means the same Scrivener document can be compiled using different compile formats to different target, or plain text without any fiddling in the editor.

The challenge you will face however, is how to transform a large document from LaTeX markup into styled text. You can use regular expressions to find markup (e.g. \\ce\{([^\}]+)\} will find your \ce{text} markup and allow you to remove it using the first matching group $1 to preserve the text). But there is no way in Scrivener to also add a style to a replacement automatically. This would be a very cool feature for a future Scrivener. But at present you will have to Find… the text, focus the editor and apply the style (can assign a key), then refocus Find… dialog and then replace. Now you have \ce{text} replaced by text with an applied style. You may consider this too much work, and indeed may not be happy to adapt to a workflow where you don’t see your LaTeX markup in your text, that depends entirely on your preference. Personally I dislike the “noise” that markup (whether it be markdown, HTML, LaTeX or other) contributes when I’m editing text, and Styles solve this perfectly.

1 Like

Hi nontroppo,

Thank you for your detailed description of how to use styled text as a way to avoid the ‘noise’ from the Grammar checker.

Our discussion has morphed somewhat from the original issue of adding words to the Grammar checker, to the styled text features afforded by Scrivener.

One of my many character limitations is that I am kinesthetic as opposed to literal. I am some what of an oxymoron of sorts as words often escape me, an irony that as someone attempting to work in the writers domain I face constantly. Words are my Achilles heel, and yet I cannot achieve my goals without them.

As a term of ‘Scrivener’ art, styled text, like so many other Scrivener terms, represents a sea of functionality that I use in concert with LaTeX to generate amazing synergies. Yet, I simply was not making the connection between the styled text that I use every day in my writing, and the styled text you suggested I use to avoid issues with the Grammar checker.

That is a long winded way to say that, unknowingly, I have been using styled text extensively in my current project. In fact, styled text has been a cornerstone for building my subject index by marrying Scriveners styled text features with the LaTeX indexing macros.

Currently, my styles panel and menu occupy almost three full screen heights with over 70 paragraph styles and character styles to choose from. (See below)

The most powerful are the character styles that I use to create two-tier index entries in seconds that would otherwise involve much more effort if Scrivener styles were not available. At 9+ pages, I cannot imagine how I would otherwise construct my two-column index for the project. (See last index pages below)

My apologies for not being familiar to the terminology that I should have understood with ease, particularly after having integrated styles so deeply into my project.

I’ve included a clip of my styles Replacements screen that shows some of the LaTeX macros (in the ‘With’ column) that create index entries.

Thank you for all your help,
:thinking: :confused:

:rofl:yes, looking at your styles panel, we can definitely agree you are using styles in your editor! I’ve never needed to make an index, but I don’t quite understand why you are using so many Replacements. The styles themselves can insert the correct markup — using the text+paragraph prefix and suffix functions in the Styles section of the compile format directly… The UI is a bit fiddly, as the prefix/suffix boxes are tiny and don’t show that you can enter line breaks and therefore have multiline text, but using ⌥[enter] you can get more complex markup in there.

I need to mention at the outset that ALL that I have been able to do started with the excellent, General, Non-Fiction (LaTeX) template that Scrivener provides as part of the application package. Without that excellent template that contained sample style Replacements, I would NOT have been able to learn how to integrate LaTeX indexing within Scrivener.

I have a total of 27 replacements in my styles Replacements screen, each representing a LaTeX macro that creates a slightly different index entry. In many cases the macro also applies a style such as BOLD, Italics, or Underline to the printed text in the body of the (PDF) document, and in a few cases creates a hyper-link to the corresponding entry in the project Glossary. (See below)

As an example, the ‘\txtciTgls’ LaTeX macro (See ‘LaTeX Macro’ image below) creates an underlined hyper-link to the Glossary item represented by the arguments {#1 #2} in the printed (PDF) text, and creates a two-tier index entry represented by {#2!#1} in the LaTeX macro.

What the Scrivener text looks like (See the ‘Scrivener text’ image below) is a section of highlighted text such as the “slow<>carbon cycle” enclosed in the red box. The ‘<>’ characters separating the ‘slow’ from ‘carbon cycle’ are interpreted by the LaTeX macro as delineators between the macro arguments #1 and #2.

The index entry for the Scrivener text “slow<>carbon cycle” (See the ‘Project Index’ image below) appears in the red box with ‘slow’ as a subentry beneath the entry ‘carbon cycle’.

The resulting text in the printed (PDF) output (See the ‘Printed (PDF) Text’ image below) appears as hyper-linked text, but without the <> delineators.

Clicking on the “slow carbon cycle” hyper-link in the printed (PDF) output will move the cursor to the Glossary entry for “slow carbon cycle” (See ‘Project Glossary’ image below)

If all this is something that can be accomplished all using Scrivener styles Replacements and NO LaTeX code, I’m all for it. As much as I admire LaTeX, anything that can simplify the code, I’m all eyes and ears.

I consider the Scrivener Replacements feature as enabling some of the most powerful functionality of Scrivener when combined with LaTeX. And yet, there is so much more that can be done when marrying Scrivener with LaTeX. I feel I am just scratching the surface of what is possible.


Some time ago, possibly prior to the transition to the new Scrivener forum, I posted a suggestion along the lines of widening the styles panel and styles menu to accommodate two or even three columns of styles. Part of the reason I made the suggestion to widen the styles panel and styles menu was that I could see just how powerful styles were when combined with LaTeX. On average, once each week I would find myself adding a new style to the styles panel/menu as a straight forward way to enhance my Scrivener document. I’ve included a mock-up of what a three-column styles panel might look like (See ‘Styles Panel’ image below).

That brings us to your suggestion to use styles as a way to hide the ‘noise’ generated by the Grammar checker which I found interesting.

Using the \ce{ } macro as an example, it would be a simple exercise to add the \ce{ } macro to the styles panel/menu. However, there are over six thousand LaTeX packages, many with multiple LaTeX macros, hundreds of which I use in my Scrivener + LaTeX document. If I were to incorporate even a fraction of the LaTeX macros I currently utilize in my project, the existing single-column styles panel/menu would (IMHO) become prohibitively long and unwieldily to use.

I DO think that using styles as a way to prevent the ‘noise’ generated by the Grammar checker may be a feasible solution, but without a multi-column styles panel/menu, the styles implementation could thwart the effect use of the styles panel/menu itself.

All thoughts or comments appreciated.

Thanks again for your insight,

Personally, I copy and paste anything more intense than a few “words” in and out of these fields to edit them. I think what would be nice for some foggy future is if there was a kind of popup editor on a button that showed about three or four lines, some decent width and invisible characters shown.


Here, here!! Gggrrrreeeeaaattt Idea!!! Love it!
:thinking: :pray: :grinning_face_with_smiling_eyes: :heart:

There was another thread on this some time ago. I vaguely remember I suggested to add filtering and a live-search to the Styles panel. The ideal would be if we could “pin” most used styles, then have a way to filter the remaining styles easily it would make it much easier to use. Libreoffice has some toggle icons for different styles, and Word has a small menu to select different sets of Styles (in use, recommended etc.). I don’t use it but Nisus has what looks like a more powerful styles management option:

I think having a live-search to filter the menu would be better IMO than other options.

I had also asked @KB during the 3.0 beta whether we could have a “docked” inspector UI for Styles rather than the floating menu panel. But he suggested that Styles do not immediately fit into the conceptual structure for the Inspector (true). I am just used to UI where I can “dock” styles panel without having to constantly move a floating window around.

YES please!!! :heart_eyes: :heart_eyes: :heart_eyes:

Hi nontroppo

Another thought might be to have a cascading styles menu that allowed for the aggregation of styles with similar names. Highlighting a particular style would pop-up the next cascading level of styles with similar names.

So instead of having 3 columns of styles (as shown in the three column ‘Styles Panels’ image above) perhaps the styles panel /menu could be a single column, but with active style elements that numerically indicate how many sub-styles there are beneath each aggregated style element such as ‘Enumerated List (8)’ and ‘Glossary Link (11)’ in the image below.

When highlighted, each style would pop-up the full list of sub-styles such as for ‘Enumerated List’ and ‘Glossary Link’, respectively, shown below.

Just a thought …

1 Like

Yes, a one-level folder-like system would certainly help. This would be compatible with a live-search field. My feeling is that @KB will consider this a fairly specialised use-case and exceedingly low-priority feature-wise, I suspect 99.89% of Scrivener users do not use more than 5-10 styles, if any[1] :grimacing:

[1] I personally wish writing tools were more “opinionated” on styles, as my strong feeling is most users would greatly benefit from their use, if only they were encouraged to do so. Microsoft Word, the gorilla who never leaves the room, still visually prioritises direct formatting in the GUI after all these years, and almost all the manuscripts I deal with from others are a hodge-podge of direct formatting ‘contaminating’ the text. A prominently placed and well designed UI + Style panel with preferential key/icon bindings to styles by default would help, but probably upset the majority of users who stick with what they know…


Overall I would say that user interface for large-scale style management is a bit over the top for how most (i.e. 99.9%) use Scrivener! I would feel fairly safe in wagering you are one of the few people on earth that has a dozen different styles for glossary links.

I do appreciate the enthusiasm for the feature set though! It really is a big deal to be able to do this kind of stuff in a markup oriented workflow, and to be knowledge it is a unique combination of tools. There are certainly workflows where you can add markup to a system, but few where doing so does not increase the visual complexity of the writing interface (i.e. the text in markup oriented approaches).

Idealistically I heartily agree, but more pragmatically, I think overall the problem with a style-based workflow is that it does require a certain degree of learning to do basic things, as well as an overhead to design new looks within a document. No matter how friendly you made the default wiring—things get jammed fast when you try to use those in a way that only makes sense with direct formatting, like trying to apply Emphasis on top of Glossary Term.

Yes, there is the flowchart based formatting approach, like Cascading Style Sheet technology, but that is a mind-bending concept in and of itself, which can require what amounts to a debugging interface to figure why your text looks the way it does, and the gnarly knots that can emerge when you tinker with one setting toward the root of the flowchart that causes dozens of assumptions to go awry. Don’t get me wrong, I love CSS—but I think it’s a hard sell when the stylesheet system alone has countless books written about learning it.

Maybe there is some magic sauce idea that could make semantic document design as straight-forward as just unwitting slapping AGaramondPro-Italic.otf down as a thing, but it could be one of those things where the boat sailed on that decades ago and changing that would be like bringing Gopher back.