(La)TeX |
\documentclass{article}
\begin{document}
Hello, world!
\end{document}
(Btw, Crimson Editor is good for other things too, like editing of html-files.)
Note:
If the compilation is successful, the last line in the output-window will be:
Terminated with exit code 0Otherwise, if there is an error (in the syntax, not in the content ...) in your .tex-file, read what it says: it may tell you what the problem is. Then right-click in the output-window and select Kill Process; you can then try to correct the mistake in your file and compile again.
It may be useful to also create an icon for the LaTeX help-file on your desktop, as follows:
I intend to put together an introduction to (La)TeX, at a rate of perhaps a section per week, with the needs of EE-students in mind.
\documentclass{article}
... preamble: define layout and general commands ...
\begin{document}
... content ...
\end{document}
There are a number of different document classes: apart from 'article' there are 'book' and 'letter', and they have most of the typical formatting built in.
Note that the commands and special values in (La)TeX start with a back-slash '\'. Some of these take their input from brackets that follow them: so with each such instruction one needs to know what further information is allowed or required, and in which format it needs to be given; (like on the calculator.)
For instance, the first line above could read (-- 'pt' = 'point' is a measure of size; the alternatives here are '10pt' and '11pt'):
\documentclass[a4paper,12pt]{article}
(If you open an empty document in UltraEdit32, and click on 'Advanced' > Insert Template > 0, you will have a good starting point for a document: the margins are set narrower than the default settings.)
(La)TeX allows all manner of fine adjustment of the output on screen or page; try putting
This text is in normal size.
{\Large This text will be printed larger.}
into your document and compile and preview it. There are in fact 10 standard size-changing commands: '\tiny', '\scriptsize', ..., '\huge', '\Huge'; (note that case matters, 'huge' is not the same as 'Huge'!) The braces '{...}' define the scope of the command, to how much of the text it should apply.
But before getting used to using these, get used to not using them: the power of (La)TeX comes from the fact that you concentrate on the logical ordering of your material, and leave the details of the lay-out to the program.
Another thing that makes (La)TeX such a powerful tool is that you can define your own commands and values. See what happens when you put the next lines into the 'document' section of your file (-- the '\par' starts a new paragraph):
\newcommand{\mytext}{Try doing this in MS Word \ldots \par}
{\small \mytext}
{\normalsize \mytext}
{\large \mytext}
{\Large \mytext}
{\LARGE \mytext}
Happy TeXing!\( f(x) = (x + 1)^2 \)
\[ (x + 1)^2 = x^2 + 2x + 1 \]
\begin{equation} x^2 + 2x + 1 = 0 \end{equation}
The range of symbols that are available is much too wide to be listed here, so I will just give a few examples.
$\sin^2 \theta + \cos^2 \theta = 1$(the whole Greek alphabet is available, of course.) Whereas variables appear in italics, function-names with a \ prefixed will be upright.
$\displaystyle \int_0^{\frac 1 2}
\frac{1}{\sqrt {1 - x^2}} \;dx = \frac \pi 6$
(braces are used to group elements together; \displaystyle increases the size of symbols in fractions etc.) Matrices are easy too:
$\pmatrix{ 3 & -1 & 2 \cr 4 & 2 & 0 }^{-1}
\cdot \overrightarrow{PQ}$
If there is a notation that is missing, or one wants a shortcut, one can with a little experience define one's own commands:
\newcommand{\D}{\displaystyle}
$\D S_n = a\, \frac {r^n - 1}{r - 1}$
( \, and \; add a little extra space; \quad and \qquad add more space.) Over the years, many users have invented useful new commands that can be copied; thus, the following makes available the symbol for the set of natural numbers, which strangely is missing:
\newcommand{\N}{\mbox{$I\!\!N$}}
$3 \in \N$ but~ $\ln 3 \notin \N$
( ~ makes a hard space.) New commands can even take arguments, like
\newcommand{\area}[3]
{area $= {1 \over 2} \, #1 \, #2 \, \sin #3$}
\area{b}{c}{A}
With just a list of the many maths-commands that are available, most people should not find it too hard to produce nice-looking output quickly.
This is what a basic document might look like; you could copy and paste this into an empty document and then compile it (-- up to three times, for the table of contents to be compiled --) and look at it:
\documentclass[a4paper,12pt,titlepage]{article}
\title{Extended Essay:\\ My Really Interesting Topic}
\author{Who I. Am,\\ Atlantic College}
\begin{document}
\maketitle
\begin{abstract}
\noindent
This is a very brief abstract of no Extended Essay,
which probably looks better without an indent in the
first line; (an indent is the \LaTeX default.)
\end{abstract}
\tableofcontents
\newpage
\section{First Header}
Here goes the introduction, including something like a
'research question' that the IB says every essay should
have.
\newpage
\section{Second Header}
Here is where the body of the argment goes; of course
it makes sense to divide it into subsections.
\subsection{My Hypothesis}
With the documentclass 'article', to put the title page
and the abstract on separate pages, specify the option
'titlepage'.
\subsection{My Experiment}
By default, \LaTeX includes sections, subsections and
subsubsections in the table of contents, but this can
be changed.
\subsection[My Results]{How I Fiddled It}
Here, the text that appears in the table of contents
is 'My Results', but the heading in the text is the
truth, of course.
\subsection*{My Evaluation}
With the command in this form, the subsection is not
numbered and not entered into the table of contents.
\newpage
\section{Conclusion}
An E$^2$, like a novel, as was once recommended to an
eager beginner, should have a beginning, a middle and
an end.\par
The next line, by the way, enters a line which is not
a heading in the text into the table of contents
\newpage
\addcontentsline{toc}{section}{Appendix}
\appendix
\section{What I had no space for ...}
Note that after the command $\backslash$appendix,
sections are labelled with letters rather than
numbers.
\end{document}
The details for the titlepage are entered in the preamble, but they appear in the document when the command \maketitle is given.
As it is, the date when the document is compiled will be appear; with the command \date{07 November 2003} in the preamble, the fixed date will appear instead.
For each document three default fonts are set, a roman (serif) font, a sans serif font and a typewriter (monospace) font; the values of these are set by commands of the form
\renewcommand{\rmdefault}{ptm}
You can then choose which of the three to take as the main font family for your document by means of something like
\renewcommand{\familydefault}{\rmdefault}
Which families are available depends on the particular installation, but you should find at least the following:
| roman (serif) | \rmdefault | cmr, pbk, pnc, ppl, ptm |
| sans serif | \sfdefault | cmss, pag, phv |
| typewriter (monospace) | \ttdefault | cmtt, pcr |
| speciality fonts | cmfib, cmfr, cmdh, pzc |
(Unfortunately the characters are not in the same order in all font files, so if you get some 'funny' characters, try putting
\renewcommand{\encodingdefault}{T1}
into the preamble.)
\usepackage{bookman}
in the preamble; (try it first without using any of the other commands to change defaults -- you can always 'comment out' the text on a line without having to remove it, by putting a %-sign in front of it.)
| text fonts | bookman, palatino, times | |
| math fonts | amsmath | provides a variety of extra mathematical features |
| eucal | sets up the command \CMcal{} to use the Euler script symbols in math mode | |
| eufrak | sets up the command \mathfrak{} to use the Euler Fraktur alphabet in math mode | |
| text font and a matching math font | mathpazo, mathpple, mathptmx | |
\renewcommand{\seriesdefault}{bx}
\renewcommand{\shapedefault}{it}
The possible values for the series are 'bx' (= bold face) and 'm' (= medium,) and for the shape 'it' (= italics,) 'sl' (= slanted,) 'sc' (= small capitals) and 'n' (= normal.) The defaults are medium normal.
If, as sometimes happens, there are no font files for some combination of family, series, shape and size, then (La)TeX will produce a warning
Font shape `T1/cmss/m/sc' in size <12> not availableand try to find a substitute.
This is normal text and {\scshape Small Capitals,}\\
{\ttfamily monospace and {\slshape slanted monospace,}}\\
{\itshape italics and {\bfseries bold italics,}} and \\
{\sffamily it even works {\large in different sizes.}}
Conveniently, each of these declarations has a corresponding command, i.e. the following two lines will produce the same output:
{\slshape slanted text {\bfseries and also bold}}
\textsl{slanted text \textbf{and also bold}}
And once again you can easily define new commands for fonts that you use frequently:
\newcommand{\myfont}[1]{\texttt{\textsc{#1}}}
I can now \myfont{change to My New Font} and back.
-- here the new command \myfont takes one argument, which is the section of text to which it is applied.
\setlength{\unitlength}{0.8cm}
\begin{picture}(8,5)
...
\end{picture}
Here the two numbers after \begin{picture} determine the width and height of the picture, and the \setlength -command determines the unit that is used throughout -- so this picture would actually be 6.4 cm wide and 4 cm high. That makes rescaling the picture very easy: just change the value of \unitlength.
Objects are drawn into the picture with the \put -command:
\put(0.2,1){\vector(1,0){7.6}}
\put(1,0.2){\vector(0,1){4.6}}
\put(0.5,4){\line(2,-1){5.5}}
The two numbers after \put are the starting coordinates, the two numbers in (...) after \vector and \line are the Δx and Δy that determine the gradient, and the number in {...} is the length of the arrow or line.
Here are some more things we can draw into our picture:
\multiput(2,1)(1,0){6}{\line(0,-1){0.2}}
\put(1.9,0.3){1}
\put(7.5,1.2){$x$}
\put(3.4,3){gradient $m = - \frac 1 2$}
After the \multiput, the first pair of numbers are the starting coordinates, the second pair determine the change from one object to the next, and the number in {...} determines how many objects are drawn.
It is easy to look up the commands for other objects in the help-file -- it may be useful to put a link to ...\texmf\doc\latex\help\latex2e.html onto your desktop.
Unfortunately, the (La)TeX picture-environment is rather limited in what can be done; for instance only circles up to 40pt diameter and only lines whose gradients are very simple ratios can be drawn. Fortunately, though, there are packages that can be used that make available many more useful commands.
To be able to use a package, you have to load it in the preamble, i.e. before the line \start{document}, with a command like
\usepackage{curves}
For (La)TeX to be able to find the .sty-file for the package, it may be easiest for now if you just put it into the same directory as the .tex-file in which it is used. To obtain the file, right-click on the link below and select 'Save Target As ...'
With the package curves.sty, commands like the following become available (-- all the details can be found in curves.dvi):
\put(4,2.5){\bigcircle{4.8}}
\put(4,2.5){\arc(3,0){-45}}
\put(1,1){\curve(0,1,1,0,2,1,3,4)}
Similarly, if you use the packages epic.sty (for 'extended picture environment') and eepic.sty for ('extended extended picture environment') commands like the following can be used (-- again, all the details can be found in eepic.dvi):
% draw lines of any gradient
\put(3.6,0.4){\line(7,3){4}}
% define symbols to use in the graphs
\newcommand{\mybull}{\makebox(0,0){$\bullet$}}
\newcommand{\mycirc}{\makebox(0,0){$\circ$}}
% draw a line graph, method 1
\put(1,3){\path(0,0)(5,1)(6,-2)}
\put(1,3){\mybull}
\put(6,4){\mybull}
\put(7,1){\mybull}
% draw a line graph, method 2
\begin{dashjoin}{0.1}
\jput(1,1.5){\mycirc}
\jput(2,4.5){\mycirc}
\jput(7,0.5){\mycirc}
\end{dashjoin}
\put(2.2,4.6){maximum}
(Remember that the symbol % makes the rest of the line a comment, which will not appear in the .dvi file or on the print-out.)
\setlength{\hoffset}{-15.4mm}
\setlength{\voffset}{-25.4mm}
\setlength{\evensidemargin}{5mm}
\setlength{\footskip}{5.4mm}
\setlength{\oddsidemargin}{5mm}
\setlength{\textwidth}{180mm}
\setlength{\textheight}{260mm}
You should be able to look up other variables whose values can be redefined.