How to write electronic solutions

You will get what you see, but are you sure you want it?

You have already prepared some texts on the computer and probably you have used Word or some similar software. Word is so-called WYSIWYG editor, which means that you edit directly the output, visual file (from English What You See Is What You Get). However, this breaks the Separation of content and presentation principle (if you already have worked on some larger project, you will know what we are talking about).

Typesetting documents using TeX is somehow similar to writing code. You work (write, edit,…) with the source code (in a text editor), which is then compiled (that is what TeX does) into the desired output document, such as PDF. Therefore, to create documents using TeX, you will need an editor, compiler (TeX) and browser (Adobe Reader, internet browser etc.).

What is it good for? Why should I make my work more complicated (compared to Word)? As mentioned above, it separates content and presentation much better (which makes it easier to modify), you can easily use our template, which contains everything you need and considering typesetting of mathematical formulae, TeX is a must.

We honestly add, that since 2007, the equation editor in MS Office is usable as well. It is possible to use TeX to typeset equations in Word as well.

MiKTeX installation

We have mentioned above how many programmes are necessary to compile TeX documents. You do not need to worry about obtaining and configuring them. For Windows, there is a distribution MiKTeX, which solves it for you.

From MiKTeX web download the desktop installer. We recommend to update all packages after installation using Start » MiKTeX » Update (Admin).

Editor TeXworks is part of the distribution. We run it and write the following document in UTF-8 (we will choose the encoding in the lower right part):

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\title{Hello world!}
\author{Student}
 
\begin{document}
 
\maketitle
\section{Header}
My first page in TeX.
\end{document}

In the compiler profiles (left upper part) we choose pdfLaTeX and run the compilation using the green button. If everything is alright, the first page typeset by TeX appears to the right of the editor. It is a common PDF document open in the integrated browser. Using Ctrl+click you can move between the source code and the relevant place in PDF and vice versa.

Installation of FYKOS macros

The visual appearance and compilation of the document could be changed by loading so-called packages to the compiled document (you have probably noticed the line containing usepackage, that is exactly it).

The packages are saved in files similar to the source file, which you are compiling on your own. TeX search this files firstly in the directory with the compiled source code, secondary in its own directory.

To make typesetting of mathematical formulae faster and cleaner we prepared the package fkssugar and to set document properties we created the documentclass fkssolpub.

It follows that we would have to copy files fkssugar.sty and fkssolpub.cls every time we would want to compile. This is easy, but not elegant nor long-term. Therefore we will save the files somewhere else and force TeX to spread its directory to reach them.

Run Start » MiKTeX » Maintenance (Admin) » Settings and navigate to the 'Roots' bar and add there the path to the directory with the downloaded macros.

A brief mention about other editors

Typesetting mathematics

We chose TeX to typeset maths. Let us mention, how to do it. Short formulae, relations and variables typeset in row mode between dollars.

The numbers on the dice fulfill $0 < n < 7$.

Larger and more complex formulae are typeset in block mode using the 'equation' environment.

The force equals
\begin{equation}
    F = mg \sin(\alpha)\,.
\end{equation}

Arguments of the macros are inside curly braces (braces can be omitted if the argument is one character - but may cause unexpected behaviour or errors…). The most commonly used commands are

  • power $2^5 = 32$
  • root $\sqrt{1-\sin^2(x)} = |\cos(x)|$
  • fraction $\frac{p}{q}$.

Other useful commands are in package fkssugar.

If you do not want to install the whole TeX army, you can use similar syntax in equation editor in OO Writer or MS Word (now can use TeX syntax as well).

We want TeX MS Word OO Writer
fraction \frac{a}{b} (a)/(b) {a} over {b}
power x^{a+1} (a)^(b) a^{b}
root \sqrt[3]{x-1} \sqrt(3&x-1) nroot{3}{x-1}
lower index a_1 a_1 a_{1}

A small dictionary

TeX

a software for compiling source code into PDF of sub-format DVI (must be followed by one more compilation to get the desired PDF)

LaTeX

TeX with extended functionality – macros; one may say that TeX is for typesetting, LaTeX for typography

XeTeX

the same function as TeX, but directly supports Unicode and can use OpenType fonts (e.g. from the system)

XeLaTeX

extension of XeTeX as in case of TeX

Unicode

character encoding for almost all existing alphabets, most commonly is saved encoded as UTF-8

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Partners

Host

Media partner


Created with <love/> by ©FYKOS – webmaster@fykos.cz