Forgot your password?
typodupeerror
Open Source

How I Added an LLM-Based Grammar Checking + TeX Math Import To LibreOffice (keithcu.com) 42

Former Microsoft programmer Keith Curtis "wrote and self-published After the Software Wars to explain the caliber of free and open source software," according to his entry on Wikipedia, "and why he believes Linux is technically superior to any proprietary OS."

He's also KeithCu (long-time Slashdot reader #925,649), and has written a blog post on "How I added an LLM-based grammar checking + TeX math import to LibreOffice." : At Microsoft, I spent five years working on the text components RichEdit and Quill, and came to understand the "physics" of word processing: the file formats, data structures, and algorithms that provided fast access to text and properties, independent of the length of the file. Selecting one million characters to make them bold took about the same time as changing one character, because of the clever data structures (piece tables) and algorithms in these engines...

When I decided to add a real-time AI grammar checker to [LibreOffice plugin] WriterAgent, I knew what I was getting into, but I underestimated the trickery of LibreOffice's UNO.

His site shares the surprises he encountered, one by one. (Starting with "the office suite throws a bunch of initialization variables at your constructor. If your Python __init__ method doesn't handle them, the code fails to map the call, the stack misaligns, and the program dies.") There's sentence casing issues, duplicate words, and foreign-language syntax — all culminating in new features for "a LibreOffice extension (Python + UNO) that adds generative AI editing to Writer, Calc, and Draw..."

"If you want to try it out, the repo is here... Let's make LibreOffice and the free desktop AI-native!"

How I Added an LLM-Based Grammar Checking + TeX Math Import To LibreOffice

