# How can I use Dragon NaturallySpeaking to write LaTeX math formulas by voice efficiently?

I write LaTeX documents by voice using Dragon NaturallySpeaking for speech recognition. It allows me to write much faster than if I had to type on a keyboard (~ 100 WPM vs. 50), I find that voice commands are easier to remember than keyboard shortcuts and in the long run it prevents from RSI.

I would like to be able to write LaTeX math formulas by voice efficiently. How can I achieve that? Do there exist libraries of useful voice commands dedicated to LaTeX? Should I use Dragon NaturallySpeaking extensions such as NatLink, DragonFly or Vocola?

• IMHO, the finer points of mathematical expression are too niche for there to be any such tool, especially one that works reliably. Were I in your position, I would speak-insert a memo to myself (or simply speak the equation so you don't forget it) and hand-write the mathematics later, possibly using one of the many math editors there are out there. – Sean Allred Nov 16 '13 at 20:23
• I'm voting to close this question as off-topic because it is about non-TeX-specific tools for writing LaTeX code. – ChrisS Apr 21 '15 at 10:55
• @ChrisS Well, that's a shame. Many TeX users around me would be interested in this question, and the question is obviously TeX-specific... – Franck Dernoncourt Apr 21 '15 at 16:08
• I've voted to reopen this question. I think it is on topic; even though there are general issues involved, there is a substantial part that is likely to be quite LaTeX/TeX specific. (I'm less optimistic about you getting an actual answer, but I still think the question is very worthwhile. – Alan Munn Apr 21 '15 at 17:23
• @ChrisS -- this question is very important for visually disabled tex users. it deserves all the help it can get. like alan munn, i'm not really optimistic about immediately usable answers, but if the problem can raise enough awareness and attention, maybe someone will be inspired to develop something useful. (in a way, i'm surprised that there hasn't been more pressure to provide such facilities under the americans with disabilities act. the fact that math is a small niche market may be relevant, but if someone raised a challenge, ...) – barbara beeton Apr 21 '15 at 17:52

(This is an edited version of an answer I posted on Math Stack Exchange. The original question was about doing math without handwriting due to disability. link.)

(Context: I have a chronic pain condition and typing is very painful.)

I use a system based on NatLaTeX to dictate all of my formal mathematics, including anything in that I'm going to turn in for my coursework. Basically, NatLaTeX defines a speakable form of many common LaTeX commands, including everything you need for most mathematical expressions. Using a custom vocabulary in Dragon NaturallySpeaking, I can dictate a plain text file containing this NatLaTeX source. I then use scripts from the NatLaTeX project to transform my dictated text into actual LaTeX source, which I can then compile into nicely typeset mathematics using a standard LaTeX compiler. (Actually, I use a batch file to automate the process.) Just as a note, I have made several modifications to NatLaTeX in order to optimize it for mathematics (the original author was a physicist) and to adjust for changes in LaTeX. Feel free to contact me if you want a copy of the modified scripts. I do eventually intend to post them somewhere online, but I need to spend some time updating the documentation first (and that's really hard to justify spending time on it while I'm preparing for comprehensive exams!).

Advantages to NatLaTeX include flexibility and speed (no need to pause between "commands," unlike some other systems). Disadvantages include a steep learning curve and not being able to see your work (typeset or in LaTeX source) in real time. NatLaTeX is more verbose than LaTeX, so it's harder to read, but it can be edited using the built-in commands in Dragon, because everything is speakable.

You also don't get the advantages of using a nice text editor that does syntax highlighting etc., because Dragon only has "full text control" (which is necessary for easy editing by voice) in a couple of editors. I've actually written a good bit of NatLaTeX in MS Notepad for this reason. DtPad is a better, but still not great, option.

Here are a few examples to show how NatLaTeX works.

Discrete Math Example:
NatLaTeX Input (dictated with Dragon)

Given a poset "(P, precedes)", a collection of linear extensions" {calligraphy R }
equals left curly brace precedes sub one, precedes sub two, low dots, precedes sub
k right curly brace" is called a realizer'' of "P" if "precedes equals
intersection of sub {i equals one } to the k precedes sub k", where each relation
"precedes sub i" is interpreted as a set of ordered pairs and "intersection of"
is set intersection.  Equivalently, "{calligraphy R }" is a realizer of "P" if, for
all "p, q in P", "p precedes q" if and only if "p precedes sub i q" for all "one
less than or equal to i less than or equal to k".


LaTeX Output

Given a poset $$( P , \prec )$$, a collection of linear extensions $${ \mathcal R } = \{ \prec_1 , \prec_2 , \ldots , \prec_k \}$$ is called
a realizer'' of $$P$$ if $$\prec = \bigcap_{ i = 1 }^k \prec_k$$,
where each relation $$\prec_i$$ is interpreted as a set of ordered
pairs and $$\bigcap$$ is set intersection. Equivalently, $${ \mathcal R }$$ is a realizer of $$P$$ if, for all $$p , q \in P$$, $$p \prec q$$ if and only if $$p \prec_i q$$ for all $$1 \leq i \leq k$$.


Analysis Example:
NatLaTeX Input (dictated with Dragon)

begin theorem [Monotone Convergence Theorem]
Let "left curly brace f sub n right curly brace sub {n equals one } to the infinity"
be a sequence of nonnegative measurable functions with "f sub one less than or
equal to f sub two less than or equal to low dots less than or equal to f sub n less
than or equal to f sub {n +1 } less than or equal to low dots" and "limit of sub n
f sub n equals f" (pointwise). Then, "f" is measurable and
@begin{equation}
limit of sub {n right arrow infinity } integral f sub n d Greek mu equals integral
limit of sub {n right arrow infinity } f sub n d Greek mu equals integral f d Greek mu
@end{equation}
end theorem


LaTeX Output

\begin{theorem}[Monotone Convergence Theorem]
Let $$\{ f_n \}_{ n = 1 }^\infty$$ be a sequence of nonnegative
measurable functions with $$f_1 \leq f_2 \leq \ldots \leq f_n \leq f_{ n + 1 } \leq \ldots$$ and $$\lim_n f_n = f$$ (pointwise). Then, $$f$$ is
measurable and
$$\lim_{ n \rightarrow \infty } \int f_n d \mu = \int \lim_{ n \rightarrow \infty } f_n d \mu = \int f d \mu$$
\end{theorem}

• Apologies in advance, this is really a request to Anna Kirkpatrick following on from her answer, unfortunately I'm new to this site and can't find a better way to contact her. In the last 2 years I've both broken my neck and started a maths PhD. The result of this is that I need to type a lot of maths, but have very limited finger movement making typing very difficult. An effective voice to latex system is something then that I'm very interested in also and the natlatex solution that Anna Kirkpatrick mentioned sounds fantastic. I would be very interested in gaining a copy of your modified scri – user111618 Aug 8 '16 at 17:34

EDIT on 14th August 2018: Originally I sold this software on a website, but I recently made it open-source.

For Mac users I wrote an app to do precisely this, called SpeakLaTeX. It works with Dragon for Mac v6 although it's possible v5 may work too. There is a demonstration video:

The customisation interface is designed for people who want full control over what comes out onto the page. You can expand or change the default commands freely.

• Neat, would you advise to use Dragon or Mac dictation tool? – Franck Dernoncourt Aug 2 '17 at 18:43
• I've edited the post to mention that you can use either, or both simultaneously. Dragon input tends to be slightly faster on my testing. – Daniel Martin Aug 2 '17 at 18:50
• I'm curious to see this in action, however the video seems to be down - at least it appears unavailable for me (Western Europe) – Marijn Nov 19 '18 at 17:14
• Thanks Marijn, the permissions were set incorrectly. It's available now. – Daniel Martin Nov 20 '18 at 20:48
• @FranckDernoncourt You definitely want to use Dragon. Mac dictation has very little functionality beyond mere transcription. Dragon is faster, more accurate, and can be extended quickly. In my opinion the choice is easy and is the ideal option for any speech recognition solution. Additionally, although you can use both together, but you will see performance drops as both these applications take a hit on your CPU and RAM. – Srivats Shankar Dec 5 '18 at 16:58

At Michigan State University we us MathTalk and Scientific Notebook to dictate equations. http://www.mathtalk.com/

Dragon Naturally Speaking also has the ability to create macros that may be useful for commonly used LATEX strings.

I haven't used this yet, so I can't comment on how well it works, but voicecode extends Dragon Dictate and looks like it could handle this.

So far it's Mac only with Windows/Linux coming soon.

See this YouTube video for an example of voicecode in action. That example is coding in Ruby but the process looks transferable.

It sounds a bit crazy but it's a spoken language in it's own right for coding by voice, so it looks like it should support all of the symbols needed to construct LaTeX equations effectively by voice commands.

• Thanks for the info! I feel like this should be a comment instead, though, unless you can add more details / provide an example. – Sean Allred Jul 14 '15 at 18:50
• Hi Sean! At the time I didn't have enough rep to comment. I'll either edit the post or add another comment with an example. – Harry Jul 14 '15 at 18:59
• Additionally, while it would probably be a mouthful and a nightmare to speak, Mac OS X 10.9+ built in dictation can recognise punctuation and symbols, so in theory you could dictate equations, it just wouldn't be pretty ;) support.apple.com/en-gb/HT203084 – Harry Jul 22 '15 at 12:52

This post is now mostly out of date, so just see Mike Roberts' post about mathfly. There might be a little more vocab here than it is in mathfly https://gist.github.com/alexboche/cbad0f7b5ddf1e178b0edcf5a2beb601 and here's another demo https://www.youtube.com/watch?v=z-iHvPmjcas

Further to Alex's post about caster, this functionality has now been released as Mathfly, with full documentation and example videos on the Github page. It is built on top of Dragon Professional Individual and uses Natlink to load its grammars. The LaTeX module is enabled by saying "enable latex" and provides a wide range of commands for inserting LaTeX syntax.

For example, saying "begin equation" will insert:



and "symbol fraction" will produce:

\frac{}{}

Commands can be changed and new commands added on the fly very easily, making this (in my opinion) an incredibly natural and intuitive way to dictate LaTeX. There are also grammars for dictating into WYSIWYG editors like LyX and Scientific Notebook which eliminates the need to learn LaTeX syntax.

For a full list of commands, check out the documentation for the LaTeX module.

• Love the opening statement, you ought to patent, "Using the voice command “configure latex” ". Seriously I will certainly give it a try especially as my sight is getting older and fingers less nimble. (hence these many edits :-) – KJO Jan 25 at 22:29
• Mike Its not quickly clear if DNS via Natlink is essential for Mathfly to interface Castor with WSR (cheapskate I know, but I prefer minimal dependancies) – KJO Jan 25 at 22:43
• Ah, apologies for that, I've updated the answer. Dragon is expensive but it is definitely the best on the market, and performs impressively. My disability necessitates it but I'm certain that it is faster than typing anyway. – Mike Roberts Jan 25 at 22:51
• There is no longer a 7 day trial copy of Dragon Pro Individual (only 30 day money back offer) UK Students in receipt of the Disabled Student Allowance can get the pro version of Dragon at slightly more than half price e.g through dyslexic.com note other outlets are available. – KJO Jan 25 at 23:51