# Can I run just a single line in TeXworks?

Sorry I realize this is an extremely basic question, but I am a complete newbie.

Sometimes I make a mistake when writing long math formulas; I would like to quickly check if I made any mistakes by running just that one line. Is it possible to do that?

I tried selecting the line and then pressing the "Typeset" button, but that didn't work.

No, that's not possible with standard TeX as a number of packages may influence what happens to the output. They will all have to be loaded in order to properly process the content.

If you're just interested in a quick view on the anticipated output on a line-by-line basis, you should consider an online equation editor (see the reference to Tiny equation compiler in Compiling documents online). For example, this one:

Then, once you're satisfied with the small part, you can copy-and-paste that in your document.

This is impossible because LaTeX needs everything you have in your .tex file in order to make an output. For this reason, I like to do the following:

1. Run LaTeX (or whatever your preferred flavor is) immediately to see if you can create an empty document. It should have a \maketitle, and should include any \usepackage commands, and obviously must include \begin{document} and \end{document}, but nothing else. This is mainly to test if your packages are imported correctly.
2. Run and rerun LaTeX often, and always check to see if it ran without errors.
3. If you get an error and you don't know what's causing it, comment out your code chunk by chunk with the % symbol. If you comment out a single equation and it compiles correctly, you now know where your bug is from.

These rules will help guide you through your coding. Also, if your error message is really confusing, try running it straight from terminal. I don't use TexWorks, but I've used others which try to "read your error message for you", and the best solution is usually to run it yourself and see what's really happening.

• Welcome to TeX.SX! TeXworks does not try to read error messages for you, it has a terminal view. Please note that \maketitle is not required in a minimal document. "Hello world" is sufficient, but what you surely need is a \documentclass. – TeXnician Dec 24 '18 at 8:01