Comments Filter:
  • by Anonymous Coward
    I got Trump phone.
  • by Anonymous Coward

    You can actually make use of it, or you are on your own, you already know about local LLMs don't you?, anyway pay em $20-$2000 each and every month forever and it will work great.

    • No need for 20 bucks.

      Open/Libreoffice has had TeX integration for years: https://extensions.libreoffice... [libreoffice.org]

      It works and very well, too.

      OO/LO has had grammar check for a lot longer than TeX support.

      • by KeithCu ( 925649 )
        I added the TeX feature to expose it to the LLMs. I recently added an insert LateX dialog since it was so easy but this feature helps for people who don't know TeX or have a bug, and want an LLM to help them. As I mentioned elsewhere, when you use a high-end model, the grammar checker suggestions can be better than what you could get with many of the old static rules based systems, certainly lightproof which was just a few regex expressions.
  • by Smidge204 ( 605297 ) on Saturday May 16, 2026 @06:35PM (#66146621) Journal

    OpenLibre already had grammar checking. It was free, didn't require a lot of hard drive space (a few MB at most?), and ran locally and almost instantly without needing a high price graphics card.

    In fact we've had that ability for over a decade now.

    > Let's make LibreOffice and the free desktop AI-native!

    Fuck you, Keith.

    =Smidge=
    /TexMaths is also an existing LibreOffice extension

    • Re: (Score:2, Interesting)

      by stelios78 ( 628238 )
      Friend, you obviously have not used the extension. It does way more than grammar checking. And you do not have to use it. And it works with your local llm. It is quite impressive and very easy to install (and remove). Give the people the choice! What do you think?
    • by KeithCu ( 925649 )
      There are other grammar checkers of course. I already had the plumbing to call LLMs, so I only spent a few days on it. What's nice is that, depending on the model, you can get far more sophisticated advice than the conventional static systems. I've investigated doing a non-LLM version, but it's a lot of work for less features. You don't need a high-priced graphics card. I spend $5 a month on OpenRouter for a lot of usage. The key is finding good-enough models. I use https://openrouter.ai/inceptio... [openrouter.ai] becau
      • by dfghjk ( 711126 ) on Saturday May 16, 2026 @08:07PM (#66146739)

        I spend $0 a month on word processing and I'm more concerned with the product of my efforts than developing my own tools. It's almost as though new solutions to long solved problems is all that matters here, not actually editing documents.

        • by KeithCu ( 925649 )
          As I said above, depending on the model, you can get far more sophisticated grammar advice than the conventional limited static systems, just like how the LLM-based language translation capabilities are far better than the old tools with hand-written rules. AI doesn't need to make your work inferior, it all depends on if you can use it well. What matters is having access to AIs inside of existing tools, and also being able to work faster at editing those documents. There's no point in building a LibreOffic
          • As I said above, depending on the model, you can get far more sophisticated grammar advice than the conventional limited static systems

            I don't know why I would want that. Is it aimed at foreign language speakers?

            • by KeithCu ( 925649 )
              Well, I can suggest trying it out, using a good model (if you have an API key) and seeing what it finds on your work. I was shocked at some of the interesting advice I got when using frontier models, and getting great advice on the ones below that. The plugin registers support for 34 languages, but the results depend on the model you use. Assuming every user knows which AIs are good in their language, it should work out well.
              • I was shocked at some of the interesting advice I got when using frontier models, and getting great advice on the ones below that.

                Wow, the models were shocking with their shocking advice.

                Do you have any examples of what was so shocking?

                • by KeithCu ( 925649 )
                  I don't have any examples I can recall, but it was like a very good English teacher or copyeditor. It wasn't inventing new physics, but it was making advice that is different the usual set of rules that many have seen on the conventional checkers.

                  Maybe I'll try and do comparative testing vs LanguageTool, etc. and see how it does. Do you have a big mess of bad text I could use as a test set?

                  It's only about 2,500 lines of code for a lot of features (sentence cache, persist with document, intl, etc.)
      • by tlhIngan ( 30335 )

        Yeah, we've had grammar checking for nearly 3 decades now. And for the most part it's been mostly useless - tell me if it doesn't complain about anything other than "passive voice" over and over again. Oh, it got better, it gave examples! But it was the same old crap over and over again that I stopped caring about the blue squiggle. I think most programs disable the blue squiggle on grammar errors nowadays.

        But I've noticed it in a few places and it doesn't bother telling me what's wrong, but offers me a hel

  • It's why I don't use LibreOffice. Add basic functionality before AI-slop enshitification so I can have a fallback
    • by KeithCu ( 925649 )
      AI is a tool with many uses. It's actually creating a new industrial revolution so it's better to have a positive attitude about it, but whatever. One of the first features I really liked is that I can select a mess of text (even with random extra markdown formatting characters), and tell the AI clean it all up and make a pretty table out of it. Sure, I could do that myself, but it's a PITA. The problem of slop will get better, and it's even much better now than a couple of years ago, but the AI doesn't ge
      • by dfghjk ( 711126 )

        "It's actually creating a new industrial revolution so it's better to have a positive attitude about it, but whatever. "

        It is not, but we can assume where you have money invested.

        "One of the first features I really liked is that I can select a mess of text (even with random extra markdown formatting characters), and tell the AI clean it all up and make a pretty table out of it."

        So you're an AI slop producer.

        "Sure, I could do that myself, but it's a PITA. The problem of slop will get better..."

        And is it real

        • by KeithCu ( 925649 )
          TBH, I debate discussing it with you since you are very sarcastic. In any case, the new industrial revolution evolves around machines being able to emulate reason and solve human problems at a super-human level (see: language translation, speech to text, coding, etc.) Just to be clear, in the example I'm thinking of, I created the table, but somehow the markdown got corrupted and was turned into a mess. The AI didn't create slop, it removed slop, and cleaned it up perfectly. It's the sort of boring work no
          • by _merlin ( 160982 )

            "AI" proponents keep touting language translation as something LLMs do well, yet they're absolutely dreadful at it for pairs of languages I'm familiar with. "AI" translation cannot get pronouns right when translating to/from languages where pronouns depend on the relationship between the speaker and listener (e.g. Korean and Viet). Admittedly it can be ambiguous if you only have a single sentence, but "AI" doesn't get better with more context. Give it enough material that it's unambiguous to any human, a

            • by mattr ( 78516 )

              Very long time fluent speaker / daily writer of business Japanese here. I also worked as a professional JP to EN translator so am very familiar with translation issues. I have found Claude Opus to be extremely helpful in two situations:

              1) Reviewing Japanese email / document I have written.
              - Finds typos
              - Gives good advice (sometimes too stiff so I don't listen anyway)
              - Points out awkward phrasing and offers better. It does follow some patterns too frequently, and sometimes it stops sounding like me. Yes I wo

            • by allo ( 1728082 )

              The trick is not to choose the right tool for the task. Many US LLM for example suck at European languages, but Mistral (and suprisingly Gemma) do much better. I'd think if you want Korean as target language EXAONE is worth a try, because LG is a Korean company, so it probably knows more Korean grammar than the typical US LLM does.

              • by allo ( 1728082 )

                Ignore the not. I changed the phrasing and forgot to remove it. The Trick *is* choosing the right LLM.

      • AI is a tool with many uses. It's actually creating a new industrial revolution so it's better to have a positive attitude about it, but whatever....

        I don't know why you think that calling it a new industrial revolution should make people feel better, or why people should adapt to it rather than fighting it. The industrial revolution eventually improved lives for many people, but it also came with a horrific price. People, including children, were forced to work in dangerous conditions that they rarely encountered while working on a farm. The lack of infrastructure led to breakdowns in sanitation, and spread of deadly diseases. The life expectancy in Li

        • by KeithCu ( 925649 )
          The goal isn't to make people feel better, but to explain what's going on so people don't just pretend it's going to go away. Of course we should fight for free AI, and against controlled AI, etc. There's a whole community of people building open models: https://huggingface.co/models [huggingface.co]

          Come join!

          We aren't going back to children working in factories. Marxism happened because it's taught in colleges. Economists can be wrong for 50 years without consequence, unlike programmers. (Unless you invade a country
    • You don't use LO because an unaffiliated third party wrote a plugin you don't like?

      That's completely fucking insane.

All the evidence concerning the universe has not yet been collected, so there's still hope.

Working...