TeXworks



Introduction

LaTeX works like this:

TeXworks: Source Linux, macOS, Windows (2021-03-11) 0.6.6 Free GPL: No Yes (pdf) Verbosus: Source Online, Android, iOS (2016-05-06) 4.1.3 Free Proprietary: Yes Yes (pdf) WinEdt: Source Windows (2018-05-07) 10.3 Non-free Proprietary: Yes No WinShell: Source Windows (2013-02-10) 3.3.2.6 Free Proprietary: Yes No Name Editing Style Native Operating. A simple interface for working with TeX documents. TeXworks has 3 repositories available. Follow their code on GitHub.

·First, you use a text editor (we'll be using TeXworks) to create a LaTeX document foo.tex (note: 'foo' is standing in for your file name).

·Then, you run a LaTeX compiler (we'll be using MiKTeX) to turn the file foo.tex into foo.pdf.

·Finally, you need to use some kind of viewer/previewer (we'll be using the one built into TeXworks) to view or print the pretty formatted file foo.pdf.

You will do everything from TeXworks, which we will set up to control MiKTeX. This document will take you through the steps of downloading, installing, configuring, and working with MiKTeX and TeXworks. Be sure to follow ALL of the directions below, IN ORDER. Consider this the first test of your logical thinking abilities!

I recommend that you print out this document so that you can refer to it easily and check off steps as you do them. Don't be afraid to send me email or stop by my office if you get really stuck. (Double-check that you have Actually Followed The Directions before you do this!)

Downloading and installing MiKTeX/TeXworks

  1. Go to http://www.miktex.org/download.
  2. Click the “Download Basic MiKTeX 2.9” button.
  3. Save the file (it should be called something like “basic-miktex-2.9.3248.exe”) to a place where you can find it. (The default is the folder “D:DataDocumentsDownloads”.) If you are using a wireless connection on campus, this might take up to 10 minutes to download. If you’re physically wired to the network it will be much faster.
  4. After it finishes downloading, double-click on the file to open it and select “Run” on the security warning. The Setup Wizard will now open.
  5. Accept the license agreement and click “Next” three times without changing anything. I mean it! Are you changing something? Stop it!
  6. At the settings, choose “Letter” for preferred paper size and “Yes” for installing packages on the fly. Click “Next” and then click “Start”.
  7. Wait for the computer to finish (~15 minutes) the install and then click 'Next' and “Close”.
  8. Throw away (put in the Recycle Bin) the installer “basic-miktex-2.9.3248.exe” which is still located where you downloaded it.
  9. Create a folder in your D: drive (NOT the C: Drive) in which you will save all your future work.
  10. Please note that MiKTeX is a shareware product. For a voluntary $15.00 donation they will provide direct email support; see their registration page.

Creating a simple document using LaTeX

Now we're finally ready to write a document in LaTeX. The instructions below will take you through the process of creating a very simple document.

  1. Open the TeXworks program. This can probably be found in your Start Menu,Programs, MikTeX 2.9, TeXworks. You might want to make a shortcut to this on the desktop.
  2. Write: In the TeXworks, type this:

documentclass{article}

begin{document}

Hello universe! $2^2 = sqrt{16}$

end{document}

  1. Save: Save this file as 'universe.tex' to whatever directory you choose. Be sure the extension is 'tex' and NOT 'txt”.
  2. Compile: Make sure the drop-down menu in your toolbar says “pdfLatex”. Then either click the compile button in the toolbar (looks like a green block with an arrow) or press CTRL+T. If there are no compiling errors in your .tex file, then in the same directory where you saved universe.tex should be three new files: universe.aux, universe.log, and universe.pdf. These files will be updated every time you run latex on universe.tex. Take a moment now to go to your directory/folder and check.

POSSIBLE PROBLEM: If only the file universe.tex is there then it is possible that your system does not know where MiKTeX is installed. If this happens, contact the instructor for help.

  1. View: If there were no compiling errors in your .tex file, then a copy of your document should have opened up in a separate window. If nothing shows up, then see the section below about handling compiling errors.
  2. Repeat: Now if you want to modify your file, go back and repeat the steps above: Write, Save, Compile, View.

Handling compiling errors

LaTeX is a very picky typesetting program, and a lot of tiny things can cause compiling errors. By following the instructions below you will introduce an error into your universe.tex file and then see how to deal with it.

  1. Change your universe.tex file so that it looks like this:

documentclass{article}

begin{document}

Howdy universe! $2^2 = sqrt{16}$

The & is a special character.

end{document}

  1. Save universe.tex and try to compile it (steps 2 and 3 above). Notice that the last line of the log file says that 1 error occurred and that the & sign did not show up in our output.
  2. Read the last few lines of information in the log window. It should look something like this:

! Misplaced alignment character &.

l.4 The &

is a special character.

  1. In LaTeX, the '&' character is used for tabbing (alignment) in certain environments, but it is not a legal character on its own; that is what the first line of the error message above is saying - that the character '&' is being used somewhere it shouldn't. The 'l.4' at the beginning of the next line of the error message tells you that the error is on line 4 (it says 'lowercase ell dot four' not 'one dot four' at the beginning of the line). Notice also that the line breaks where the compiler thinks your error might be: at the '&' character.
  2. It's pretty clear that we need to get rid of or modify that '&', but for the sake of this exercise, let's say you don't understand the error message completely, but you do think that line 4 could be the culprit. One thing you can do is 'comment out' the line in question, by inserting a '%' symbol at the start of the line. In LaTeX, the rest of the line following a '%' symbol is ignored by the compiler. Do this, and then compile again, and you should not get any errors.
  3. Of course, after the step above, you got rid of the error, but you also didn't get the document to say what you wanted; let's fix the error. In LaTeX, the character '&' can be produced by typing '&'. Un-comment line 4 (i.e. remove the '%' symbol) and put a backslash ' in front of the ampersand. Recompile and everything should work.

Printing a finished LaTeX document

If you want to print right from the computer you are working on, it's easy; just go to File à Print in the preview window.

If you want to print from a computer that does NOT have LaTeX installed (or you want to send your file to someone who does not have LaTeX installed, but needs to see your beautiful typeset file), in the same directory as you .tex file you should be find a .pdf file of the same name and this can be viewed and printed by anyone, on any computer, using Adobe Acrobat PDF Reader.

MiKTeX (pronounced mick-tech) is an up-to-date implementation of TeX/LaTeX and related programs.

TeX is a typesetting system written by Donald Ervin Knuth who says that it is intended for the creation of beautiful books - and especially for books that contain a lot of mathematics.

Easy to install

TexworksTexworks spell check

It is very easy to install MiKTeX on Windows. The MiKTeX Setup Wizard guides you through the installation process. You don't have to be a computer expert.

On a Mac, you can use the Drag'n'Drop installer to install MiKTeX.

Complete

A complete set of additions (programs, styles, fonts, …) are available to help you typeset your documents.

Integrated package management

MiKTeX's integrated package manager installs missing components from the Internet, if required. This allows you to keep your TeX installation as minimal as possible (“Just enough TeX”).

Always up-to-date

MiKTeX Console helps you to keep your TeX system up-to-date by installing the latest package updates.

TeXworks included

MiKTeX comes with TeXworks, a TeX frontend which you can use it to edit and preview LaTeX documents.

Texworks Png

Well maintained

Texworks Vs Texstudio

The MiKTeX package repository is updated regularly.

Texworks Windows

Open source

Texworks Download

MiKTeX is open source. You are welcome to redistribute MiKTeX under certain conditions.